Pin a churn-fixed P2P engine and shrink peer cards in a Rust agent-mesh daemon
Discovered from README cross-links · today
Bump engine pin, add churn repro tests, cut peer card size 62%.
What they did
The author fixed the app side of a peer-churn and wrong-live-peer-count bug in a Rust agent-mesh daemon. The real fix lived in the engine repo (habilis-network PR 47, covering H1, H4, H5 and H6), so this PR pins the engine to that PR's head commit `16cfe874f5425840fd712e4f693a6f23d9772710` in `Cargo.toml` line 47 and `Cargo.lock`, replacing the old pin `40eef70c`. They added red repro tests for the churn bug in `tests/churn_repro.rs` and a changeset file. They also shrank the peer card: `own_card()` now returns a minimal card, dropping one card from 1940 B to 742 B (about 62% less), 5 peers from ~9.7 KB to ~3.7 KB, and 35 peers from ~67.9 KB to ~26.0 KB. Served cards are rebuilt by `full_from_minimal` in `a2a/card.rs`, keeping the stored endpoint and extensions, restoring known extension descriptions, and filling static fields from the local full card; a stored card that cannot be rebuilt is served as stored. They verified with a long test run (`scratchpad/long-16cf.log`, resolved rev on line 1, cargo finished in 360.84s) where six churn tests passed in one batch and 19 of 19 card tests passed, including a per-peer byte budget test that was red at 1938 B and green at 742 B. Clippy with `-D warnings`, style-check and fmt were clean, and CI jobs (adversarial, clippy, doc, fmt, style, test 1-3, wasm) passed. They checked 0.12.10 reader compatibility: the minimal card has all 8 fields `AgentCard` requires, and old full cards rebuild to themselves. They worked through multiple CodeRabbit review rounds, fixing a file-header lint issue with `#![expect(missing_docs, reason = ...)]`, splitting long doc paragraphs, and strengthening the late-joiner test to poll up to 60s for both nodes to report 9 peers instead of only checking equality. They reprinted the 0.12.10 fixture from a clean worktree because the earlier one had `dirty:true`.
How it went
All targeted tests pass: six churn repro tests in one 360.7s batch and 19 of 19 card tests, with the byte-budget test green at 742 B. Clippy, style-check, fmt and all CI jobs pass. The PR went through at least nine CodeRabbit review rounds with findings fixed or explicitly skipped. Known limits are documented: mixed-mesh 0.12.10 peers serve degraded minimal cards until upgraded, and a live peer can be listed as absent for up to one alive interval.
Worth knowing
The engine fix itself is in a separate repo (habilis-network PR 47) and the pin must move to the merge commit once that PR merges. Several gaps are explicitly not covered: `meta get` and MCP `get_meta` can list a live peer as absent for up to one alive interval because `meta_get_response` builds the live set from roster rows and `SessionRequest::MetaGet` returns only the document; skill text, directory advert `live_count` and MCP mesh info are untested for the count; H7 (two live keys per nickname) is open in the engine; and the frame-cut tests pass but their fixture builds the full card, so the cut is not expected to run in production. The rebuild overwrites skills, modes and securitySchemes with the local template, so older peers show the local version's skills.
Wiring
The engine is a separate crate pulled in by git rev: `Cargo.toml` line 47 holds the pin and `Cargo.lock` records the resolved rev. The app calls `own_card()` to produce the minimal card stored in the meta document; when serving, `full_from_minimal` in `a2a/card.rs` rebuilds it using the local full card as a template, and `complete_card` parses the stored card first so the unparseable branch never runs from the peer-card RPC. Churn tests live in `tests/churn_repro.rs` and run with `--include-ignored` for the long ones; card tests live in `a2a::card`. The changeset file `.changeset/pin-engine-churn-count.md` drives the patch release. CI runs adversarial, clippy, doc, fmt, style, test 1-3 and wasm jobs, plus CodeRabbit on the ready PR.
Try it yourself
Look at this repo's peer card code and engine pin. Do three things in one PR: (1) bump the habilis-network pin in Cargo.toml and Cargo.lock to the churn-fixed engine head, (2) add red repro tests in tests/churn_repro.rs for peer churn and wrong live-peer counts, including a late-joiner test that polls up to 60s until both nodes report the same expected count rather than only asserting equality, and (3) make own_card() return a minimal card and add a full_from_minimal rebuild in a2a/card.rs that keeps the stored endpoint and extensions, restores known extension descriptions, fills static fields from the local full card, and serves unparseable stored cards as stored. Add a per-peer byte budget test (budget 800) and a test that a real 0.12.10 card rebuilds to itself. Run clippy with -D warnings, style-check and fmt, and document the mixed-version limit where old peers serve degraded minimal cards.