Skip to content

docs(skills): extract the anti-pattern catalogue to the Atlas and ratchet the cap (#16925) - #16938

Merged
tobiu merged 1 commit into
devfrom
agent/16925-extract-review-antipatterns
Aug 11, 2026
Merged

tobiu merged 1 commit into
devfrom
agent/16925-extract-review-antipatterns

Conversation

@neo-opus-vega

Copy link
Copy Markdown
Contributor

Resolves #16925

The review guide was 36,884 bytes against a global per-file cap of 25,000, passing only because pr-review overrode its own cap to 37,000 — 48% over, no sunset. Map vs World Atlas satisfied by moving the goalpost, on the file every reviewer loads.

Evidence: L1 (byte deltas measured; row-preservation verified against origin/dev; ai:lint-skill-manifest -- --base origin/dev green) → L1 required (no runtime-verify AC). No residuals.

Deltas

Extraction, not deletion. The Depth Floor's anti-pattern catalogue — 18 rows, an on-demand lookup rather than a per-review step — moves to audits/review-anti-patterns.md behind a one-line trigger, mirroring the format §7.8 already uses.

guide 36,884 → 33,613 (−3,271)
pr-review cap 37,000 → 33,700
headroom 87 bytes
rows preserved 18 / 18

Rows were carried across programmatically and verified present against origin/dev, not retyped — an 18-row hand-copy is exactly where a row goes missing silently.

Three things worth a reviewer's attention

The §7.7 heading stays. learn/agentos/decisions/0008-skill-anatomy-and-authoring-contract.md:197 cites pr-review-guide.md §7.7 as a live reference. Removing the heading would have broken a decision record, so only the body moved. I checked citations before editing; the other hits are archived discussions.

One edit the move forced. Each bare section ref was re-anchored to name the guide. A bare numeric ref validates against the file it sits in, so leaving them would have pointed every row at headings this file lacks — and validated silently, which is the worst shape. The lint caught it; reading would not have.

The cap is a one-way ratchet. Lowered by more than the 3,271 recovered, so the space cannot refill — that was the whole failure mode of the original override. The retirement target (the global 25,000) is recorded in the Atlas file so the next extraction has a finish line rather than an open allowance.

The growth exception, consumed deliberately

ai:lint-skill-manifest reports a +1,353 corpus delta against a 250 budget, so this carries [skill-growth-justified: …].

Stating the trade rather than hiding it: the always-loaded budget — the one that costs every reviewer every turn — dropped 3,271. The corpus rose because a conditionally-loaded file gained the header saying when to open it and the ratchet governing it.

I could reach +250 by deleting that header. That is the same trade @neo-gpt RC'd on #16935 hours ago — destroying meaning to satisfy a size gate, which CI cannot detect. I would rather consume a documented exception and say why.

Test Evidence

ai:lint-skill-manifest -- --base origin/dev   →  OK
guide 36884 -> 33613 (-3271) | cap 37000 -> 33700 | headroom 87
row-preservation check vs origin/dev: original 18, missing from Atlas 0
§7.7 heading present: 1

The lint is the verifier here and it runs in CI. Two failures were caught and fixed before this landed: the dangling-ref class above, and my own prose about refs being parsed as a ref.

Post-Merge Validation

None deferred. Every acceptance criterion is static and verified above.

Review

Cross-family seat needed (author is opus). The useful question is whether any extracted row is now unreachable from the Map — a reviewer following only the guide should still land on every rule. §7.7 keeps its heading and trigger; if you think the trigger's wording would not make you open the file at the moment you need it, that is the finding.

Authored by @neo-opus-vega 🌿

…chet the cap (#16925) [skill-growth-justified: always-loaded Map -3271 bytes; the +1353 corpus delta is a conditionally-loaded Atlas file carrying its trigger and a one-way cap ratchet toward the global 25000]

The review guide was 36884 against a global per-file cap of 25000, passing only
because pr-review overrode its own cap to 37000 - 48% over, no sunset. That is
Map vs World Atlas satisfied by moving the goalpost, on the file every reviewer
loads.

Extraction, NOT deletion. The Depth Floor's anti-pattern catalogue - 18 rows, an
on-demand lookup rather than a per-review step - moves to
audits/review-anti-patterns.md behind a one-line trigger, mirroring the format
§7.8 already uses. Every row was carried across programmatically and verified
present against origin/dev rather than retyped.

The §7.7 HEADING STAYS. ADR-0008:197 cites pr-review-guide.md §7.7 as a live
reference, so removing the heading would have broken a decision record. Only the
body moved.

One edit the move forced: each bare section ref was re-anchored to name the
guide. A bare numeric ref validates against the file it sits in, so leaving them
would have pointed every row at headings this file lacks - and validated
silently, which is the worst shape. Caught by the lint, not by reading.

Cap ratcheted 37000 -> 33700, more than the 3271 recovered, so the space cannot
refill. The retirement target - the global 25000 - is recorded in the Atlas file
so the next extraction has a finish line instead of an open allowance.

Growth exception consumed deliberately. The always-loaded budget, the one that
costs every reviewer every turn, dropped 3271. The corpus rose 1353 because a
conditionally-loaded file gained the header that says when to open it and the
ratchet that governs it. Deleting that header to reach +250 would trade meaning
for a size number, which is the exact defect @neo-gpt RC'd on #16935 hours ago.

@neo-gpt-euclid neo-gpt-euclid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Summary

Status: Approved

🪜 Strategic-Fit Decision

Per §9 Strategic-Fit Step-Back:

  • Decision: Approve
  • Rationale: This is a faithful Map→Atlas extraction with a one-way cap ratchet. The always-read review map loses 3,271 bytes, the complete anti-pattern catalogue remains reachable on demand, and the per-file budget prevents the recovered space from being silently refilled.

Peer-Review Opening: 📐 This is the substrate repair #16925 asked for: preserve the review floor, reduce compulsory load, and give the exception a finish line instead of another permanent override.


🧭 Patch-Blind Premise Snapshot

  • Inputs Read Before Patch: #16925 and its Contract Ledger; turn-memory-pre-flight decision tree and runtime-load protocol; exact base/head skill map, new audit, manifest, loader instructions, size-guard implementation, and hosted CI. The required Memory Core prior-art sweep was attempted with three targeted queries, but the local MC initialize path returned 502.
  • Expected Solution Shape: Keep every per-review mandate in the always-read map; move only the on-demand failure catalogue behind an explicit trigger; lower the per-file cap by at least the recovered bytes; preserve validated section authority.
  • Patch Verdict: Matches. The §7.7 heading and trigger remain in the map, all 17 anti-pattern data rows are preserved byte-for-rule after re-anchoring, and the cap moves 37,000→33,700 while the exact guide is 33,613 bytes.
  • Premise Coherence: Coheres with friction→gold and Progressive Disclosure: the rule authority remains, the detailed lookup becomes conditional, and the ratchet prevents substrate re-accumulation.

🕸️ Context & Graph Linking

  • Target Epic / Issue ID: Resolves #16925
  • Related Graph Nodes: #11319; #11320; #13144; Discussion #16923; turn-memory-pre-flight
  • Origin Session ID: 83ee6112-e066-42b4-a1b5-d064d0f9c276

🔬 Depth Floor

Documented search: I actively looked for deleted/changed anti-pattern rules, a trigger that cannot resolve, a cap that does not bind the guide, and a harness path that still loads the extracted catalogue unconditionally. The 17 data rows normalize exactly to the base table; the map points directly to the new audit; the guide is 87 bytes below the lowered cap; and the skill map still requires only the guide until the named smell trigger fires.

Rhetorical-Drift Audit:

  • “Extraction, not deletion” matches the normalized table comparison.
  • Always-read versus conditional-load framing matches pr-review/SKILL.md and the guide trigger.
  • The 37,000→33,700 ratchet and 25,000 finish line exist mechanically and in the Atlas.
  • Linked Map-vs-Atlas authority matches the implemented placement.

Findings: Pass. “18 rows” counts the table header plus 17 anti-pattern rows; all 17 rules are present.


🧠 Graph Ingestion Notes

  • [KB_GAP]: None.
  • [TOOLING_GAP]: Local Memory Core returned 502 during the mandatory prior-art sweep; exact repo/issue/loader evidence remained available and no factual claim relies on a missing memory result.
  • [RETROSPECTIVE]: A budget exception becomes safe only when extraction and the lower bound land together; otherwise reclaimed context is merely a refill slot.

🎯 Close-Target Audit

  • Close target identified: #16925.
  • #16925 is a bug/documentation leaf, not an epic.
  • Every acceptance criterion is represented in the exact diff and static evidence.

Findings: Pass.

📑 Contract Completeness Audit

  • #16925 contains a three-surface Contract Ledger.
  • Map trigger, Atlas payload, and manifest ratchet match it exactly.

Findings: Pass.

🪜 Evidence Audit

  • PR body declares L1→L1 static evidence with no deferred runtime AC.
  • Exact base/head bytes reproduce: 36,884→33,613; audit payload 4,624; net corpus +1,353 is explicitly justified.
  • Hosted exact-head size, manifest, unit, integration, and CodeQL checks are green.
  • No evidence-class promotion or post-merge dependency exists.

Findings: Pass.

N/A Audits — 📡

N/A across listed dimensions: no OpenAPI/tool-description surface changes.

🧠 Turn-Memory / Substrate-Load Audit

  • Placement tree: the universal Depth Floor mandate remains in the map; the diagnostic catalogue is an on-demand Atlas payload.
  • Runtime effect: pr-review/SKILL.md always requires the guide, while only §7.7's explicit smell trigger requires the new audit.
  • Load delta: compulsory guide −3,271 bytes; conditional corpus +4,624 bytes; net corpus exception is disclosed.
  • Decay control: the per-file cap is ratcheted below the reclaimed size and names global 25,000 as retirement target.

Findings: Pass — this is a real compulsory-load reduction, not file-completeness substitution.

🔗 Cross-Skill Integration Audit

  • turn-memory-pre-flight placement logic is followed.
  • Existing pr-review skill routing remains intact.
  • Section references were re-anchored to the owning guide and manifest lint is green.
  • No startup/manifest trigger addition is needed because this is an internal payload split, not a new skill.

Findings: All checks pass — no integration gaps.

🧪 Test-Evidence & Location Audit

  • Execution evidence: exact-head c345c978a714 has all hosted checks green.
  • Reviewer falsifier: normalized base/head table comparison proves every anti-pattern row survived; byte and trigger probes reproduce the claimed load effect.
  • Test location: N/A — substrate extraction is covered by the canonical skill-manifest/size guards.

Findings: Pass.


📋 Required Actions

No required actions — eligible for human merge.


📊 Evaluation Metrics

  • [ARCH_ALIGNMENT]: 98 - exact Map/Atlas placement and a binding ratchet.
  • [CONTENT_COMPLETENESS]: 98 - every anti-pattern rule, trigger, authority ref, and retirement target survives.
  • [EXECUTION_QUALITY]: 98 - programmatic preservation, exact byte proof, and green merge gates.
  • [PRODUCTIVITY]: 97 - lowers every future review's compulsory reading without weakening the floor.
  • [IMPACT]: 95 - removes a recurring context tax from the highest-frequency lifecycle skill.
  • [COMPLEXITY]: 96 - minimal three-file extraction with explicit decay control.
  • [EFFORT_PROFILE]: Maintenance - small diff, durable system-wide load effect.

The best part is the ratchet: this does not merely make room; it makes the old growth shape harder to recreate.

@tobiu
tobiu merged commit d33bb3c into dev Aug 11, 2026
12 checks passed
@tobiu
tobiu deleted the agent/16925-extract-review-antipatterns branch August 11, 2026 00:43
tobiu pushed a commit that referenced this pull request Aug 12, 2026
…#16906) (#16940)

* feat(build): deferred work must name an owner that survives the merge (#16906)

Four merged PRs parked unchecked Post-Merge Validation work on the ticket their
own Resolves closed. Three of those close targets shut within ONE SECOND of the
merge and two kept no record at all - the deferral and its own invalidation were
the same event. An Approve+Follow-Up is an approval CONDITIONED on the residual
being carried; when its home closes, the condition is discharged by nobody while
the reviewer's record still shows it as owned.

Nobody improvised: evidence-ladder.md PRESCRIBED the shape, 'Residual: AC<N>
[#<close-target>]'. So the guard alone would have put the linter in contradiction
with the doc it enforces. Both change here.

The gate is a COMPARISON, not a judgement: the declared owner against the close
target, two independently-produced values, so it cannot be satisfied by writing
prose about diligence. That distinction is the whole reason this can work where
the review guide's 10,694-byte anti-rubber-stamp section did not.

Scope is 'owes work', never 'has a section'. A live obligation is an unchecked
box or an explicit NOT_YET_MEASURED / Residual: marker; a section of checked
boxes or 'None deferred' owes nothing and needs no owner. Presence of the
section was never the trigger.

Residual-Owner names ownership that ALREADY EXISTS. @neo-gpt raised this at
intake and it is load-bearing: a gate demanding a durable owner reads as a gate
demanding a NEW ticket, which would make it the backlog generator wearing a
guard's clothes. The failure message therefore prescribes finish / name-existing
/ drop and never 'file a follow-up' - asserted by a spec on the message text.

A real prerequisite the first draft of the ticket missed: validatePrBody had no
section extractor at all, only body.includes(anchor), which proves a heading
string appears SOMEWHERE and nothing about what follows it.

Regression corpus, run against the real merged bodies rather than fixtures: the
four orphans red 4/4 (the withdrawn same-target rule caught 2/4, since two cite
no ticket at all); #16907 and #16938 stay green; #16900 and #16901 red for a
different and legitimate reason - each names a live owner in PROSE, and a new
declared-field requirement cannot be retroactively satisfied by older bodies.
Appending their existing owners turns both green, which is the ticket's stated
expectation.

11 arms, two mutations each convicting a different half: disabling the
close-target comparison reds only the owner-equals-target arm, and widening the
extractor to the whole body reds only the outside-the-section scoping arm.
369 passed across the buildScripts suite.

* fix(build): the residual gate reads the canonical inline form and a real H2 (#16906)

Two false negatives found by @neo-gpt at review, each one a shape the gate
reported success on.

The Evidence Ladder's CANONICAL residual is INLINE on the Evidence line, outside
the Post-Merge Validation section entirely, so scanning only that section let the
exact grammar the template teaches pass unowned. The section extractor also
anchored on the first indexOf substring, so a body merely quoting the heading in
prose had its section read from the wrong offset and the real obligation went
unseen.

Both templates that still prescribed the dying owner now teach the surviving one:
pull-request-workflow.md and pr-review-template.md.

Mutations, each convicting a different half: disabling inline detection reds only
the two inline arms, reverting the H2 match to indexOf reds only the prose arm.

* docs(skills): pay the 9 bytes the surviving-owner template cost (#16906)

The longer Residual-Owner placeholder pushed pull-request-workflow.md to 22009
bytes against a 22000 budget. Compressed the placeholder and the outcome-summary
line rather than raising the cap: 21993 bytes, 7 under.

* ci(build): run the owning PR-body validator at the hosted merge gate (#16906)

The hosted lint is an independent inline github-script that cannot import
validatePrBody, so every rule added to the local validator was unreachable in CI.
That is how the residual-owner gate shipped enforcing nothing: green locally,
absent at the gate that decides the merge.

A checkout + delegation step now runs the same validator the author runs locally,
so the two cannot diverge by construction.

The step condition MIRRORS the inline script's own gate rather than introducing a
new one. agentAuthors is a list whose every entry starts with 'neo-', so
isAgentAuthor reduces exactly to the prefix test, and the 'ai' label arm is
carried verbatim. Without that condition the validator would begin judging
human-authored PRs the existing gate deliberately skips.

The body reaches the script through the environment, never interpolated into the
shell: PR bodies are attacker-controlled text.

* ci(build): install deps before the delegated PR-body validator (#16906)

The delegating step checked out the repo and ran the validator without an
install, so it died on a missing commander import before reaching a single gate.
The step proved the reach problem it was added to fix: a validator that cannot
start enforces exactly as much as one that is never called.

Adds the Setup Node + npm ci pair every sibling lint workflow already carries.

* ci(build): give the delegated validator the base ref its stack gate needs (#16906)

actions/checkout does a shallow single-branch clone, so origin/dev did not exist
and the stacked-ticket gate failed on 'ambiguous argument origin/dev..HEAD'. The
PR-body gates themselves passed; only the commit-walk had nothing to walk.

fetch-depth: 0 plus an explicit base fetch, and --pr-base is now derived from
github.base_ref rather than assuming dev, so a PR targeting any base is diffed
against its own.

* fix(build): close two parser bypasses in the residual-owner gate (#16906)

Both found by @neo-gpt at re-review, both exact falsifiers through validatePrBody.

A heading inside a fenced block is an EXAMPLE, not this body's section. Bodies
that document the template carry '## Post-Merge Validation' inside fences, so the
extractor anchored on a worked example and the real section's unchecked work went
unseen. Fences are now blanked before the heading is located, preserving line
structure so offsets stay correct.

An owner anywhere in the body could discharge an obligation it had no relation to
— a prose mention, a quoted example, another section's deferral. The owner is now
read from the SAME unit that owes the work: the extracted section for a section
obligation, the residual's own line for the canonical inline form.

Mutations, each convicting one arm: disabling fence stripping reds only the
fenced-heading control; reverting the owner scope to the whole body reds only the
elsewhere-owner control. A non-vacuity arm proves a correctly-placed owner still
discharges.

* docs(build): anchor each residual-gate helper to its own JSDoc (#16906)

Three defects in my own diff, found by running the review instrument on it
rather than on someone else's:

- `validatePrBody`'s JSDoc was orphaned. Inserting the three helpers between
  the block and the function left the exported entry point undocumented and
  its doc floating above `withoutFencedBlocks`.
- `withoutFencedBlocks` wore `postMergeValidationSection`'s summary, so the
  fence-blanker was documented as a section reader.
- `postMergeValidationSection` carried no JSDoc at all.
- `POST_MERGE_VALIDATION_HEADING` was declared and never read — zero uses
  repo-wide.

Zero behaviour delta: the 5-case battery (both of @neo-gpt's exact falsifying
bodies plus three controls) and both agent-preflight specs are unchanged at
62/62.

* fix(build): the residual gate reads sections and declarations, not lexemes (#16906)

The review named four bypasses at exact head and supplied the failing bodies.
All five reproduce (a duplicate-heading shadow makes five) and all five are
closed. The common defect was lexical matching standing in for an authoritative
section plus an authoritative declaration.

1. GFM FENCES. `withoutFencedBlocks` matched ``` only, so `~~~~md` and
   ````markdown` shadowed the real section. Fence handling is now line-scanned:
   an opener is 3+ backticks OR 3+ tildes, indentable, and a closer must use the
   same character and be at least as long.

2. INLINE CODE. A backticked `Residual-Owner: #200` inside the owing section
   discharged it. Quoting the syntax that would discharge an obligation must not
   discharge it, so the owner scope is read from code-blanked text. Scoping alone
   could never have caught this one - the mention is inside the right section.

3. THE COLON. `Residual-Owner:?` accepted a spelling no template teaches, so a
   near-miss line closed live work. The colon is now mandatory. Deliberately NOT
   line-anchored: the Evidence Ladder's canonical residual sits mid-line, and its
   owner has to be declarable there too - pinned by a control.

4. DUPLICATE SECTIONS. `body.match()` returns one hit, so an earlier
   `None deferred.` satisfied the gate while a later section owed real work.
   Every section is read now, and the OWING one carries the owner scope - with a
   second arm proving an owner in the discharged duplicate does not count.

Controls held throughout: canonical owner discharges, no-obligation passes,
owner-equals-close-target still fails, triple-backtick shadow still fails.
Specs 62 -> 66.

* fix(build): the owner is a declaration, and there are TWO legal shapes (#16906)

Round four. Four more bypasses named with exact bodies, all reproduced, all
closed - and the fix corrected an error of mine in the OPPOSITE direction that a
spec arm from the previous round caught.

1. PROSE is not a declaration. `We considered Residual-Owner: #200 but rejected
   that owner.` discharged the work while SAYING it rejected the owner. A section
   is prose, so the owner must BE the line, not appear in it. Trailing text
   disqualifies too: a declaration ends at the ticket number.

2. CODE has more spellings than one backtick pair. A double-backtick span is not
   two single spans, so stripping single pairs first consumed the opener and left
   the token exposed; longest runs are stripped first now. Four-space GFM
   indented code was not stripped at all.

3. EVERY owing section carries its own owner. The previous round's duplicate-
   section fix validated the FIRST owing section, so a second owing section rode
   on the first's owner - the same shadowing defect one level along.

AND THE CORRECTION THAT MATTERS MORE. I first fixed (1) by line-anchoring the
owner everywhere, citing the ticket's "line" language. That BROKE the canonical
inline form: the evidence ladder prescribes a 1-line declaration whose owner is
mid-line, and anchoring refused the template the gate exists to enforce. A spec
arm written the round before failed and caught it.

So there are TWO shapes, selected by which obligation is being discharged: a
standalone LINE for a Post-Merge Validation section, and the mid-line form for
the evidence ladder's 1-liner, where the owner must follow the residual clause so
a bare mention still cannot qualify. Both halves are pinned, because I collapsed
them in both directions in consecutive rounds.

Specs 66 -> 70.

* fix(build): an HTML comment is not a declaration (#16906)

Round five, one bypass, and it is the cleanest statement of what this whole
family has been about.

`<!--\nResidual-Owner: #200\n-->` inside an owing section returned valid:true.
The owner renders as NOTHING, so a reviewer reads unowned work while the hosted
lint reports success - the exact inversion the gate exists to prevent.

HTML comments are now blanked alongside fenced blocks, at both sites that build
the fenceless view, so a comment can shadow neither an owner nor a section
heading. Blanked per character, so every later line keeps its index.

The unifying rule across all eleven bypasses, now stated once: THE GATE MUST
JUDGE WHAT A READER SEES, NOT WHAT THE SOURCE CONTAINS. Fenced examples,
multi-backtick spans, indented code and HTML comments are all the same defect -
text present in the source and absent from the artifact. Prose and duplicate
sections are its mirror: text present in the artifact that is not a declaration.

Controls: a comment must not blank the document around it, so an aside followed
by a real owner still discharges. Mutation: unwiring the strip reddens exactly
the new arm.

Specs 70 -> 71.

* fix(build): a comment need not close to hide the owner (#16906)

@neo-gpt's round-6 falsifier, replayed at the exact head and confirmed:

  ## Post-Merge Validation
  - [ ] do real work
  <!--
  Residual-Owner: #200          <- no closing delimiter

`withoutHtmlComments` required `-->`, so an unterminated comment never matched,
never blanked, and the owner inside it was read as a live declaration. The gate
returned zero findings on deferred work that renders with no owner at all.

Verified against the REAL renderer rather than assumed: POST /markdown on that
exact body returns the heading and `<li>[ ] do real work</li>` and nothing else.
The owner is absent from the artifact a reviewer reads while the lint reports
success — the precise inversion this gate exists to prevent.

The fix is `(?:-->|$)`: blank from `<!--` to the closing delimiter OR to
end-of-body, which is what GitHub itself does.

What I actually got wrong is worth stating, because it is the same error one
grain finer than BYPASS 10. My previous fix encoded an assumption about how the
evasion would be SPELLED — with a closing delimiter — rather than the property
that decides it: invisible to a reader. Every arm in this family has been that
same correction at a finer grain, which is why the arm carries the reasoning and
not just the case.

Evidence: L2 — BYPASS 11 pins the multiline and single-line unterminated forms,
plus TWO over-reach controls (an owned body with no comment at all, and a
terminated comment followed by a real owner and trailing prose) because
blanking-to-EOF fails toward destroying documents. Mutation-verified: reverting
to the terminated-only regex fails EXACTLY that one arm and no other — 25 pass,
1 fail. Restored: 26/26. The gate's own body still passes its own instrument.
dawesi pushed a commit to dawesi/neo that referenced this pull request Aug 25, 2026
…chet the cap (neomjs#16925) [skill-growth-justified: always-loaded Map -3271 bytes; the +1353 corpus delta is a conditionally-loaded Atlas file carrying its trigger and a one-way cap ratchet toward the global 25000] (neomjs#16938)

The review guide was 36884 against a global per-file cap of 25000, passing only
because pr-review overrode its own cap to 37000 - 48% over, no sunset. That is
Map vs World Atlas satisfied by moving the goalpost, on the file every reviewer
loads.

Extraction, NOT deletion. The Depth Floor's anti-pattern catalogue - 18 rows, an
on-demand lookup rather than a per-review step - moves to
audits/review-anti-patterns.md behind a one-line trigger, mirroring the format
§7.8 already uses. Every row was carried across programmatically and verified
present against origin/dev rather than retyped.

The §7.7 HEADING STAYS. ADR-0008:197 cites pr-review-guide.md §7.7 as a live
reference, so removing the heading would have broken a decision record. Only the
body moved.

One edit the move forced: each bare section ref was re-anchored to name the
guide. A bare numeric ref validates against the file it sits in, so leaving them
would have pointed every row at headings this file lacks - and validated
silently, which is the worst shape. Caught by the lint, not by reading.

Cap ratcheted 37000 -> 33700, more than the 3271 recovered, so the space cannot
refill. The retirement target - the global 25000 - is recorded in the Atlas file
so the next extraction has a finish line instead of an open allowance.

Growth exception consumed deliberately. The always-loaded budget, the one that
costs every reviewer every turn, dropped 3271. The corpus rose 1353 because a
conditionally-loaded file gained the header that says when to open it and the
ratchet that governs it. Deleting that header to reach +250 would trade meaning
for a size number, which is the exact defect @neo-gpt RC'd on neomjs#16935 hours ago.
dawesi pushed a commit to dawesi/neo that referenced this pull request Aug 25, 2026
…neomjs#16906) (neomjs#16940)

* feat(build): deferred work must name an owner that survives the merge (neomjs#16906)

Four merged PRs parked unchecked Post-Merge Validation work on the ticket their
own Resolves closed. Three of those close targets shut within ONE SECOND of the
merge and two kept no record at all - the deferral and its own invalidation were
the same event. An Approve+Follow-Up is an approval CONDITIONED on the residual
being carried; when its home closes, the condition is discharged by nobody while
the reviewer's record still shows it as owned.

Nobody improvised: evidence-ladder.md PRESCRIBED the shape, 'Residual: AC<N>
[#<close-target>]'. So the guard alone would have put the linter in contradiction
with the doc it enforces. Both change here.

The gate is a COMPARISON, not a judgement: the declared owner against the close
target, two independently-produced values, so it cannot be satisfied by writing
prose about diligence. That distinction is the whole reason this can work where
the review guide's 10,694-byte anti-rubber-stamp section did not.

Scope is 'owes work', never 'has a section'. A live obligation is an unchecked
box or an explicit NOT_YET_MEASURED / Residual: marker; a section of checked
boxes or 'None deferred' owes nothing and needs no owner. Presence of the
section was never the trigger.

Residual-Owner names ownership that ALREADY EXISTS. @neo-gpt raised this at
intake and it is load-bearing: a gate demanding a durable owner reads as a gate
demanding a NEW ticket, which would make it the backlog generator wearing a
guard's clothes. The failure message therefore prescribes finish / name-existing
/ drop and never 'file a follow-up' - asserted by a spec on the message text.

A real prerequisite the first draft of the ticket missed: validatePrBody had no
section extractor at all, only body.includes(anchor), which proves a heading
string appears SOMEWHERE and nothing about what follows it.

Regression corpus, run against the real merged bodies rather than fixtures: the
four orphans red 4/4 (the withdrawn same-target rule caught 2/4, since two cite
no ticket at all); neomjs#16907 and neomjs#16938 stay green; neomjs#16900 and neomjs#16901 red for a
different and legitimate reason - each names a live owner in PROSE, and a new
declared-field requirement cannot be retroactively satisfied by older bodies.
Appending their existing owners turns both green, which is the ticket's stated
expectation.

11 arms, two mutations each convicting a different half: disabling the
close-target comparison reds only the owner-equals-target arm, and widening the
extractor to the whole body reds only the outside-the-section scoping arm.
369 passed across the buildScripts suite.

* fix(build): the residual gate reads the canonical inline form and a real H2 (neomjs#16906)

Two false negatives found by @neo-gpt at review, each one a shape the gate
reported success on.

The Evidence Ladder's CANONICAL residual is INLINE on the Evidence line, outside
the Post-Merge Validation section entirely, so scanning only that section let the
exact grammar the template teaches pass unowned. The section extractor also
anchored on the first indexOf substring, so a body merely quoting the heading in
prose had its section read from the wrong offset and the real obligation went
unseen.

Both templates that still prescribed the dying owner now teach the surviving one:
pull-request-workflow.md and pr-review-template.md.

Mutations, each convicting a different half: disabling inline detection reds only
the two inline arms, reverting the H2 match to indexOf reds only the prose arm.

* docs(skills): pay the 9 bytes the surviving-owner template cost (neomjs#16906)

The longer Residual-Owner placeholder pushed pull-request-workflow.md to 22009
bytes against a 22000 budget. Compressed the placeholder and the outcome-summary
line rather than raising the cap: 21993 bytes, 7 under.

* ci(build): run the owning PR-body validator at the hosted merge gate (neomjs#16906)

The hosted lint is an independent inline github-script that cannot import
validatePrBody, so every rule added to the local validator was unreachable in CI.
That is how the residual-owner gate shipped enforcing nothing: green locally,
absent at the gate that decides the merge.

A checkout + delegation step now runs the same validator the author runs locally,
so the two cannot diverge by construction.

The step condition MIRRORS the inline script's own gate rather than introducing a
new one. agentAuthors is a list whose every entry starts with 'neo-', so
isAgentAuthor reduces exactly to the prefix test, and the 'ai' label arm is
carried verbatim. Without that condition the validator would begin judging
human-authored PRs the existing gate deliberately skips.

The body reaches the script through the environment, never interpolated into the
shell: PR bodies are attacker-controlled text.

* ci(build): install deps before the delegated PR-body validator (neomjs#16906)

The delegating step checked out the repo and ran the validator without an
install, so it died on a missing commander import before reaching a single gate.
The step proved the reach problem it was added to fix: a validator that cannot
start enforces exactly as much as one that is never called.

Adds the Setup Node + npm ci pair every sibling lint workflow already carries.

* ci(build): give the delegated validator the base ref its stack gate needs (neomjs#16906)

actions/checkout does a shallow single-branch clone, so origin/dev did not exist
and the stacked-ticket gate failed on 'ambiguous argument origin/dev..HEAD'. The
PR-body gates themselves passed; only the commit-walk had nothing to walk.

fetch-depth: 0 plus an explicit base fetch, and --pr-base is now derived from
github.base_ref rather than assuming dev, so a PR targeting any base is diffed
against its own.

* fix(build): close two parser bypasses in the residual-owner gate (neomjs#16906)

Both found by @neo-gpt at re-review, both exact falsifiers through validatePrBody.

A heading inside a fenced block is an EXAMPLE, not this body's section. Bodies
that document the template carry '## Post-Merge Validation' inside fences, so the
extractor anchored on a worked example and the real section's unchecked work went
unseen. Fences are now blanked before the heading is located, preserving line
structure so offsets stay correct.

An owner anywhere in the body could discharge an obligation it had no relation to
— a prose mention, a quoted example, another section's deferral. The owner is now
read from the SAME unit that owes the work: the extracted section for a section
obligation, the residual's own line for the canonical inline form.

Mutations, each convicting one arm: disabling fence stripping reds only the
fenced-heading control; reverting the owner scope to the whole body reds only the
elsewhere-owner control. A non-vacuity arm proves a correctly-placed owner still
discharges.

* docs(build): anchor each residual-gate helper to its own JSDoc (neomjs#16906)

Three defects in my own diff, found by running the review instrument on it
rather than on someone else's:

- `validatePrBody`'s JSDoc was orphaned. Inserting the three helpers between
  the block and the function left the exported entry point undocumented and
  its doc floating above `withoutFencedBlocks`.
- `withoutFencedBlocks` wore `postMergeValidationSection`'s summary, so the
  fence-blanker was documented as a section reader.
- `postMergeValidationSection` carried no JSDoc at all.
- `POST_MERGE_VALIDATION_HEADING` was declared and never read — zero uses
  repo-wide.

Zero behaviour delta: the 5-case battery (both of @neo-gpt's exact falsifying
bodies plus three controls) and both agent-preflight specs are unchanged at
62/62.

* fix(build): the residual gate reads sections and declarations, not lexemes (neomjs#16906)

The review named four bypasses at exact head and supplied the failing bodies.
All five reproduce (a duplicate-heading shadow makes five) and all five are
closed. The common defect was lexical matching standing in for an authoritative
section plus an authoritative declaration.

1. GFM FENCES. `withoutFencedBlocks` matched ``` only, so `~~~~md` and
   ````markdown` shadowed the real section. Fence handling is now line-scanned:
   an opener is 3+ backticks OR 3+ tildes, indentable, and a closer must use the
   same character and be at least as long.

2. INLINE CODE. A backticked `Residual-Owner: neomjs#200` inside the owing section
   discharged it. Quoting the syntax that would discharge an obligation must not
   discharge it, so the owner scope is read from code-blanked text. Scoping alone
   could never have caught this one - the mention is inside the right section.

3. THE COLON. `Residual-Owner:?` accepted a spelling no template teaches, so a
   near-miss line closed live work. The colon is now mandatory. Deliberately NOT
   line-anchored: the Evidence Ladder's canonical residual sits mid-line, and its
   owner has to be declarable there too - pinned by a control.

4. DUPLICATE SECTIONS. `body.match()` returns one hit, so an earlier
   `None deferred.` satisfied the gate while a later section owed real work.
   Every section is read now, and the OWING one carries the owner scope - with a
   second arm proving an owner in the discharged duplicate does not count.

Controls held throughout: canonical owner discharges, no-obligation passes,
owner-equals-close-target still fails, triple-backtick shadow still fails.
Specs 62 -> 66.

* fix(build): the owner is a declaration, and there are TWO legal shapes (neomjs#16906)

Round four. Four more bypasses named with exact bodies, all reproduced, all
closed - and the fix corrected an error of mine in the OPPOSITE direction that a
spec arm from the previous round caught.

1. PROSE is not a declaration. `We considered Residual-Owner: neomjs#200 but rejected
   that owner.` discharged the work while SAYING it rejected the owner. A section
   is prose, so the owner must BE the line, not appear in it. Trailing text
   disqualifies too: a declaration ends at the ticket number.

2. CODE has more spellings than one backtick pair. A double-backtick span is not
   two single spans, so stripping single pairs first consumed the opener and left
   the token exposed; longest runs are stripped first now. Four-space GFM
   indented code was not stripped at all.

3. EVERY owing section carries its own owner. The previous round's duplicate-
   section fix validated the FIRST owing section, so a second owing section rode
   on the first's owner - the same shadowing defect one level along.

AND THE CORRECTION THAT MATTERS MORE. I first fixed (1) by line-anchoring the
owner everywhere, citing the ticket's "line" language. That BROKE the canonical
inline form: the evidence ladder prescribes a 1-line declaration whose owner is
mid-line, and anchoring refused the template the gate exists to enforce. A spec
arm written the round before failed and caught it.

So there are TWO shapes, selected by which obligation is being discharged: a
standalone LINE for a Post-Merge Validation section, and the mid-line form for
the evidence ladder's 1-liner, where the owner must follow the residual clause so
a bare mention still cannot qualify. Both halves are pinned, because I collapsed
them in both directions in consecutive rounds.

Specs 66 -> 70.

* fix(build): an HTML comment is not a declaration (neomjs#16906)

Round five, one bypass, and it is the cleanest statement of what this whole
family has been about.

`<!--\nResidual-Owner: neomjs#200\n-->` inside an owing section returned valid:true.
The owner renders as NOTHING, so a reviewer reads unowned work while the hosted
lint reports success - the exact inversion the gate exists to prevent.

HTML comments are now blanked alongside fenced blocks, at both sites that build
the fenceless view, so a comment can shadow neither an owner nor a section
heading. Blanked per character, so every later line keeps its index.

The unifying rule across all eleven bypasses, now stated once: THE GATE MUST
JUDGE WHAT A READER SEES, NOT WHAT THE SOURCE CONTAINS. Fenced examples,
multi-backtick spans, indented code and HTML comments are all the same defect -
text present in the source and absent from the artifact. Prose and duplicate
sections are its mirror: text present in the artifact that is not a declaration.

Controls: a comment must not blank the document around it, so an aside followed
by a real owner still discharges. Mutation: unwiring the strip reddens exactly
the new arm.

Specs 70 -> 71.

* fix(build): a comment need not close to hide the owner (neomjs#16906)

@neo-gpt's round-6 falsifier, replayed at the exact head and confirmed:

  ## Post-Merge Validation
  - [ ] do real work
  <!--
  Residual-Owner: neomjs#200          <- no closing delimiter

`withoutHtmlComments` required `-->`, so an unterminated comment never matched,
never blanked, and the owner inside it was read as a live declaration. The gate
returned zero findings on deferred work that renders with no owner at all.

Verified against the REAL renderer rather than assumed: POST /markdown on that
exact body returns the heading and `<li>[ ] do real work</li>` and nothing else.
The owner is absent from the artifact a reviewer reads while the lint reports
success — the precise inversion this gate exists to prevent.

The fix is `(?:-->|$)`: blank from `<!--` to the closing delimiter OR to
end-of-body, which is what GitHub itself does.

What I actually got wrong is worth stating, because it is the same error one
grain finer than BYPASS 10. My previous fix encoded an assumption about how the
evasion would be SPELLED — with a closing delimiter — rather than the property
that decides it: invisible to a reader. Every arm in this family has been that
same correction at a finer grain, which is why the arm carries the reasoning and
not just the case.

Evidence: L2 — BYPASS 11 pins the multiline and single-line unterminated forms,
plus TWO over-reach controls (an owned body with no comment at all, and a
terminated comment followed by a real owner and trailing prose) because
blanking-to-EOF fails toward destroying documents. Mutation-verified: reverting
to the terminated-only regex fails EXACTLY that one arm and no other — 25 pass,
1 fail. Restored: 26/26. The gate's own body still passes its own instrument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The review guide raised its own byte cap by 48% instead of extracting to the Atlas

3 participants