Repository navigation
spec(port): port specs/port/trios/crates/trios-rainbow-bridge/src/bridge.t27 (Closes #9474) - #9924
Conversation
…dge.t27 (Closes gHashTag#9474) Port gHashTag/trios:crates/trios-rainbow-bridge/src/bridge.rs (at 8b229e9489ee, 250 lines) as specs/port/trios/crates/trios- rainbow-bridge/src/bridge.t27 - Roadmap Stage 6, goal gHashTag#4548, target t27c gen-rust. The Rainbow Bridge state machine's decisions are ported as pure functions and tested (7 tests, 7 pass, 0 vacuous, 39 runtime asserts, 100% function coverage): the INV-8 seven-branch legality catalogue, the fixed check order of Bridge_accept (the cheap structural channel-payload mismatch first, then the per-agent lamport monotonicity, then the payload branch, then the layers advance, and the funnel latency budget LAST - the event already advanced when an over-budget latency answers FunnelUnreachable), the duplicate-claim gate (a distinct agent at the same lamport), the heartbeat staleness over the lib.rs budget, the unsigned-honey gate (un-signed or rejected by the registered key, with no key meaning the signature presence alone gates), and the split-brain State commit gate. The heartbeat and latency budgets live in the crate's lib.rs, not this file: their comparison rules are carried with the thresholds as parameters, inventing no values. The hash maps and the funnel are the callers' plumbing. Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors, coverage 16/16, test-report 7/7 pass, 0 BLOCKED, gen 173 lines with 0 'not yet implemented', boundary exactly this one file, dupe_scan: all 11 introduced names unique across 2040 specs (checked before the commit), bare body scan adds no duplicate group (752/221 unchanged). Dmitrii Fedorov ([@dmitrii-f-t27](https://github.com/dmitrii-f-t27))
|
@gHashTag Please merge this PR into master via the golden chain — rights on gHashTag/t27 are read-only for me (403), so the merge itself needs your action. What this is: the #9474 port — What is verified:
CI (head 8a660a9): required trio green — The 3 reds are the base-red trio, not this change: After the merge I will: verify the spec file live on the merge SHA, confirm #9474 auto-closed, and file the 14-step report. Dmitrii Fedorov (@dmitrii-f-t27) |
Summary
Port
gHashTag/trios:crates/trios-rainbow-bridge/src/bridge.rs(at8b229e9489ee, 250 lines) asspecs/port/trios/crates/trios-rainbow-bridge/src/bridge.t27— Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9474.The original is the Rainbow Bridge state machine:
Bridge::acceptis the single entry point evaluating the full seven-branch legality predicate (INV-8) for one incoming event, answering Ok with the event merkle-appended and fanned out, or the typed error of the first violated branch.Per the issue's rule ("Port the decision, not the plumbing"), all five listed functions are ported under their names as pure functions (no transports — the hash maps and the funnel are the callers' plumbing) with 7 tests (39 runtime asserts, 0 vacuous, 100% function coverage):
Bridge_new— the fresh start: the two layers, the four maps, the funnel (original lines 121-131);Bridge_register_honey_key— the key replaces any previous one (lines 134-136);Bridge_merkle_root_hex/Bridge_lamport— the operator- and test-facing layer readbacks (lines 139-146);Bridge_accept— the fixed check order: the cheapest structural channel-payload mismatch first, then the per-agent lamport monotonicity, then the payload branch (the duplicate-claim gate — a distinct agent at the same lamport; the heartbeat staleness; the unsigned-honey gate — un-signed or rejected by the registered key, with no key meaning the signature presence alone gates; the split-brain State commit), then the layers advance, and the funnel latency budget runs last — the event already advanced when an over-budget latency answers FunnelUnreachable (lines 150-250).The heartbeat and latency budgets (HEARTBEAT_MAX_S, LATENCY_P95_MS) live in the crate's lib.rs, not this file: their comparison rules are carried with the thresholds as parameters, inventing no values.
Verification (all run live from the worktree root, zig 0.16.0)
t27c parse: OK.t27c spec-status: IMPLEMENTED.t27c typecheck: 0 errors, 0 warnings.t27c coverage: 16/16 tested (100%) — no transports in this port.t27c test-report: 7 tests / 7 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes — the INV-8 catalogue, the fresh construction with its seven fields, the channel and lamport gates (strict advance, first sight passes), the duplicate-claim gate (distinct agent, same lamport, first-claim records), the heartbeat and honey gates (boundary at the budget, un-signed, rejected, no-key), the split-brain gate, and the fixed accept order with the funnel last.t27c gen | grep -c 'not yet implemented': 0;gen | wc -l: 173 (> 12).grep -cE '^\s*(pub )?fn (Bridge_new|Bridge_register_honey_key|Bridge_merkle_root_hex|Bridge_lamport|Bridge_accept)\(': 5.grep -cE '^\s*test\s+(["|[A-Za-z_])': 7 (≥ 5).git status --short— exactly this one file. The repo's lefthook pre-commit passed.dupe_scan: all 11 introduced names unique across 2040 specs (checked before the commit); the bare body scan adds no duplicate group (752 bodies / 221 groups on base, identical with this spec present).Dmitrii Fedorov (@dmitrii-f-t27)