c623b2f63c (feat(engine): remove received Brain implementation (#17791) (#17806)) deleted 796 unit specs under one general account. #17922 hand-censused a slice of that population — test/playwright/unit/ai/buildScripts/** — and explicitly scoped the other 774 deletions out, noting that "a general 'does this deleted spec's subject still exist in the Engine?' sweep is worth doing and is not this."
That general sweep now exists as a mechanical instrument: the surviving-subject check built in #17964 / PR #17965. Replaying it over c623b2f63c surfaced a population nothing had censused — 12 deleted specs whose subjects are still in src/ai/** at HEAD today, and whose arms no CI anywhere executes.
This ticket is the durable owner that RA-4 of @neo-gpt's review on PR #17965 required. It was recorded in #17964's Out of Scope precisely so it could not be quietly absorbed, and it is filed rather than left as prose.
Live latest-open sweep: checked the latest 20 open issues at 2026-08-31T18:27Z; no equivalent found. Nearest neighbours are #17922 (a different, already-censused slice) and #17967 (skill references to ai/ paths, not test coverage).
The Problem
A deleted spec is the one regression the suite cannot report: the run goes green with less coverage behind the same number. For these 12 the implementation never left — only its tests did — so nothing anywhere is red, nothing is missing at import time, and the loss is invisible to every existing signal.
Verified at HEAD, all twelve subjects present, none carrying an Engine spec:
Measured, not inferred: each subject path exists at HEAD and find test/playwright/unit -name '<name>.spec.mjs' returns nothing for all twelve. The deleted paths are read from c623b2f63c's own --name-status rows.
That census is Engine-scoped, and the scope is the correction below: it cannot see a spec that moved to another repository, so its silence was read as absence.
Note what this population is NOT. The engine kept these files deliberately — they are the Engine-side write-admission and client-service surface, not Brain implementation that departed. The split correctly removed a great deal; it also took the tests of things it kept.
Correction — the original premise was false, and so was its first repair
This ticket shipped with "no unit coverage at all". @neo-gpt's review on PR #18002 falsified it: all twelve specs are tracked on neo-agent-brainorigin/dev@a212acc at byte-identical paths, importing the Engine as a package (neo.mjs/src/ai/...). c623b2f63cmoved this coverage; it did not delete it.
The first repair — mine, in A2A — then overshot in the other direction: I ran the Brain specs locally, saw them pass, and reported that they "are selected and they run." Selected is true; run is not. .github/workflows/brain-unit.yml collects the whole corpus with npm run test-unit -- --list, then executes an explicit four-file smoke list:
None of the twelve is in it. Engine's .github/workflows/test.yml runs npm run test-${{ matrix.suite }} with no file list, so the Engine unit suite executes its full corpus.
This collected-but-never-executed property is not a new finding — neo-agent-brain#201 already owns it, and states it more precisely than I did ("healthy retained specs never selected — collected successfully, assertions never run"). It is cited here only to explain why the original census read absence into a repository whose CI would not have reported these arms either way.
Current truth, three-valued rather than two: the twelve arms exist (Brain), are collected (Brain --list, so an import or syntax break is still caught), and are executed by nothing. The defect this ticket describes is therefore real and slightly sharper than filed — the write-admission refusal path has arms that no pipeline ever runs — but its stated mechanism was wrong, and the fix is custody, not authorship: restoring these subjects' specs to the Engine is what puts them in a suite that actually executes them.
The Architectural Reality
The write-admission chain is the sharp half.admitWrite / WriteGuard / resolveWriteLock / LockRegistry / TransactionService form a refusal path — the class of code whose failure mode is permitting something, which is exactly the failure a passing suite cannot notice. Coverage loss here is worth more than the count suggests.
src/ai/client/** is the consumed surface the Neural Link drives; deriveSubtreePath and parseAgentEnvelope are pure functions and are the cheapest arms to restore.
The specs are recoverable, not rewritable-from-scratch:git show c623b2f63c^:<path> yields each original. They will not apply unmodified — they were written against the pre-split module graph — so restoration is a port, and the ported arm must be checked against what the subject does now.
test/playwright/unit is the only Engine suite CI runs alongside components, so restored specs land where they will actually execute.
The Fix
Port each deleted spec back against its current subject, under its original path. Per subject: recover the original, run it, and repair it against today's API — the arm must fail when the subject misbehaves, not merely pass.
Restoration is not the moment to change what an implementation does. If a ported arm reveals a defect in the subject, that is a separate bug ticket, and this ticket records it rather than fixing it.
Acceptance Criteria
All 12 subjects carry a unit spec at its original path under test/playwright/unit/ai/**, and npm run test-unit is green.
Each restored spec is mutation-checked: a seeded change to its subject reds at least one arm. A spec that cannot fail on its subject's defect does not count as restored, and the seeded mutation is stated per subject.
The write-admission chain (admitWrite, WriteGuard, resolveWriteLock, LockRegistry, TransactionService) has at least one arm per subject asserting a REFUSAL, not only a success path.
Any port that had to change an assertion because the subject's behavior changed since c623b2f63c names the change and why the new assertion is correct.
The twelve arms are executed by Engine CI, not merely present: the unit suite's own run at the merge head reports each restored spec file in its collected-and-executed set, and the count is recorded as passed / skipped rather than as a collected total.
The Brain copies are retired in a paired, Engine-first sequence, so the twelve exist in exactly one repository when both PRs have landed. (The #17964 surviving-subject guard evaluates the deleting commit and structurally cannot observe a later restoration, so it is not the instrument for this AC; that limitation is recorded in #17964 rather than worked around here.)
Defects found while porting are filed as their own tickets and linked here; none are fixed in this PR.
Out of Scope
The other 762 deletions.#17922 censused one slice, this ticket censuses a second; neither claims the remainder. Most covered ai/** sources that genuinely left with the split.
Changing any of the 12 implementations. Restoration is not a refactor, and a defect surfaced by a port becomes its own ticket.
The five subjects whose filename differs from their spec's (TicketIndex.spec.mjs → tickets.mjs, and similar) — no mechanical name rule recovers those; they belong to #17922's stated bound.
Making the spec-retirement guard blocking — #17171 owns required-context binding for the *-lint.yml workflows.
Avoided Traps
Restoring the files unmodified and calling it done. The specs predate the split's module graph; a green run after a blind restore would most likely mean the arms are vacuous, which is why the mutation criterion above is per-spec rather than per-PR.
Treating the count as the goal. Twelve specs is the population, not the value; the write-admission chain is where the coverage actually matters, and it is called out separately so a port that runs out of budget stops at the right place.
Folding this into #17922. That ticket's instrument and stated bound are a different population. Bundling would silently widen a claim it deliberately narrowed.
Decision Record impact
none — restores test coverage for existing behavior; no contract, no ADR authority touched.
Related
Surfaced by: #17964 / PR #17965 (the surviving-subject guard), RA-4 of @neo-gpt's review.
Context
c623b2f63c(feat(engine): remove received Brain implementation (#17791) (#17806)) deleted 796 unit specs under one general account. #17922 hand-censused a slice of that population —test/playwright/unit/ai/buildScripts/**— and explicitly scoped the other 774 deletions out, noting that "a general 'does this deleted spec's subject still exist in the Engine?' sweep is worth doing and is not this."That general sweep now exists as a mechanical instrument: the surviving-subject check built in #17964 / PR #17965. Replaying it over
c623b2f63csurfaced a population nothing had censused — 12 deleted specs whose subjects are still insrc/ai/**atHEADtoday, and whose arms no CI anywhere executes.This ticket is the durable owner that RA-4 of @neo-gpt's review on PR #17965 required. It was recorded in #17964's Out of Scope precisely so it could not be quietly absorbed, and it is filed rather than left as prose.
Live latest-open sweep: checked the latest 20 open issues at 2026-08-31T18:27Z; no equivalent found. Nearest neighbours are #17922 (a different, already-censused slice) and #17967 (skill references to
ai/paths, not test coverage).The Problem
A deleted spec is the one regression the suite cannot report: the run goes green with less coverage behind the same number. For these 12 the implementation never left — only its tests did — so nothing anywhere is red, nothing is missing at import time, and the loss is invisible to every existing signal.
Verified at
HEAD, all twelve subjects present, none carrying an Engine spec:c623b2f63csrc/ai/LockRegistry.mjstest/playwright/unit/ai/LockRegistry.spec.mjssrc/ai/TransactionService.mjstest/playwright/unit/ai/TransactionService.spec.mjssrc/ai/WriteGuard.mjstest/playwright/unit/ai/WriteGuard.spec.mjssrc/ai/admitWrite.mjstest/playwright/unit/ai/admitWrite.spec.mjssrc/ai/deriveSubtreePath.mjstest/playwright/unit/ai/deriveSubtreePath.spec.mjssrc/ai/parseAgentEnvelope.mjstest/playwright/unit/ai/parseAgentEnvelope.spec.mjssrc/ai/resolveWriteLock.mjstest/playwright/unit/ai/resolveWriteLock.spec.mjssrc/ai/client/ComponentService.mjstest/playwright/unit/ai/client/ComponentService.spec.mjssrc/ai/client/DockService.mjstest/playwright/unit/ai/client/DockService.spec.mjssrc/ai/client/InstanceService.mjstest/playwright/unit/ai/client/InstanceService.spec.mjssrc/ai/client/RuntimeService.mjstest/playwright/unit/ai/client/RuntimeService.spec.mjssrc/ai/client/TourRunner.mjstest/playwright/unit/ai/client/TourRunner.spec.mjsMeasured, not inferred: each subject path exists at
HEADandfind test/playwright/unit -name '<name>.spec.mjs'returns nothing for all twelve. The deleted paths are read fromc623b2f63c's own--name-statusrows.That census is Engine-scoped, and the scope is the correction below: it cannot see a spec that moved to another repository, so its silence was read as absence.
Note what this population is NOT. The engine kept these files deliberately — they are the Engine-side write-admission and client-service surface, not Brain implementation that departed. The split correctly removed a great deal; it also took the tests of things it kept.
Correction — the original premise was false, and so was its first repair
This ticket shipped with "no unit coverage at all". @neo-gpt's review on PR #18002 falsified it: all twelve specs are tracked on
neo-agent-brainorigin/dev@a212accat byte-identical paths, importing the Engine as a package (neo.mjs/src/ai/...).c623b2f63cmoved this coverage; it did not delete it.The first repair — mine, in A2A — then overshot in the other direction: I ran the Brain specs locally, saw them pass, and reported that they "are selected and they run." Selected is true; run is not.
.github/workflows/brain-unit.ymlcollects the whole corpus withnpm run test-unit -- --list, then executes an explicit four-file smoke list:None of the twelve is in it. Engine's
.github/workflows/test.ymlrunsnpm run test-${{ matrix.suite }}with no file list, so the Engineunitsuite executes its full corpus.This collected-but-never-executed property is not a new finding —
neo-agent-brain#201already owns it, and states it more precisely than I did ("healthy retained specs never selected — collected successfully, assertions never run"). It is cited here only to explain why the original census read absence into a repository whose CI would not have reported these arms either way.Current truth, three-valued rather than two: the twelve arms exist (Brain), are collected (Brain
--list, so an import or syntax break is still caught), and are executed by nothing. The defect this ticket describes is therefore real and slightly sharper than filed — the write-admission refusal path has arms that no pipeline ever runs — but its stated mechanism was wrong, and the fix is custody, not authorship: restoring these subjects' specs to the Engine is what puts them in a suite that actually executes them.The Architectural Reality
admitWrite/WriteGuard/resolveWriteLock/LockRegistry/TransactionServiceform a refusal path — the class of code whose failure mode is permitting something, which is exactly the failure a passing suite cannot notice. Coverage loss here is worth more than the count suggests.src/ai/client/**is the consumed surface the Neural Link drives;deriveSubtreePathandparseAgentEnvelopeare pure functions and are the cheapest arms to restore.git show c623b2f63c^:<path>yields each original. They will not apply unmodified — they were written against the pre-split module graph — so restoration is a port, and the ported arm must be checked against what the subject does now.test/playwright/unitis the only Engine suite CI runs alongsidecomponents, so restored specs land where they will actually execute.The Fix
Port each deleted spec back against its current subject, under its original path. Per subject: recover the original, run it, and repair it against today's API — the arm must fail when the subject misbehaves, not merely pass.
Restoration is not the moment to change what an implementation does. If a ported arm reveals a defect in the subject, that is a separate bug ticket, and this ticket records it rather than fixing it.
Acceptance Criteria
test/playwright/unit/ai/**, andnpm run test-unitis green.admitWrite,WriteGuard,resolveWriteLock,LockRegistry,TransactionService) has at least one arm per subject asserting a REFUSAL, not only a success path.c623b2f63cnames the change and why the new assertion is correct.unitsuite's own run at the merge head reports each restored spec file in its collected-and-executed set, and the count is recorded aspassed / skippedrather than as a collected total.Out of Scope
ai/**sources that genuinely left with the split.TicketIndex.spec.mjs→tickets.mjs, and similar) — no mechanical name rule recovers those; they belong to #17922's stated bound.*-lint.ymlworkflows.Avoided Traps
Decision Record impact
none— restores test coverage for existing behavior; no contract, no ADR authority touched.Related
c623b2f63c.Origin Session ID: 62883bfb-cab7-4a44-b186-52c4de468017
Retrieval Hint: "src/ai unit specs deleted in the Brain split, subjects survived" · commit
c623b2f63c