Fix to_gpt comma punctuation spacing#32
Conversation
GHX5T-SOL
left a comment
There was a problem hiding this comment.
Verified the to_gpt comma-spacing fix for #26. The regex now removes spaces before ?, !, ,, and : without the unreachable |, alternation branch.
Validation:
npm ci-> completed; npm reports existing audit findings, and this PR does not change dependenciesnpx jest --config jest.config.ts --no-color --ci test/to_gpt.test.ts --coverage=false-> 1 suite passed, 2 tests passednpx eslint src/to_gpt.ts test/to_gpt.test.ts --config eslint.config.mjs-> passednpx tsc --noEmit-> passedgit diff --check origin/master...HEAD-> passedgit diff origin/master...HEAD | gitleaks stdin --no-banner --redact --exit-code 1-> no leaks found
Live pre-review state: open, non-draft, mergeable/UNSTABLE only because no GitHub checks are reported, no existing comments/reviews. Same-scope open PR search for to_gpt comma punctuation spacing returned only this PR. I did not run the full live endpoint suite.
kreinba
left a comment
There was a problem hiding this comment.
Fix is correct: the character class [?!,:] replaces the broken \?|!|\|,|: alternation, whose third branch was the literal two-char sequence |, rather than a bare , — exactly the defect named in #26. Diff stays scoped to src/to_gpt.ts plus the regression in test/to_gpt.test.ts, which covers each of the four punctuation marks. Verified locally on head 447d947: npx jest test/to_gpt.test.ts is green, npx tsc --noEmit and npx eslint src/to_gpt.ts test/to_gpt.test.ts are clean. No CI checks have been reported on the branch.
|
@kreinba Thanks for the review! You've earned +6 points for this: +18 as a basis; -8 for absolutely no comments posted; -4 for too few (6) hits-of-code. Your running score is +1458; don't forget to check your Zerocracy account too). |
|
Merged current Validation:
Hosted checks on |
Fixes #26.
Summary:
to_gptremoves spaces before bare commas as intended.!,,,:, and?.Reproduction:
"hello , world".replace(/ (\?|!|\|,|:)/g, "$1")returnshello , world."hello , world".replace(/ ([?!,:])/g, "$1")returnshello, world.to_gpt("Wait ! Look , here : why ?")returnsWait! Look, here: why?.Validation:
npm cipassed; npm reports existing dependency audit findings.npx jest --config jest.config.ts --no-color --ci test/to_gpt.test.ts --coverage=falsepassed.npx eslint src/to_gpt.ts test/to_gpt.test.ts --config eslint.config.mjspassed.npx tsc --noEmitpassed.git diff --checkpassed.git diff -- src/to_gpt.ts test/to_gpt.test.ts | gitleaks stdin --no-banner --redactreported no leaks.Limitations:
npx jest --config jest.config.ts --no-color --cicurrently fails in existingbaza/servertests that call live Zerocracy endpoints and now receive token/CSRF HTTP errors. The changedto_gpttest file passes.