fix(rewrite): keep the minus sign on a line-initial negative number (#821) - #924
Open
Vaishnavi1709 wants to merge 1 commit into
Open
fix(rewrite): keep the minus sign on a line-initial negative number (#821)#924Vaishnavi1709 wants to merge 1 commit into
Vaishnavi1709 wants to merge 1 commit into
Conversation
…821) `cleanRewriteLine` stripped the minus off a line-initial negative number, so `-5% churn` reached the résumé — and the exported ATS PDF — as `5% churn`. A reduction read as a gain, and nothing downstream looked wrong: the line stayed grammatical and the figure stayed plausible. `LIST_MARKER_PATTERN` folded `-` and `•` into one `[•\-]\s*` branch that accepted zero trailing whitespace. Inside the fixed-point loop #806 added, pass 1 removed the `- ` marker and pass 2 read the uncovered `-` as a bullet glyph and removed it too; the bare `-5%` shape needed only one pass and predates the loop. This is the dash-side twin of the decimal bug #806 fixed on the numbered branch, which the loop's docblock already warns about — the `-`/`•` branch was carried over without the same check. Split the two glyphs apart and withhold the zero-space branch from `-` when a number follows: `-(?:\s+|(?!\.?\d))`. `•` keeps `\s*` because it is only ever a glyph, never part of the text it precedes. Note the fix differs from the one suggested on the issue. A positive `(?=[A-Za-z])` lookahead regresses the tight `-**Led** the migration` case pinned at post-process.test.ts:194, since `*` is not a letter. The negative lookahead on the number is the property actually wanted, and it covers `-.5%` as well as `-5%`. Six negative-number rows join the decimal-preservation `it.each` table — the table that already asserts this property for the numbered branch — plus a sign-preservation property test across all five marker shapes. All seven fail against the pre-fix pattern.
Deploying offlinecv with
|
| Latest commit: |
f152fae
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5ca556be.offlinecv.pages.dev |
| Branch Preview URL: | https://fix-821-negative-number-minu.offlinecv.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cleanRewriteLinestripped the minus off a line-initial negative number, so-5% churnreached the résumé — and the exported ATS PDF — as5% churn. A reduction read as a gain, and nothing downstream looked wrong: the line stayed grammatical and the figure stayed plausible.LIST_MARKER_PATTERNfolded-and•into one[•\-]\s*branch accepting zero trailing whitespace. Inside the fixed-point loop from #806, pass 1 removed the-marker and pass 2 read the uncovered-as a bullet glyph and removed it too; the bare-5%shape needed only one pass and predates the loop. This is the dash-side twin of the decimal bug #806 fixed on the numbered branch — the loop's own docblock warns that "any strip added to this loop must be checked the same way", and the-/•branch was carried over without that check.The fix splits the two glyphs apart and withholds the zero-space branch from
-when a number follows:•keeps\s*because it is only ever a glyph, never part of the text it precedes.-is the one marker that doubles as ordinary content.Closes #821
Deviation from the fix proposed on the issue
Worth flagging explicitly, since the issue body specifies a different regex.
The suggested
-(?:\s+|(?=[A-Za-z]))regresses an existing test: it stops stripping the tight-**Led** the migration of billing.case pinned atpost-process.test.ts:194("tight dash, no space"), because*is not a letter, so the lookahead fails and the marker survives. Caught by simulating the fixed-point loop over every existing marker case before writing code.A negative lookahead on the number is the property actually wanted, and
(?!\.?\d)additionally covers-.5%as well as-5%.Review focus
src/lib/webllm/post-process.ts:127— the\s+branch is deliberately left unguarded, on the reasoning that- 5%is a marker plus a positive number and a genuine negative is written- -5%. Is there a shape where a model emits-followed by an intended negative with no second sign?src/lib/webllm/post-process.ts:127—(?!\.?\d)is a lookahead, so a tight-before a non-number still strips as before. Does that hold for every non-letter opener the rewrite path can emit (-**Led**,-"quoted",-(paren))?Test plan
npm run typecheckcleannpm run lintcleannpm run verifygreen (also re-run by thepre-pushhook)383 files / 6457 tests passed, 8 skipped. Run explicitly rather than relying onverify's scopedtest:changedselection.-Shipped X,-**Led**,• 4.2%,- 3.5x,1. Fooand*Foo.*unchanged.Six negative-number rows join the decimal-preservation
it.eachtable — the table that already asserts this property for the numbered branch — plus a sign-preservation property test across all five marker shapes.No fixture binaries touched, so the fixture-PII preflight does not apply.