Skip to content

Keep one-letter skills without corrupting others - #50

Merged
jserv merged 1 commit into
sysprog21:mainfrom
Disesfgewu:fix-grounding-short-skills
Sep 21, 2026
Merged

jserv merged 1 commit into
sysprog21:mainfrom
Disesfgewu:fix-grounding-short-skills

Conversation

@Disesfgewu

@Disesfgewu Disesfgewu commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

What

unique() dropped any candidate shorter than two characters, meant to drop
stray punctuation left over from a bad split. It also silently dropped
one-letter skills like C and R before a candidate could choose them.

Removing that floor exposed a second bug: clean()'s leading-strip regex
swallowed a bare digit run, so 5G lost its 5 and survived as the
fabricated skill G.

Why

  • unique() now keeps a token only if it has a letter. Punctuation-only
    fragments and bare numbers (24/7, 100%, 2015, 27001, 3.14) are
    dropped, whether typed alone or split from a prefix like ISO.
    ISO 9001 and 802.11ac are kept.
  • Bare part numbers such as 6502 and 8051 are dropped too. This is an
    accepted loss: 8051 and 2025 have the same shape, so a filter that goes
    by shape cannot keep one and drop the other. A named part (MOS 6502,
    Z80) is kept.
  • clean() now strips only a real list marker: a bullet, a run of dashes or
    asterisks followed by whitespace, or digits followed by . or ) and then
    whitespace or two letters. Digits are matched with \p{Nd}, so a
    full-width 1. counts like 1..
  • As a result 5G, 3D, 4K and 9.x Java stay whole, while 1. Must,
    1.Must, ** Must and -- Must lose thei

Known limits

  • The two-letter rule after . is a heuristiits
    marker and 3.js experience loses its 3..
  • A dash or asterisk glued to the text --Mu is,
    since stripping it would eat into real content such as -Java.

Testing

