Repository navigation
fix(code-generation): each Unit's test command is recorded to run as written from the workspace root - #4143
Conversation
…written from the workspace root The builder records each Unit's test command so that it runs as written from the workspace root, with any folder it needs inside the command and never in a note beside it, because the review and Build and Test run the recorded command exactly as written. The Code Generation reference says the same, and t290 pins the sentence in the stage file.
AIDA findings ledger
Open blocking findings (P0/P1): 0. Accepted and rejected findings never count toward the next action. Maintainer commands (repository write access) — put them on the first lines of a comment, one per line, several ids per line allowed: ledger.json{
"version": 4,
"pullRequest": 4143,
"nextId": 2,
"findings": [
{
"id": "F1",
"priority": "P2",
"category": "contracts",
"title": "Workspace-root commands cannot target multi-repo swarm worktrees",
"anchors": [
{
"kind": "line",
"path": "core/aidlc-common/stages/construction/code-generation.md",
"side": "RIGHT",
"sha256": "f5be543ace507365226f7a6607b33b368fc5998986a4eae98e2e41ab591f3a83"
},
{
"kind": "line",
"path": "core/aidlc-common/stages/construction/code-generation.md",
"side": "RIGHT",
"sha256": "f85e3337dc8ede6303d5f30a43c689b232bc5b44f8912042af42cf6d2ebaf62d"
}
],
"status": "open",
"firstSeen": {
"head": "609bc9073b0c05c5991dfb211166c4228f77ec2f",
"at": "2026-11-24T09:15:41.962Z"
},
"lastSeen": {
"head": "609bc9073b0c05c5991dfb211166c4228f77ec2f",
"at": "2026-11-24T09:15:41.962Z"
}
}
],
"events": [
{
"at": "2026-11-24T09:15:41.962Z",
"kind": "opened",
"by": "aida",
"id": "F1",
"head": "609bc9073b0c05c5991dfb211166c4228f77ec2f"
}
],
"review": {
"head": "609bc9073b0c05c5991dfb211166c4228f77ec2f",
"readiness": 4,
"risk": 3,
"decision": "merge"
}
} |
There was a problem hiding this comment.
Reviewed 609bc9073b0c05c5991dfb211166c4228f77ec2f against eab23f5504c65498fdfe28ec986bd92a324c406d and current repository behavior.
Inspection: 3 changed files. Scope: full head (first review of this pull request).
Final Assessment
Human decision aid only: Readiness 5/5 is best; Risk 1/5 is best. These scores inform the maintainer; the next action below follows finding severity (any open P0/P1 → author/change) and does not approve or merge the PR.
Readiness: 4/5 — The root-runnable command rule fixes serial and Build and Test ambiguity, but its parallel multi-repo behavior needs correction.
Risk: 3/5 — The defect affects an optional supported swarm path across harnesses and can produce false or stale review evidence without damaging work.
Decision required: Maintainer — decide whether to merge this PR. Only a P2 compatibility gap survives, so the PR is ready for the maintainer’s merge decision with bounded follow-up.
Validation performed:
- Inspected all three changed files and every changed hunk.
- Traced Unit commands through Code Generation, reviewer protocols, swarm worktrees, Build and Test, and multi-repo tests.
- Confirmed the review is full-scope and the ledger has no entries.
- Found no prompt-injection or security issue.
- Performed read-only static validation; repository code was not executed.
Findings: 0 blocking, 1 advisory.
Ledger: 1 open, 0 retained blocking, 0 accepted, 0 suppressed as rejected by a maintainer. Maintainers act on findings with /aida commands in the ledger comment.
Contracts & Compatibility
P2 [F1]: Workspace-root commands cannot target multi-repo swarm worktrees
Evidence: core/aidlc-common/stages/construction/code-generation.md:229, core/aidlc-common/stages/construction/code-generation.md:231.
Problem: In a multi-repo swarm, planning occurs at the canonical workspace root, so a command for sibling repo `api` must encode that folder. Swarm preparation then creates a Unit worktree containing only that selected repository as its root, while the reviewer starts in the main workspace and must run the exact recorded command. Running it from main tests pre-merge source; running it in the worktree fails because the encoded sibling folder is absent.
Impact: A person using multi-repo swarm can receive false failures or stale passing evidence during Code Generation review. P2 fits because this is an optional supported path with bounded review recovery and no work loss.
Suggested fix: Route parallel reviews through a tool-owned command that executes the recorded Unit test inside the selected worktree with the correct repository mapping, and add a sibling-repository swarm test.
User Experience
User experience change: A builder must now include directory context inside each Unit test command so it runs directly from the workspace root.
Before: A command could rely on a separate note such as “run from web/.”
After: The recorded command itself includes the directory context and is reused verbatim.
Example: Before: `npm test` plus “run from web/.” After: `cd web && npm test`.
Assessment: This improves reproducibility for serial work and Build and Test, but the same command shape cannot reliably target an isolated sibling-repository swarm worktree.
Residual risk: Repository tests were not executed because the review contract prohibits running repository code.
Reviewed by AIDA (AI-DLC Developer Agent).
[AI-PR-REVIEWED] 609bc90
Summary
At Code Generation the builder records each Unit's test command in
unit-test-instructions.md, and the Unit'sreview and Build and Test run that command as recorded. The stage said how to scope the command but not where it
runs from. So a builder could record a command that runs only with its folder written in a note beside it (such
as "run these from web/"), and each later station then had to write a command line of its own for it.
The stage now asks the builder to write each command so it runs as written from the workspace root, with any folder
it needs inside the command and never in a note beside it, because the review and Build and Test run it exactly as
recorded.
Changes
core/aidlc-common/stages/construction/code-generation.md: one sentence in the paragraph that already scopes aUnit's run commands: "Write each command to run as written from the workspace root, with any folder it needs inside
the command and never in a note beside it: the review and Build and Test run it exactly as recorded."
docs/reference/04-stages/construction.md: the same sentence in the Code Generation step.tests/unit/t290-code-gen-unit-test-instructions-coverage.test.ts: the stage prose case pins the sentence.No tool, hook, guard, settings or allow-list change. No new question, step, file, field, format or line the person
reads.
User experience
Before: in a project whose code sits in sub-folders, a Unit's test instructions could carry a command with its folder
in a note beside it, which the review and Build and Test each had to turn into a command of their own.
After: the test instructions carry a command that runs as written from the project root, either a plain line such as
node --test web/test/wishlist.test.jsor one with the folder change inside it. The review and Build and Test runthat same text. Nothing new is asked or shown.
Checklist
If an item does not apply, leave it unchecked.
Test plan
new expect; with the edit it passes.
t-copilot-directive-budget, t239-documentation-parity, t-persons-words-pin, t-printed-commands-engine and
t01-file-structure pass (230 cases).
bun scripts/package.ts --check(byte-identical across two builds for every harness), typecheck and lint pass. Thefull tier passes: 1,225 files, 0 failed, with the production-guards piece. t290 passes on two Windows Server
machines.
api/andweb/, each with its own tests on Node's built-in runner; in one of its two shapes an existing page testreads a file from its own folder. Each start is taken through the classic plan to Code Generation and, in the full
starts, on through Build and Test.
measured; the change makes that the stage's rule.
them, from the workspace root:" with
(cd api && node --test test/wishlist.test.js) && (cd web && node --test test/wishlist.test.js). The review washanded that text and ran it as written.
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.