LearnNewsExamplesServices
Frontmatter
id15276
titleParser-grade shared codeMask for the AiConfig lint family
stateOpen
labels
enhancementaitesting
assigneesneo-opus-vega
createdAtJul 16, 2026, 5:51 PM
updatedAt3:10 AM
githubUrlhttps://github.com/neomjs/neo/issues/15276
authorneo-opus-grace
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]

Parser-grade shared codeMask for the AiConfig lint family

Open Backlog/active-chunk-6 enhancementaitesting
neo-opus-grace
neo-opus-grace commented on Jul 16, 2026, 5:51 PM

Context

The ADR-0019 lint family shares one per-character code mask (codeMask in buildScripts/util/check-aiconfig-test-mutation.mjs) consumed by four rules: B4 (DB-path mutation, safety-critical), B3, A5, and A1. The predecessor PR's six-cycle review arc (closed Drop+Supersede at the terminal circuit-breaker, cycle 6) proved a structural fact: heuristic completeness against JavaScript slash/continuation grammar is a parser problem, not a lookup-table problem. Each repaired class exposed the next. The terminal verdict's decomposition: A1 salvage landed separately (PR #15275, on the dev mask); THIS ticket owns the mask upgrade as a deliberate design decision instead of a cycle-7.

The Problem

The dev mask classifies strings and comments only. The review arc's verified falsifier corpus — the strongest lexer test material this repo has — spans eight classes of valid JavaScript where the mask misclassifies executable code, producing false negatives across all four rules (the dangerous direction for an enforcement mask):

  1. Comment text inside template interpolations (false-positive direction).
  2. Nested executable interpolations (false-negative).
  3. } inside comment/regex text closing the interpolation span early.
  4. Line-continuation semantics (a line-final backslash escapes the terminator, not the next line's first char).
  5. Slash after a control-header ) (if (ok) /re/.test(s) — regex, not division).
  6. Slash after an expression-ending literal ("x" / 2 — division, not a fake regex swallowing the suffix).
  7. throw / for await regex-preceding contexts.
  8. Object-literal division and postfix-increment division (the terminal cycle's finds — still open even after 5+6+7 were repaired).

The closed predecessor branch (grace/15213-a1-env-rederivation-rule, final head 20950c614e) holds a working stacked-frame lexer covering classes 1–7 plus the transition-pair spec matrix — reference material, not a merge candidate.

The Architectural Reality

  • buildScripts/util/check-aiconfig-test-mutation.mjscodeMask(line, state) per-line contract with carried cross-line state; owner of the shared seam; B4's own suite + 810-file live scan are the sibling-safety oracle.
  • buildScripts/util/check-aiconfig-antipatterns.mjs — B3/A5/A1 consumer; A1 additionally consumes a code-only PROJECTION of the mask.
  • CI: dependency-free standalone workflows (aiconfig-antipattern-lint.yml pattern) — a tokenizer dependency has CI-installation implications.
  • PR #15275 pins the A1 interpolation boundary as a documented negative spec — the flip-target proving this ticket's delivery.

Resolved Shape — graduated from D#15268

✅ RESOLVED / GRADUATED: Discussion #15268 converged on Acorn as an ordinary devDependency and graduated this one standalone ticket. The author fold is terminal as of 2026-07-17T00:59Z; implementation is PR #15329.

The ticket's original Option A ("real tokenizer") and the Discussion's Option B ("lexer adoption") name the same selected mechanism. The difference is vocabulary, not architecture. The binding shape is:

  • tokenize each whole file once with the existing direct acorn devDependency;
  • memoize whole-file non-code spans on the existing mask state and return per-line slices through an explicit lineIndex, preserving the consumers' line-oriented contract without line-local parse state;
  • blank comments, string/regex literals, and template quasi text while leaving executable template interpolations code-visible;
  • on tokenizer failure, bias toward visible false positives rather than safety-critical false negatives;
  • install dependencies in both standalone AiConfig lint workflows with npm ci --ignore-scripts; this is already an established merge-gate primitive and remains off the unit-leg critical path;
  • keep the authority scoped to B4/B3/A5/A1. extractComment() and the block-alignment classifier have different contracts and no reproduced defect, so they do not migrate here;
  • treat the A1 salvage as already delivered by #15213/#15275.

Decision Record: NOT_NEEDED. ADR-0019 remains the enforcement authority; D#15268 is the option-decision SSOT; this ticket and PR #15329 are implementation artifacts.

Acceptance Criteria

  • The shared mask tokenizes each whole file once with Acorn and preserves the existing per-line consumer contract through explicit line slices; an escape-marker early return cannot desynchronize later lines.
  • Comments, strings, regex literals, and template quasi text are non-code, while executable template interpolations remain code-visible.
  • The full classes 1–8 corpus passes, including object-literal/postfix division, control-header regex, line continuations, nested interpolations, and the A1 interpolation positive; matching string/comment/quasi-text negative controls remain inert.
  • A deliberately invalid token reaches the tokenizer-failure branch and proves conservative code visibility; an invalid-grammar specimen that Acorn can still tokenize is not accepted as a red control.
  • Both consumers move together: B4 remains safety-critical and B3/A5/A1 consume the same shared mask/projection.
  • Both standalone AiConfig lint workflows install with npm ci --ignore-scripts; their scan sets and generated-config boundary remain explicit.
  • Focused buildScripts coverage passes and both live checkers report zero violations across the tracked test/ and ai/ corpora; the zero-delta comparison carries a positive discriminator proving the instrument can report disagreement.
  • Comments this change itself falsifies are corrected in the touched AiConfig checkers; repo-wide cleanup of the stale "dependency-free lint workflows" belief remains outside this lane.
  • The PR body maps D#15268's OQ dispositions, Step-Back, [GRADUATED_TO_TICKET: #15276], and Decision Record: NOT_NEEDED.

Out of Scope

  • A1 rule semantics (landed via PR #15275; #15213 owns them).
  • Any new lint rules — this is mask fidelity only.
  • Migrating extractComment(), the block-alignment classifier, or other semantically different scanners without a reproduced defect.
  • Repo-wide cleanup of stale dependency-free-workflow comments outside the two touched AiConfig checkers.

Related

  • D#15268 (graduated option-decision SSOT), PR #15329 (implementation), #15213 / PR #15275 (A1 salvage), #14500 / PR #15211 (B3/A5), #13227 (B4 origin), D#15256 (review-economics origin)

Decision Record impact: aligned-with ADR 0019. NOT_NEEDED — the selected Acorn implementation strengthens the existing enforcement backstop without changing the ADR.

Origin Session ID: 75ed6708-c66b-4989-862d-2286e87abbf1 Retrieval Hint: "shared codeMask lexer falsifier corpus slash grammar continuation parser-grade terminal drop supersede" Live latest-open sweep: latest 20 open checked 2026-07-16 ~15:50Z — no equivalent. A2A claim window scanned same cycle — no competing claim. Unassigned by design: the shape decision (A/B/C) deserves fresh eyes; the falsifier corpus authors (Emmy, Euclid) are the natural reviewers.