Files
kyleandClaude Opus 5 e3f37da232 Hand over the M3a plan: 22 tasks, their files, and the check record
Task files, the files they copy in (byte-identical to the reference on
m3a-ref), each area's check record, and a README with the per-task
table of what each check exposed. The handoff note is done with.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 23:45:43 -07:00

62 lines
2.9 KiB
Markdown

# M3a task 22: end to end, in two processes
**Branch:** `m3a` (run `git switch m3a`; `git status --short` must be empty, otherwise stop)
**Commit subject:** `Add the end-to-end test: loopd against the real brokerd binary`
## Goal
One test that runs the whole decision path across the real socket: `loopd`'s turn loop, with a
`BrokerPort`, against the real `brokerd` binary on a temporary home, and the fake llama server.
The recorded model calls `read_file` with no grant; the next request to the model holds
"Denied: no grant allows this call."; the audit log verifies and holds one `Decision` record,
`no_grant`. It cannot be one process: `loopd` may not depend on `brokerd`, even as a
dev-dependency (`scripts/check-crate-deps.sh` checks that too). So the test finds the binary
through `BOXMAKER_BROKERD`, is `#[ignore]`d without it, and `make gate` sets it.
This task writes no code: every piece is from tasks 10 to 21. If the test fails, an earlier
task's code is wrong. Find which and **stop and report**; do not fix it here.
## Files
- Copy: `crates/loopd/tests/end_to_end.rs`, `Makefile`, `tools/check-m3a-device.sh`
- Modify: `docs/implementer-log.md`
The `Makefile` gains two lines in `gate`, after `cargo test`:
```make
cargo build --workspace --locked --offline
BOXMAKER_BROKERD=$(CURDIR)/target/debug/brokerd \
cargo test -p loopd --test end_to_end --locked --offline -- --ignored
```
`tools/check-m3a-device.sh` is the owner's check on straylight. **Do not run it**: it needs the
real server, which is shared. Copy it so that it is in the repository.
## Steps
- [ ] **1. Copy.** `git switch m3a`, then
`cp docs/plans/M3a/files/crates/loopd/tests/end_to_end.rs crates/loopd/tests/`,
`cp docs/plans/M3a/files/Makefile Makefile` and
`cp docs/plans/M3a/files/tools/check-m3a-device.sh tools/`
- [ ] **2. Without the variable.** `cargo test -p loopd --test end_to_end`. Expected:
`0 passed; 0 failed; 1 ignored`.
- [ ] **3. With it.** `cargo build --workspace`, then
`BOXMAKER_BROKERD=$PWD/target/debug/brokerd cargo test -p loopd --test end_to_end -- --ignored`,
five times. Expected: `1 passed` every time.
- [ ] **4. See it fail closed.** `cargo test -p loopd --test end_to_end -- --ignored` without the
variable. Expected: it **fails** with "set BOXMAKER_BROKERD". A test that passed here would be
a test that checks nothing.
- [ ] **5. Run the gate.** `make gate`. Expected: the end-to-end line reports `1 passed`, and the
last line is `gate: ok`.
- [ ] **6. Log and commit.** `git add crates/loopd/tests/end_to_end.rs Makefile tools/check-m3a-device.sh docs/implementer-log.md && git commit`
## Done when
- Steps 2 to 5 gave what they say, and `make gate` prints `gate: ok`.
## Stop and report if
- Step 3 fails. Say which assertion, and paste `brokerd`'s audit directory listing if the audit
part failed. Do not change any code in this task.
- `make gate` cannot find `target/debug/brokerd` (for example because `CARGO_TARGET_DIR` is set).