42 lines
2.4 KiB
Markdown
42 lines
2.4 KiB
Markdown
---
|
|
name: audit-subagent-deliverables
|
|
description: "Integrate subagent-written code safely: line-by-line audit, mechanical gates (bash test/lint), merge shared-function collisions, fix scope creep, verify env var propagation."
|
|
---
|
|
|
|
Integrating code written by subagents (fan-out implementation). The code is usually correct; the failures are structural — collisions between agents, scope creep, and assumptions that never reach the runtime.
|
|
|
|
## Workflow
|
|
|
|
1. **Read every deliverable line by line** before integrating — not the summary.
|
|
2. **Run the mechanical gates immediately**, in parallel: `bash -n` on every script; `bats tests/ 2>&1 | grep "not ok"` for the failure list, never `tail` (tail shows a passing tail and hides the red in the middle).
|
|
3. **Merge shared-function collisions.** When two agents add different versions of the same function, pick the superset and re-point the other's callers at it. (Real case: one agent's `fleet_base()` carried `-b`, the other's `resolve_fleet_base()` carried `--base-url`; resolve to the one flag set the tests use.)
|
|
4. **Delete scope creep.** Code added for a goal nobody asked for — a new env var, a new CLI flag, a new output file — goes, with its docs, unless the operator asked.
|
|
5. **Verify env var propagation.** A var the orchestrator computes must be exported before the `bash -c` / subshell that reads it, or the child silently takes a default. Check the export site, not the doc.
|
|
|
|
## Audit checks
|
|
|
|
| Check | How |
|
|
|---|---|
|
|
| Flag names real | `bash script.sh --help` |
|
|
| Paths exist | `test -e` each literal in the diff |
|
|
| Env reaches the runtime | grep the export/inline-assignment site, then the read |
|
|
| Tests assert behaviour | not `[[ -n "$X" ]]`, not `test -f <new file>` |
|
|
| Tests not weakened | `git diff HEAD~ -- tests/` — a deleted assertion is a red flag |
|
|
|
|
## Red flags
|
|
|
|
- Test asserting a new file exists rather than behaviour.
|
|
- Doc claiming a flag the script never defines.
|
|
- Function added with no caller.
|
|
- Doc example that contradicts the code it documents.
|
|
- Same helper defined twice with different flag spelling.
|
|
- New env var read but never exported.
|
|
|
|
## Re-verify after the operator's own edits
|
|
|
|
Run the gates again — their edit may undo an integration (a re-typed helper, a reverted flag).
|
|
|
|
## Report
|
|
|
|
Per deliverable: correct / changed / removed, with file:line, plus the gate output that proves it (`bats` failure list before and after).
|