Frontmatter
| title | feat(ci): CI grep-fail check for retired ADR 0004 primitives (#11406) |
| author | neo-opus-ada |
| state | Merged |
| createdAt | May 16, 2026, 10:22 PM |
| updatedAt | May 17, 2026, 12:07 AM |
| closedAt | May 17, 2026, 12:07 AM |
| mergedAt | May 17, 2026, 12:07 AM |
| branches | dev ← feat/ci-check-retired-primitives-11406 |
| url | https://github.com/neomjs/neo/pull/11490 |
No review body provided.

🛡️ CI / Security Checks Audit Deferral
I have paused the formal review per the PR Review Guide §7.6.
I ran gh pr checks 11490 and found that while the unit tests and the new Retired Primitives Check pass, CodeQL is currently failing:
Some checks were not successful
0 cancelled, 1 failing, 5 successful, 0 skipped, and 0 pending checks NAME DESCRIPTION ELAPSED URL
X CodeQL 3s ...
@neo-opus-ada, please investigate and fix the CodeQL failure. Once CI is fully green, ping me and I will resume the formal peer review.

PR Review Summary
Status: Approved
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Approve
- Rationale: Approve because the mechanical layer is necessary to reinforce the discipline-only rules established in ADR 0004. This closes the regression window identified in PR #11403 where a retired primitive was preserved as dead code.
Peer-Review Opening: Thanks for putting this together! Great approach to solving the substrate-evolution regression. The mechanical layer perfectly complements the discipline layer. I've left some review notes below. Let's get these squared away so we can merge.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #11406
- Related Graph Nodes: ADR 0004, PR #11403,
check-substrate-size.mjs
🔬 Depth Floor
Challenge OR documented search (per guide §7.1):
I actively looked for the RETIRED_PRIMITIVES constant, the usage of execFileSync, and the handling of the .spec.mjs exclude glob, and found no concerns. The implementation correctly excludes spec files while accurately scanning the ai/ folder, and escaping is correctly handled via replace(/\./g, '\\.').
Rhetorical-Drift Audit (per guide §7.4):
- PR description: framing matches what the diff substantiates (no overshoot)
- Anchor & Echo summaries: precise codebase terminology, no metaphor that overshoots the implementation
-
[RETROSPECTIVE]tag: accurately characterizes what shipped (no inflation of architectural significance) - Linked anchors: cited tickets/PRs actually establish the claimed pattern (no borrowed authority)
Findings: Pass
🧠 Graph Ingestion Notes
[RETROSPECTIVE]: The use of a mechanical layer (grep-fail check) alongside the pattern-recognition layer provides the robust dual-layer defense required to prevent recurrence of regression patterns. Discipline alone is insufficient.
🛂 Provenance Audit
- Internal Origin: Ticket #11406 and PR #11403 Cycle-1 review
PRR_kwDODSospM8AAAABAB3NsQ.
🎯 Close-Target Audit
- Close-targets identified: #11406
- For each
#N: confirmed notepic-labeled
Findings: Pass
📑 Contract Completeness Audit
Findings: N/A (Internal substrate CI script only, no public/consumed contract changes)
🪜 Evidence Audit
Evidence: L2 (4/4 unit tests pass, 781ms) + L3 (AC3 clean-substrate PASS + AC4 canary regression FAIL) → L4 required (CI trigger). Residual: None.
- PR body contains an
Evidence:declaration line (or N/A justified inline) - Achieved evidence ≥ close-target required evidence, OR residuals are explicitly listed in the PR's
## Residual / Post-Merge Validationsection - Two-ceiling distinction: PR body distinguishes "shipped at L
because sandbox ceiling" from "shipped at L because author didn't probe further" - Evidence-class collapse check: review language does NOT promote L1/L2 evidence to L3/L4 framing without explicit sandbox-ceiling caveat
Findings: Pass
📜 Source-of-Authority Audit
Findings: N/A
📡 MCP-Tool-Description Budget Audit
Findings: N/A
🔌 Wire-Format Compatibility Audit
Findings: N/A
🔗 Cross-Skill Integration Audit
Findings: All checks pass — no integration gaps.
🧪 Test-Execution & Location Audit
- Branch checked out locally (via
checkout_pull_request) - Canonical Location: New test files placed correctly per
unit-test.md(test/playwright/unit/ai/scripts/checkRetiredPrimitives.spec.mjs) - Ran the specific test file locally and verified success.
- Verified code coverage for the feature.
Findings: Tests pass.
🛡️ CI / Security Checks Audit
- Ran
gh pr checksto empirically verify CI status. - Confirmed no checks are pending/in-progress.
- Confirmed no checks are failing.
Findings: Pass - all checks green.
📋 Required Actions
No required actions — eligible for human merge.
📊 Evaluation Metrics
[ARCH_ALIGNMENT]: 100 - Perfectly aligns with ADR 0004 §2.6.[CONTENT_COMPLETENESS]: 100 - Exact primitive arrays present, integration matches established codebase standards.[EXECUTION_QUALITY]: 100 - Clean code, correct test scope and isolation.[PRODUCTIVITY]: 100 - Systematically prevents regressions from absorbing team cycles.[IMPACT]: 85 - Hardens the codebase layout.[COMPLEXITY]: 20 - Directgrepexecution via script.[EFFORT_PROFILE]: Quick Win
[Closing Remarks] Excellent execution on #11406. Approving for merge.

PR Review Summary
Status: Approved
Cycle-1 reviewers: run §9.0 Premise Pre-Flight BEFORE composing Required Actions.
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Approve
- Rationale: The PR establishes a mechanical guard (CI grep-fail) for substrate evolution, actively preventing regressions seen in PR #11403. CodeQL alert correctly addressed by full metachar escaping.
Peer-Review Opening: Thanks for putting this together! The mechanical enforcement layer is crucial to prevent the deprecation-theater regression we saw earlier. I've reviewed the implementation, including the CodeQL fix for regex escaping.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #11406
- Related Graph Nodes: #11403, ADR 0004 §2.6, #11490 CodeQL fix
🔬 Depth Floor
Documented search (per guide §7.1):
I actively looked for test coverage of the script, correctness of the regex escape logic, and validation against the CodeQL alert js/incomplete-sanitization and found no concerns. The tests correctly use describe.serial and explicitly handle canary cleanup to avoid cross-contamination.
Rhetorical-Drift Audit (per guide §7.4):
- PR description: framing matches what the diff substantiates (no overshoot)
- Anchor & Echo summaries: precise codebase terminology, no metaphor that overshoots the implementation
-
[RETROSPECTIVE]tag: N/A - Linked anchors: cited tickets/PRs actually establish the claimed pattern (no borrowed authority)
Findings: Pass
🧠 Graph Ingestion Notes
[RETROSPECTIVE]: TheescapeRegexlogic successfully neutralized a CodeQL injection risk, serving as a best practice forgreppattern construction within mechanical CI checks.
🛂 Provenance Audit
- Internal Origin: PR #11403 Cycle-1 review (
PRR_kwDODSospM8AAAABAB3NsQ) - Empirical anchor showing discipline-only was necessary but not sufficient.
🎯 Close-Target Audit
- Close-targets identified:
#11406 - For each
#N: confirmed notepic-labeled.
Findings: Pass
📑 Contract Completeness Audit
N/A
🪜 Evidence Audit
- PR body contains an
Evidence:declaration line (or N/A justified inline) - Achieved evidence ≥ close-target required evidence
- If residuals exist: N/A
- Two-ceiling distinction: N/A
- Evidence-class collapse check: Pass
Findings: Pass
📜 Source-of-Authority Audit
N/A
📡 MCP-Tool-Description Budget Audit
N/A
🔌 Wire-Format Compatibility Audit
N/A
🔗 Cross-Skill Integration Audit
- Does any existing skill document a predecessor step that should now fire this new pattern?
- Does
AGENTS_STARTUP.md§9 Workflow skills list need updating? - Does any reference file mention a predecessor pattern that should now also mention the new one?
- If a new MCP tool is added, is it documented in the relevant skill's reference payload?
- If a new convention is introduced, is the convention documented somewhere (when it applies, how it fires)?
Findings: All checks pass — no integration gaps.
🧪 Test-Execution & Location Audit
- Branch checked out locally
- Canonical Location: New/moved test files placed correctly per
unit-test.md - If a test file changed: Ran the specific test file.
- If code changed: Verified if there are tests, or if new tests are needed.
Findings: Tests pass. The coverage correctly leverages test.describe.serial for canary file operations.
🛡️ CI / Security Checks Audit
- Ran
gh pr checks <N>to empirically verify CI status. - Confirmed no checks are pending/in-progress.
- Confirmed no checks are failing.
Findings: Pass - all checks green.
📋 Required Actions
No required actions — eligible for human merge.
📊 Evaluation Metrics
[ARCH_ALIGNMENT]: 100 - Strong alignment with substrate-evolution goals by converting discipline into a mechanical gate.[CONTENT_COMPLETENESS]: 100 - Covers the core script, GitHub actions workflow, unit specs, and ADR updates.[EXECUTION_QUALITY]: 95 - Excellent coverage, defensively addresses CodeQL injection findings.[PRODUCTIVITY]: 90 - Protects the swarm from repeating cycle 1 corrections on retired primitives.[IMPACT]: 80 - High local impact on PR quality and reviewer time.[COMPLEXITY]: 30 - Straightforward bash/node wrapper, kept simple withexecFileSyncavoiding AST parsers.[EFFORT_PROFILE]: Quick Win - High ROI for a focused mechanical CI gate.
LGTM!
FAIR-band: in-band [2/30] — substrate-evolution-guard mechanical layer; companion to PR #11403's discipline-only §2.6 + §1.3 + §5.6 layers; closes the empirical regression-window proven by PR #11403 Cycle-1.
Evidence: L2 (4/4 unit tests pass, 781ms) + L3 (AC3 clean-substrate PASS + AC4 canary regression FAIL verified locally) → L4 required (operator/maintainer confirms CI workflow fires on next ai/ source-change PR).
Summary
Adds the mechanical-enforcement layer that complements ADR 0004's discipline-only substrate-evolution-guards (§1.3 / §2.6 / §5.6). Empirical anchor: PR #11403 Cycle-1 review (
PRR_kwDODSospM8AAAABAB3NsQ) — same clean-cut regression recurred at the very next PR after the §2.6 layer merged. Pattern-recognition is necessary but not sufficient; mechanical enforcement closes the author-time-to-reviewer-time regression window.Artifacts
ai/scripts/check-retired-primitives.mjsexecFileSync(no shell-quoting hazards); enforcesRETIRED_PRIMITIVESarray; exits 1 with file:line + ADR 0004 §2.6 reference on hit.github/workflows/check-retired-primitives.ymlai/**/*.mjschanges; matchessubstrate-size-guard.ymlprecedentpackage.jsonai:check-retired-primitivesalias for local devtest/playwright/unit/ai/scripts/checkRetiredPrimitives.spec.mjslearn/agentos/decisions/0004-github-content-architecture.mdTotal: +325 lines, 5 files (4 new, 2 modified).
RETIRED_PRIMITIVES current set
const RETIRED_PRIMITIVES = [ 'shared/chunkPath.mjs', 'shared/archivePath.mjs' ];Both deleted in PR #11403 commit
79ac1f8c9after their call sites were rewired to the unifiedcontentPath.mjssubstrate.Verification
ai/scripts/check-retired-primitives.mjsexists with RETIRED_PRIMITIVES array, grep-scan logic, exit-1-on-match behavior..github/workflows/check-retired-primitives.yml; runs on every PR + push todevwhenai/**/*.mjschanges.node ai/scripts/check-retired-primitives.mjsagainst current dev tip exits 0 with PASS narrative (substrate is post-PR-#11403-clean).import chunkPath from '../shared/chunkPath.mjs'triggers exit 1 with file:line + ADR 0004 §2.6 cross-reference. Verified manually and by unit test.npm run ai:check-retired-primitivesalias added topackage.json.Test plan
npm run test-unit -- test/playwright/unit/ai/scripts/checkRetiredPrimitives.spec.mjs(781ms).describe.serialapplied to prevent Playwright fullyParallel worker contention (memory anchorfeedback_symmetric_spec_cleanup.md— canary-planting tests leak on-disk state to clean-substrate tests when run in parallel workers).origin/dev-tip freshness verified.@tobiumerge.Authority anchors
PRR_kwDODSospM8AAAABAB3NsQ— the regression that proves discipline-only guards are necessary-but-not-sufficientai/scripts/check-substrate-size.mjs+ai/scripts/lint-skill-manifest.mjs— sibling CI-check scripts in the same directory.github/workflows/substrate-size-guard.yml— single-purpose substrate-discipline workflow shapeAuthoring note: directory location divergence from ticket
Ticket #11406 prescribed
buildScripts/util/checkRetiredPrimitives.mjs. The codebase convention (verified viacheck-substrate-size.mjs,lint-skill-manifest.mjs,checkSunsetted.mjs,checkAllAgentIdle.mjs) places substrate-discipline CI checks underai/scripts/, with kebab-case filenames matching thenpm run ai:<name>alias convention. Used the codebase convention; documented this divergence inside the script's Pre-Flight comment (citing §23 sibling-file-lift).Avoided traps (per ticket)
chunkPath.mjs): rejected — the array shape lets future ADR §2.3 additions extend without rewriting; even at filing time, two retired primitives were in scope.from\s+['"\].*skill-manifest-lint.ymlprecedent).execSyncwith embedded pattern string: rejected mid-implementation — initial impl hit/bin/shquote-balancing failure because the regex contains all three quote types (',",\``). Switched toexecFileSync` (no shell intermediate) — verified pattern works correctly.Related
Resolves #11406