M5b plan: task 13, instance lock in brokerd, memoryd and gatewayd

Each locks <home>/run/<role>.lock in main (gatewayd after its secret,
so nothing is made before the secret is read). brokerd's old
second-instance test in serve.rs expected the audit lock's message,
so serve.rs has a new version; task 01 now copies serve.rs-task01.

Checks: given tests fail at ref 12 as the task says (2 each in
brokerd, memoryd, gatewayd; serve.rs passes); the task's quoted edits
applied to ref 12 reproduce ref 13's tree exactly; replay gate ok with
1118 tests (1113 - 1 + 6), /tmp unchanged; 14 mutations, all caught;
the six instance test files stressed 25 runs under 16 busy loops and
20 under 32, no failure.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-26 17:21:14 -07:00
co-authored by Claude Opus 5.5
parent 291d82f21b
commit 5f48ba65b0
7 changed files with 1354 additions and 21 deletions
@@ -53,7 +53,8 @@ This is the complete list. Each one is covered by an edit below or by a given fi
- **new versions** of: `crates/bxcore/tests/wire.rs`, `crates/bxcore/tests/strict.rs`;
`crates/brokerd/tests/admin.rs`, `broker.rs`, `broker_pending.rs`, `courier.rs`, `ledger.rs`,
`serve.rs`; `crates/loopd/tests/broker_port.rs`, `tools.rs`, `turn_broker.rs`. Your
`broker.rs` is the given `broker.rs-task01`: the given `broker.rs` is task 09's.
`broker.rs` is the given `broker.rs-task01`: the given `broker.rs` is task 09's. Your
`serve.rs` is the given `serve.rs-task01`: the given `serve.rs` is task 13's.
- Modify: `crates/bxcore/src/wire.rs`, `crates/brokerd/src/args.rs`,
`crates/brokerd/src/policy/mod.rs`, `crates/brokerd/src/ledger/mod.rs`,
`crates/brokerd/src/broker.rs`, `crates/loopd/src/tools.rs`, `crates/loopd/src/turn.rs`,
@@ -498,8 +499,8 @@ The event keeps only the reason: the owner's texts do not change.
crates/brokerd/tests/
cp docs/plans/M5b/files/crates/brokerd/tests/ledger.rs \
crates/brokerd/tests/
cp docs/plans/M5b/files/crates/brokerd/tests/serve.rs \
crates/brokerd/tests/
cp docs/plans/M5b/files/crates/brokerd/tests/serve.rs-task01 \
crates/brokerd/tests/serve.rs
cp docs/plans/M5b/files/crates/loopd/tests/broker_port.rs \
crates/loopd/tests/
cp docs/plans/M5b/files/crates/loopd/tests/tools.rs \