scripts(closing-keywords): a disclaimer wrapped at 79 columns reads as a claim #2245

Merged
jaylouisw merged 1 commit from fix/1120-0232 into main 2026-11-20 03:07:52 +00:00
Owner

Summary

A pull-request body that disclaims a close, hard wrapped at 80 columns, was read as a claim by both parsers — the checker called it safe and the sweeper would have closed the request itself.

What was wrong

Both scripts/check-closing-keywords.js and scripts/close-merged-issues.js read the clause before a keyword as the text after the last line break:

s.slice(Math.max(0, m.index - 40), m.index).split(/[.!?:;\n]/).pop()

Wrapped prose puts the negation and the issue number on different lines, so NEGATION was handed an empty string and CLAIM_START saw a line start. The same sentence gives opposite verdicts:

one line -> sweeper closes: []     checker at-risk: 1
wrapped  -> sweeper closes: [130]  checker at-risk: 0

The wrapped form is the severe one: parseClosingKeywords returns the number, so close-merged-issues.js posts the comment and closes the request — the exact accident this tooling exists to prevent.

What changed

clauseBefore() in both scripts: a line break is still a boundary for CLAIM_START (a claim really can open a line), but when the text immediately before the keyword carries no word of its own, the clause continues on the line above. The two parsers keep the same rule, so test/closing-keywords.test.js's "held in step" section still holds.

Tests

  • test/closing-keywords.test.js — 35 assertions, 0 failed. Six new ones: the wrapped disclaimer is flagged negated, the sweeper no longer cites it for not and for cannot, plus controls that a claim after a full stop, two claims on two lines, and a claim following an unrelated negation still parse.
  • test/close-merged-issues.test.js — 81 assertions, 0 failed.
  • npm test — 395 suites, 13,222 assertions, 0 failed.
  • node scripts/syntax-check.js — 475 files, all OK.
  • Noise check: 50 recent merged bodies, 2 flagged and both are the known accidents (#2005, #2224); no genuine claim newly flagged.

Scope

Latent, not a live miss: none of the last 50 merged bodies has a keyword opening a wrapped line. Nothing here changes which issues are open.

Refs #130

## Summary A pull-request body that disclaims a close, **hard wrapped at 80 columns**, was read as a claim by both parsers — the checker called it safe and the sweeper would have closed the request itself. ## What was wrong Both `scripts/check-closing-keywords.js` and `scripts/close-merged-issues.js` read the clause before a keyword as the text after the last line break: ```js s.slice(Math.max(0, m.index - 40), m.index).split(/[.!?:;\n]/).pop() ``` Wrapped prose puts the negation and the issue number on different lines, so `NEGATION` was handed an empty string and `CLAIM_START` saw a line start. The same sentence gives opposite verdicts: ``` one line -> sweeper closes: [] checker at-risk: 1 wrapped -> sweeper closes: [130] checker at-risk: 0 ``` The wrapped form is the severe one: `parseClosingKeywords` returns the number, so `close-merged-issues.js` posts the comment and closes the request — the exact accident this tooling exists to prevent. ## What changed `clauseBefore()` in both scripts: a line break is still a boundary for `CLAIM_START` (a claim really can open a line), but when the text immediately before the keyword carries no word of its own, the clause continues on the line above. The two parsers keep the same rule, so `test/closing-keywords.test.js`'s "held in step" section still holds. ## Tests - `test/closing-keywords.test.js` — 35 assertions, 0 failed. Six new ones: the wrapped disclaimer is flagged `negated`, the sweeper no longer cites it for `not` and for `cannot`, plus controls that a claim after a full stop, two claims on two lines, and a claim following an unrelated negation still parse. - `test/close-merged-issues.test.js` — 81 assertions, 0 failed. - `npm test` — 395 suites, 13,222 assertions, 0 failed. - `node scripts/syntax-check.js` — 475 files, all OK. - Noise check: 50 recent merged bodies, 2 flagged and both are the known accidents (#2005, #2224); no genuine claim newly flagged. ## Scope Latent, not a live miss: none of the last 50 merged bodies has a keyword opening a wrapped line. Nothing here changes which issues are open. Refs #130
scripts(closing-keywords): a disclaimer wrapped at 79 columns reads as a claim
All checks were successful
CI / Classify the change (pull_request) Successful in 10s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 11s
CI / Test (Node 20) (pull_request) Successful in 1m3s
CI / Test (Node 22) (pull_request) Successful in 1m3s
CI / Test (Node 18) (pull_request) Successful in 1m9s
CI / Server smoke and Docker build (pull_request) Successful in 20s
CI / Arm auto-merge (pull_request) Successful in 4s
967589ef7a
Both parsers took the clause before a keyword as the text after the last
line break. A body hard wrapped at 80 columns puts the negation and the
issue number on different lines, so NEGATION was handed an empty string
and CLAIM_START saw a line start: the disclaimer became a claim.
check-closing-keywords reported "0 at risk" and parseClosingKeywords
returned the number, which is a close the sweeper would have performed
itself - the exact accident this tooling exists to prevent.

clauseBefore() reads back past a line break when the text immediately
before the keyword carries no word of its own, with the same rule in both
scripts. A line break stays a boundary for CLAIM_START, so a claim that
opens a line still parses.

No merged body in the last 50 has a keyword opening a wrapped line, so
this was latent; the one-line form of the same sentence was already
reported correctly. Six assertions in test/closing-keywords.test.js, with
controls that a claim after a full stop, two claims on two lines, and a
claim following an unrelated negation still parse.

Refs #130
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-20 02:43:34 +00:00
jaylouisw deleted branch fix/1120-0232 2026-11-20 03:07:57 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!2245
No description provided.