LearnNewsExamplesServices
Frontmatter
id18794
titlecheck-ticket-archaeology detects ADR refs and offers an escape that cannot match one
stateClosed
labels
bugaibuild
assigneesneo-opus-ada
createdAtSep 16, 2026, 2:48 PM
updatedAtSep 18, 2026, 5:39 PM
githubUrlhttps://github.com/neomjs/neo/issues/18794
authorneo-opus-vega
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 18, 2026, 5:39 PM

check-ticket-archaeology detects ADR refs and offers an escape that cannot match one

neo-opus-vega
neo-opus-vega commented on Sep 16, 2026, 2:48 PM

Context

check-ticket-archaeology's failure message prescribes one remedy for a deliberate reference:

put a typed marker directly after the ref: "#1234 [not-ticket-ref: <reason>]"

It works for exactly one shape. Measured against findArchaeology() at neo-agent-skills@dev 3503c35, four comments each carrying the same valid marker:

comment escape honoured? kinds reported
#1234 [not-ticket-ref: deliberate, the contract] ✅ yes — no finding
Epic #1234 [not-ticket-ref: deliberate, the contract] ❌ no tracking-reference
Discussion #1234 [not-ticket-ref: deliberate, the contract] ❌ no tracking-reference
ADR 0004 [not-ticket-ref: deliberate, the contract] ❌ no tracking-reference, invalid-escape

So the escape excuses a bare #N and is powerless against all eight named forms the same message enumerates — issue, ticket, bug, PR, pull request, Epic, Discussion, ADR. Naming the reference you cite removes your only way to declare it deliberate, and on an ADR the marker is counted as a defect: invalid-escape fires on markers.length !== escaped.size + refs.size, so following the instruction produces two findings where there was one.

The Problem

Two mechanisms built on different models.

The escapes are offset-based: escapedRefOffsets() collects the index of each #N token carrying a marker, and the bare-numeric loop at the end of findArchaeology() skips those offsets. That loop is the only consumer.

NAMED_TRACKING_PATTERNS.some(pattern => pattern.test(comment)) is a whole-comment boolean evaluated before it. A boolean carries no token position, so there is nothing an offset can excuse — the named branch cannot honour an escape even in principle.

Widening REF_ESCAPE_RE to accept an ADR NNNN token therefore fixes the ADR row and leaves Epic #1234 exactly as inescapable. The named branch has to become token-scoped, matching per match with an index and subtracting the escaped offsets the way the numeric loop already does.

Two measured divergences between the engine copy and the published guard

The engine keeps a mirrored copy at buildScripts/util/check-ticket-archaeology.mjs, whose comment states the reason: "Both patterns mirror the published guard rather than paraphrasing it, because the ONLY thing this change buys is the two agreeing." CI here runs the published binary, so the hook is the permissive side of both gaps:

  1. The prose form. The published copy reads pull request 11982 as a tracking ref; the local copy does not. Same guard name, same files, opposite verdicts (PR #18793: hook green, CI red).
  2. Review archaeology is absent locally. The published guard carries six REVIEW_ARCHAEOLOGY_PATTERNS; the engine copy carries none. So RA-3, "round 2 review", "previous review cycle" and the rest pass every hook here and red CI (PR #18808).

Mirror existence is what check-guard-ci-parity checks. Mirror agreement is what nothing checks.

Current population

Zero findings in neomjs/neo's comments carry a named form with an attempted escape. The cost is paid by authors at the keyboard rather than by the corpus: the guard refuses the ref, the author follows the instruction, and it refuses again. Both engine authors who hit it (PRs #18793 and #18806) rephrased rather than escaped, which is why the corpus stays clean and the defect stays invisible.

Status

The root fix is open at neo-agent-skills#84 (ticket neo-agent-skills#83), v0.1.9: named patterns are matched per token, the escape pattern accepts a named token, and invalid-escape counts a marker bound to one as valid. Six contract arms, red-first against the reverted guard.

The published copy is where it has to start. Widening the engine mirror first would make the hook accept an escape CI still rejects — hook green, build red, the worse direction of the divergence above.

Acceptance Criteria

  • AC-1: each of Epic #N, Discussion #N, issue #N, PR #N and ADR NNNN carrying a valid typed marker produces no finding. (delivered by neo-agent-skills#84)
  • AC-2: red control — each of those without a marker still produces tracking-reference. (delivered by neo-agent-skills#84)
  • AC-3: a marker with a blank or missing reason still produces invalid-escape, named and bare alike. (delivered by neo-agent-skills#84)
  • AC-4: the engine mirror is updated after 0.1.9 publishes and the dependency bumps, so the two agree line for line — including the six review-archaeology patterns the engine copy is missing.
  • AC-5: a spec pins verdict agreement over a corpus, not only that the two pattern lists are byte-identical. Identical escapes do not imply identical detection, and detection is where both divergences live.

Out of Scope

  • Whether ADR or Epic refs should be detected at all — they rot like any other ref, and that is settled.
  • The CSS-colour escape and its context rule.

Avoided Traps

  • ⛔ Do not widen REF_ESCAPE_RE alone. It is the obvious one-line change and fixes only the ADR row.
  • ⛔ Do not make the escape line-scoped. The design binds a marker to its token deliberately: a line may carry an annotated ref and a genuine one, and only the first is excused.
  • ⛔ Do not fix the engine copy first. CI here runs the published binary.
  • ⛔ Do not read "zero corpus findings" as low value. The remedy being unfollowable produces silence, not evidence.

Related

neo-agent-skills#83 / neo-agent-skills#84 (root fix) · #18793 · #18806 · #18808 (the three PRs these gaps blocked)

Origin Session ID: 5bf0b816-b919-40fc-9c18-fee751fd1635

Retrieval Hint: "ticket archaeology named tracking pattern whole-comment test ignores typed escape offsets Epic Discussion ADR inescapable engine mirror divergence"