node --test tests/browser/document-grounding.test.js: 35 tests pass, with
new coverage for one-letter skills, digit-leded
markers with and without a space, runs of asterisks, version wildcards,
full-width digits, and bare part numbers. `es


Summary by cubic

Fixes grounding extraction so one-letter skills like C and R survive, and 5G is no longer corrupted into G. The old length floor dropped stray punctuation but also erased one-letter skills; removing it exposed clean() treating bare digit runs as list markers.

Changes

  • clean() now strips only real list markers: bullet glyphs, dash/asterisk runs before whitespace, and digits followed by ./) and then whitespace or two letters. Requirement lines still lose 1.Must and ** Must, while 3D and 9.x Java stay whole.
  • unique() now keeps a token only if it has a letter, so pure punctuation and bare numbers are dropped — 24/7, 100%, 27001, 3.14, and part numbers like 6502 — while named forms like ISO 9001, 802.11ac, and MOS 6502 survive.

Written for commit 77f801b. Summary will update on new commits.

Review in cubic

cubic-dev-ai[bot]

This comment was marked as resolved.

Comment thread web/document-grounding.js Outdated
Comment thread web/document-grounding.js Outdated
@Disesfgewu
Disesfgewu requested a review from jserv September 16, 2026 15:31

@jserv jserv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent via make indent and then squash commits without Claude markers.

@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch 2 times, most recently from 1496214 to 2ad5ddb Compare September 16, 2026 15:43
@Disesfgewu
Disesfgewu requested a review from jserv September 16, 2026 15:45
@Disesfgewu

Copy link
Copy Markdown
Contributor Author

Indent via make indent and then squash commits without Claude markers.

Sorry about that! I've run make indent, squashed the commits, and pushed the updates. Could you please take another look when you have a moment? Thanks!

@jserv

jserv commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

I've run make indent, squashed the commits, and pushed the updates. Could you please take another look when you have a moment?

You didn't. Check git manual carefully for git rebase.
Don't be overly polite by including "sorry" in replies; it is not particularly useful during collaboration.

@Disesfgewu

Copy link
Copy Markdown
Contributor Author

Oops. I check that again.

@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch from 2ad5ddb to 618f25b Compare September 16, 2026 16:07
@jserv

jserv commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Check Git Squash Commits: How to Combine Commits Into One by using git rebase -i carefully.

cubic-dev-ai[bot]

This comment was marked as resolved.

@ColtenOuO ColtenOuO left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's recommended to make the commit message title relevant to the actual changes, as this helps others quickly understand the updates when reviewing.

@Disesfgewu

Copy link
Copy Markdown
Contributor Author

It's recommended to make the commit message title relevant to the actual changes, as this helps others quickly understand the updates when reviewing.

That's very helpful advice. I'll apply this practice to my future commits.

@ColtenOuO ColtenOuO left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a reminder, once the issue pointed out is fixed, we should add a regression test for it to ensure the bug doesn't come back in future updates.

@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch from 618f25b to 5af2df8 Compare September 16, 2026 16:33

@jserv jserv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase latest main branch and refine commit messages properly.

@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch 2 times, most recently from 1f9eec9 to a1f91ad Compare September 16, 2026 16:44
@jserv
jserv requested a review from ColtenOuO September 16, 2026 16:46
cubic-dev-ai[bot]

This comment was marked as resolved.

@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch from a1f91ad to c932cb1 Compare September 16, 2026 16:50
Comment thread web/document-grounding.js Outdated
Comment thread tests/browser/document-grounding.test.js
@ColtenOuO

Copy link
Copy Markdown
Collaborator

Also, I don't think it's a good idea to describe the collaboration process in the commit body. It should focus on what was actually changed.

This issue is still present in the current commit message.

cubic-dev-ai[bot]

This comment was marked as resolved.

Comment thread web/document-grounding.js Outdated
Comment thread web/document-grounding.js Outdated
Comment thread web/document-grounding.js Outdated
@ColtenOuO

Copy link
Copy Markdown
Collaborator

Squash the commits touching the same files into one and reword the commit message to reflect the updated state.

@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch 4 times, most recently from e63a31d to c8f549a Compare September 17, 2026 11:14

@jserv jserv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read https://chris.beams.io/git-commit carefully and enforce the rules.

@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch from c8f549a to 1149e07 Compare September 17, 2026 12:42
@sysprog21 sysprog21 deleted a comment from cubic-dev-ai Bot Sep 17, 2026
cubic-dev-ai[bot]

This comment was marked as resolved.

@jserv
jserv requested a review from ColtenOuO September 17, 2026 13:50

@ColtenOuO ColtenOuO left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remember to resolve the open comments and add regression tests.

Comment thread web/document-grounding.js Outdated
@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch from 1149e07 to 500155f Compare September 17, 2026 23:03
ColtenOuO

This comment was marked as resolved.

@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch from 500155f to b9d5fa7 Compare September 18, 2026 15:57
@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch from b9d5fa7 to e5dc8d3 Compare September 18, 2026 16:20

@ColtenOuO ColtenOuO left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit message is a bit contradictory, please fix it.

By the way, the previously mentioned issue with the PR description has not been resolved.

Once the commit message and PR description are fixed, this will be good to go from my side.

Comment thread web/document-grounding.js Outdated
// but not the marker itself for these common copy-paste shapes, so the
// digit case relies on "." or ")" following the digits instead: that still
// protects "5G" and "3D", which no "." or ")" ever follows.
const jd = await parseGroundingFile(txt("1.Must know Rust\n1.) Should know Go\n-- Must know Python"), "jd");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dashed fixture carries a space, so the "dashed marker with no space" half of the name is never exercised: --Must know Python is left intact, because the dash branch still requires \s+. Use that input and make the branch handle it, or narrow the name to the numbered case this actually covers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would narrow the name to the numbered case this actually covers.

Comment thread web/document-grounding.js Outdated
Comment thread web/document-grounding.js Outdated
Comment thread web/document-grounding.js
// would have to guess at.
function unique(values, max) {
return [...new Set(values.map(clean).filter((value) => value.length >= 2))].slice(0, max);
return [...new Set(values.map(clean).filter((value) => /\p{L}/u.test(value)))].slice(0, max);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every letterless token goes, and on a systems resume that is the part numbers: 6502, 8051, 68000, 802.3 and 99.999% all cleared the old floor and clear nothing here. The rationale above covers years, percentages and split standards but not bare part numbers, which is the one class the audience named in the first test of this change lists without a letter anywhere near them. Worth saying whether that loss is accepted, since the title's bug (a two-character floor hiding C and R) does not require it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, tokens like 8051 or 6502 are format-wise indistinguishable from years (e.g., 2015) or arbitrary numbers without deeper contextual analysis.

Since we currently lack the context to tell them apart, treating letterless tokens uniformly is a trade-off we accept for now. I would update the PR rationale to explicitly call out this limitation.

@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch from e5dc8d3 to 0119193 Compare September 19, 2026 02:46

@jserv jserv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refine commit messages per https://chris.beams.io/git-commit

The two-character floor in unique() was meant to drop stray punctuation
but also dropped skills like C and R, so a token now has to contain a
letter instead. That drops punctuation and bare numbers, including part
numbers such as 6502, which cannot be told from a year. Without the
floor, clean() turned 5G into G because it took any leading digits for
a list marker, so it now strips only real markers, which keeps 5G and
9.x Java whole.
@Disesfgewu
Disesfgewu force-pushed the fix-grounding-short-skills branch from 0119193 to 77f801b Compare September 20, 2026 23:08
@jserv

jserv commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Thank @Disesfgewu for contributing!

@jserv
jserv merged commit a5b7e60 into sysprog21:main Sep 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants