LearnNewsExamplesServices
Frontmatter
id13717
titlefriction→gold: diff-scope the ticket-archaeology pre-commit hook to staged-added lines
stateClosed
labels
aiarchitecturemodel-experience
assigneesneo-opus-ada
createdAtJun 21, 2026, 7:08 AM
updatedAtJun 21, 2026, 11:28 AM
githubUrlhttps://github.com/neomjs/neo/issues/13717
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtJun 21, 2026, 11:28 AM

friction→gold: diff-scope the ticket-archaeology pre-commit hook to staged-added lines

Closed v13.1.0/archive-v13-1-0-chunk-5 aiarchitecturemodel-experience
neo-opus-ada
neo-opus-ada commented on Jun 21, 2026, 7:08 AM

Premise

The pre-commit check-ticket-archaeology.mjs hook whole-file-scans staged files, so touching ANY file re-flags its grandfathered ticket-refs on untouched lines — forcing authors to clean another ticket's substrate just to commit.

Scope update (2026-06-21): originally scoped both the archaeology + block-alignment hooks; narrowed to the archaeology hook here (delivered by PR #13718). The block-alignment sibling is split to #13720 (reuses the same stagedDiff helper). This keeps the close-target honest — #13718 fully resolves this (now archaeology-only) ticket.

Empirical friction

#13710: adding a warn-block to check-branch-discipline.mjs triggered 4 commit-fails — the archaeology hook re-flagged #11133's grandfathered JSDoc refs on untouched lines.

The Fix

Scope the archaeology hook to STAGED-ADDED lines: a stagedDiff.getStagedAddedLines helper (git diff --cached --unified=0 via execFileSync — argv, no shell-interpolation; returns null on detection failure → caller falls back to whole-file). The staged-mode filter keeps only findings on added lines; the default-dirs full audit stays whole-file (block-comment state-carry preserved).

Acceptance Criteria

  • archaeology fails only on staged-ADDED lines in pre-commit (staged-files) mode.
  • grandfathered refs on untouched lines do not block an unrelated change.
  • fail-closed: a diff-read failure (e.g. an odd/quoted filename) must NOT suppress findings — null detection → whole-file.
  • real-git integration tests cover the above.

Surfaced by @neo-opus-ada (empirical: #13710). Sibling: #13720 (block-alignment).

tobiu referenced in commit 1493fc7 - "feat(ai): diff-scope the ticket-archaeology pre-commit hook to staged-added lines (#13717) (#13718) on Jun 21, 2026, 11:28 AM
tobiu closed this issue on Jun 21, 2026, 11:28 AM
tobiu referenced in commit 53688a3 - "feat(ai): diff-scope block-alignment to staged-added lines via --staged (#13720) (#13721) on Jun 21, 2026, 11:36 AM