# 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).