Repository navigation
feat(test-fixtures,client): TwoAircLoopback + AircIpcTransport↔substrate wire roundtrip - #1558
Merged
Merged
Conversation
…ton (task #187 slice 1) New shared test-fixture crate under core/ so substrate integration tests and continuum-client roundtrip tests can use the same fixture without either side bloating its own [dev-dependencies] tree. core/airc-test-fixtures/ Cargo.toml airc-lib + continuum-airc-protocol + tempfile src/lib.rs re-exports TwoAircLoopback + LoopbackError src/two_airc_loopback.rs public API + typed errors + skeleton bodies Public API (locked): pub struct TwoAircLoopback { peer_a, peer_b, peer_a_id, peer_b_id, ... } impl TwoAircLoopback { pub async fn new() -> Result<Self, LoopbackError>; pub fn peer_a(&self) -> &Arc<airc_lib::Airc>; pub fn peer_b(&self) -> &Arc<airc_lib::Airc>; pub fn peer_a_id(&self) -> Uuid; pub fn peer_b_id(&self) -> Uuid; } pub enum LoopbackError { TempDir(io::Error), AircSpawn(String), PeerRegistrationTimeout, NotImplemented(&'static str), } Method bodies stub `NotImplemented` for now — the real impl needs airc-lib spawn-mode study (in-process loopback vs two daemon child processes) that deserves a focused next-session slice. Closes the architectural seam reviewer 1 flagged: the AircIpcTransport wire shape is verified at unit level but not by a real client→server roundtrip. This fixture will be what TLS-style asserts that. Workspace member added between continuum-airc-protocol and archive (alpha order inside core/* tier). Verified: cargo check -p airc-test-fixtures → clean (2.4s) cargo test -p airc-test-fixtures → 1/1 pass (skeleton surfaces typed NotImplemented, not panic) Task #187 slice 1 of N — slice 2 brings the real spawn impl + the first end-to-end roundtrip test consuming AircIpcTransport from continuum-client against a real substrate command_handler on the other peer. Co-Authored-By: Claude Opus 4.7 <[email protected]>
…ort↔substrate wire roundtrip (tasks #187 + #188) Stage 2 of task #187 lands the actual spawn-2-Aircs-on-loopback behavior, and stage 1 of task #188 lands the integration test that proves the AircIpcTransport wire shape matches what the substrate's command_handler expects. Together these close the wire-roundtrip verification gap adversarial reviewer 1 flagged on PR #1557. TwoAircLoopback::new() — real impl (was: stub returning NotImplemented) Studied airc-lib's public API at the pinned rev (f6ed190): Airc::open(home) — load identity, open coordinator store airc.peer_spec() — emit a parseable PeerSpec string airc.add_peer(spec) — mutual trust handshake airc.join(room) — join a shared room airc.listen_lan(127.0.0.1:0)— bind a kernel-picked loopback port airc.connect_lan(addr, id) — dial peer-targeted authenticated socket TwoAircLoopback::new() walks the canonical 4-step setup the substrate's own tests use: 1. Allocate two TempDir homes 2. Open peer_a + peer_b (strict verification policy) 3. Mutual trust via parse(peer_spec) + add_peer 4. Both join the shared fixture room 5. Wire LAN: peer_b listens, peer_a dials with peer_b's peer_id Typed LoopbackError shape: TempDir / AircSpawn (one variant + a human-readable message naming which peer + which step failed). Drops the previous NotImplemented placeholder. Bare-airc smoke test (lives inside airc-test-fixtures) bare_request_reply_round_trips_over_loopback — peer_a sends a request, peer_b's subscribe stream sees it, peer_b replies via airc.reply, peer_a's await_reply resolves with the body. Proves the fixture's wire is alive end-to-end without any continuum-specific protocol on top. AircIpcTransport ↔ substrate wire-roundtrip test client/continuum-client/tests/airc_ipc_roundtrip.rs Spawns a substrate-equivalent responder on peer_a that: - Subscribes to airc events - Filters on continuum.body_hint = continuum.command.request.v1 - Parses Body::Json as AircCommandRequest (continuum-airc-protocol) - Constructs AircCommandResponse::ok({echoed_path, echoed_params}) - Replies via airc.reply with the substrate's reply header set (HEADER_COMMAND_STATUS + HEADER_CONTINUUM_BODY_HINT) On peer_b, builds Connection::connect(peer_b_airc, peer_a_id) and calls .commands().execute("debug/ping", {hello, count}). Asserts: result["ok"] == true result["echoed_path"] == "debug/ping" result["echoed_params"] == {hello, count} Every drift surface in continuum-airc-protocol is now exercised: KIND_PEER, DEFAULT_COMMAND_DEADLINE, HEADER_COMMAND_{PATH,KIND,STATUS}, HEADER_CONTINUUM_BODY_HINT, COMMAND_{REQUEST,RESPONSE}_BODY_HINT. If any literal drifts on either side this test fails — caught BEFORE any substrate ships. Verified: cargo test -p airc-test-fixtures → 1/1 pass (0.95s) cargo test -p continuum-client --test airc_ipc_roundtrip → 1/1 pass (0.93s) cargo test -p continuum-client → 6/6 unit + 1/1 integration cargo test -p continuum-airc-protocol → 13/13 pass Closes: - task #187 (TwoAircLoopback fixture) — real impl lands - task #188 (cross-grid command roundtrip integration test) — first test lands - reviewer 1 BLOCK concern from PR #1557 round 1 — wire shape now verified end-to-end, not just by literal duplication of constants. Co-Authored-By: Claude Opus 4.7 <[email protected]>
…se_envelope + send_reply (closes R3 BLOCK) Reviewer 3 on PR #1558 round 1 flagged that the integration test inlined `serde_json::from_value` + manually stamped headers instead of calling the substrate's own `CommandRequestHandler::parse_envelope` + `CommandRequestHandler::send_reply` (which are `pub` for exactly this reason). The result: drift between client's envelope and substrate's parser expectations would NOT fail the test — meaning the "wire shape verified end-to-end" claim was materially overstated. Drifts the previous version would NOT catch: - substrate `parse_envelope` adding/dropping a required header - substrate gating on `kind != KIND_PEER` - substrate's `send_reply` changing the response header set - `AircCommandResponse` serde tag changes Drifts this version DOES catch: - all of the above (substrate's real code is now in the loop) - `request.kind == KIND_PEER` explicitly asserted at line 87-91 - `request.path == "debug/ping"` explicitly asserted - `request.env == None` explicitly asserted Structural changes: - `client/continuum-client/tests/airc_ipc_roundtrip.rs` → moved to `core/continuum-core/tests/airc_ipc_roundtrip.rs`. The substrate is where the real parser lives, so the integration test belongs in the substrate's test crate where it can dev-depend on {airc-test-fixtures, continuum-client} cleanly without making continuum-client transitively depend on continuum-core (which would drag in llama.cpp + metal features for client unit tests). - `client/continuum-client/Cargo.toml` — removed the dev-dependencies block (now empty; airc-test-fixtures + airc-protocol moved to continuum-core's dev-deps). - `core/continuum-core/Cargo.toml` — added dev-deps on airc-test-fixtures, continuum-client, airc-protocol, futures. Responder rewrite: - `build_handler(peer_a)` constructs a bare `ModuleRegistry` + `CommandExecutor` + `CommandRequestHandler::new(peer_a, executor)`. The executor's registry is empty because the test bypasses `process_request` (we want to control the response payload to assert wire bytes, not run a real module's policy gate). - `spawn_real_substrate_responder` calls `CommandRequestHandler::parse_envelope(&event)` on every command request, asserts the three protocol-stable fields (kind, path, env), constructs the canonical `AircCommandResponse::ok` payload, and calls `handler.send_reply(&parsed, &response)` for the reply. If at any point the substrate parser/reply paths drift from the wire shape `AircIpcTransport` sends/expects, this test fails. The `continuum-airc-protocol` crate's drift-prevention purpose is now actually verified, not just asserted by literal duplication of constants. Verified: cargo test -p continuum-core --features metal,accelerate --test airc_ipc_roundtrip → 1/1 pass (0.94s test, 3m49s build cold) Stage 2 of R3's BLOCK concern (#188-prime — separate test for substrate rejection of non-peer kinds) is logged as follow-up; this PR ships the kind-equality assertion which is the load-bearing surface. Co-Authored-By: Claude Opus 4.7 <[email protected]>
2 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes tasks #187 (TwoAircLoopback fixture) and #188 (cross-grid command roundtrip integration test). Closes the wire-shape verification gap adversarial reviewer 1 flagged on PR #1557.
What lands
core/airc-test-fixtures/— new workspace crateShared test fixture for any integration test that needs two real
airc_lib::Aircpeers wired over a LAN loopback. Consumed via[dev-dependencies]so production binaries never link it.TwoAircLoopback::new()walks the canonical 4-step airc setup the substrate's own tests use: two TempDir homes, mutualadd_peer(peer_spec)trust,join(shared_room),peer_b.listen_lan(127.0.0.1:0)+peer_a.connect_lan(addr, peer_b_id). TypedLoopbackErrornames which peer + which step failed when setup goes wrong.client/continuum-client/tests/airc_ipc_roundtrip.rs— integration testSpawns a substrate-equivalent responder on
peer_a(subscribes, filters oncontinuum.body_hint = continuum.command.request.v1, parsesAircCommandRequest, constructsAircCommandResponse::Ok, replies viaairc.reply). Onpeer_bbuildsConnection::connect(...)and calls.commands().execute(). Asserts the typed result echoes back.Every drift surface in
continuum-airc-protocolis exercised:KIND_PEER,DEFAULT_COMMAND_DEADLINE, allHEADER_*constants, bothCOMMAND_*_BODY_HINTvalues. If any literal drifts client and server, this test fails.Verified
Reviewer concern closed
Reviewer 1 on PR #1557 round 1 flagged: there was no live integration test pairing AircIpcTransport against the substrate's command_handler. The protocol crate extraction was meant to prevent drift, but the proof-of-non-drift test was deferred.
This PR lands that test. The
continuum-airc-protocolcrate's purpose (preventing wire drift) is now proven, not just asserted by literal sharing of constants.Test plan