Repository navigation
spec(port): port specs/port/trios/crates/trios-bridge/src/server.t27 (Closes #9121) - #9907
Conversation
…loses gHashTag#9121) Port gHashTag/trios:crates/trios-bridge/src/server.rs (at 8b229e9489ee, 165 lines) as specs/port/trios/crates/trios-bridge/ src/server.t27 - Roadmap Stage 6, goal gHashTag#4548, target t27c gen-rust. The agent-bridge WebSocket server's decisions are ported as pure functions and tested (7 tests, 7 pass, 0 vacuous, 24 runtime asserts, 100% function coverage): the server carries its router, a 1024-slot broadcast channel, the GitHub repo and the optional token (the getters read back, the token answering none when absent), the broadcast tolerates failed sends, the accept loop keeps accepting past a failed handshake, the read loop continues on text frames, ends on Close or a stream error, and ignores other kinds - and the dispatch table: a SendCommand for a target that is neither the broadcast literal nor a registered agent answers the agent_not_found error to everyone, otherwise it forwards; ClaimIssue and UpdateStatus apply and refresh the board state for all subscribers; ListAgents answers the board state; anything else forwards unchanged. The WebSocket accept loop, the serialization and the router state are the callers' plumbing. Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors, coverage 11/11, test-report 7/7 pass, 0 BLOCKED, gen 127 lines with 0 'not yet implemented', boundary exactly this one file, dupe_scan: all 4 introduced helper names unique across 2040 specs AND the BridgeServerPlan struct verified absent from the corpus type set by grep before the commit, bare body scan adds no duplicate group (752/221 unchanged). Dmitrii Fedorov ([@dmitrii-f-t27](https://github.com/dmitrii-f-t27))
…loses gHashTag#9121) The issue's AC-5 asks for at least 8 test blocks; the first commit carried 7. Added the eighth asserting the broadcast target literal, the one constant the SendCommand gate reads. All oracles re-verified: 8 blocks, fn-count exactly 8, all pass. 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 #9121 port — What is verified:
CI (head e5d22fb): 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 #9121 auto-closed, and file the 14-step report. Dmitrii Fedorov (@dmitrii-f-t27) |
Summary
Port
gHashTag/trios:crates/trios-bridge/src/server.rs(at8b229e9489ee, 165 lines) asspecs/port/trios/crates/trios-bridge/src/server.t27— Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9121.The original runs the agent-bridge WebSocket server: connections join a broadcast fan-out, incoming text dispatches through a message router, and the board state refreshes for everyone on the mutating variants.
Per the issue's rule ("Port the decision, not the plumbing"), all eight listed functions are ported under their names as pure functions (no transports — the WebSocket accept loop, the serialization and the router state are the callers' plumbing) with 8 tests (25 runtime asserts, 0 vacuous, 100% function coverage):
BridgeServer_new— the router, the 1024-slot broadcast channel, the repo and the optional token (original lines 25-33);BridgeServer_router/BridgeServer_github_repo/BridgeServer_github_token/BridgeServer_subscribe— the getters, the token answering none when absent (lines 36-53);BridgeServer_broadcast_message— serialize then fan out, a failed send tolerated (let _), so the broadcast answers Ok regardless (lines 56-60);BridgeServer_serve— the accept loop keeps accepting past a failed handshake; the read loop continues on text frames, ends on Close or a stream error, and ignores other kinds (lines 63-119);BridgeServer_handle_message— the dispatch table: a SendCommand for a target that is neither thebroadcastliteral nor a registered agent answers the agent_not_found error to everyone; otherwise it forwards; ClaimIssue and UpdateStatus apply and broadcast the fresh board state; ListAgents answers the board state; anything else forwards unchanged (lines 122-165).The second commit adds the eighth test block (the broadcast-literal constant) that the issue's AC-5 threshold asks for — the first commit carried 7. Both commits carry their
Closes #9121reference, satisfying the per-commit L1 TRACEABILITY rule.Verification (all run live from the worktree root, zig 0.16.0, on the final head)
t27c parse: OK.t27c spec-status: IMPLEMENTED.t27c typecheck: 0 errors, 0 warnings.t27c coverage: 11/11 tested (100%) — no transports in this port.t27c test-report: 8 tests / 8 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes — the capacity/repo/token plan both ways, the getters, the tolerated broadcast, the accept-past-failure rule, all four frame kinds, the SendCommand gate across broadcast/registered/unregistered, all dispatch variants, and the broadcast-literal constant.t27c gen | grep -c 'not yet implemented': 0;gen | wc -l: 131 (> 12).grep -cE '^\s*(pub )?fn (BridgeServer_new|BridgeServer_router|BridgeServer_github_repo|BridgeServer_github_token|BridgeServer_subscribe|BridgeServer_broadcast_message|BridgeServer_serve|BridgeServer_handle_message)\(': 8.grep -cE '^\s*test\s+(["|[A-Za-z_])': 8 (≥ 8).git status --short— exactly this one file. The repo's lefthook pre-commit passed on both commits.dupe_scan: all 4 introduced helper names unique across 2040 specs, and theBridgeServerPlanstruct verified absent from the corpus type set by grep 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)