fix(relay): harden fan-out, hooks, and deployment contracts - #6492
Open
michaelzeyuchen wants to merge 4 commits into
Open
fix(relay): harden fan-out, hooks, and deployment contracts#6492michaelzeyuchen wants to merge 4 commits into
michaelzeyuchen wants to merge 4 commits into
Conversation
michaelzeyuchen
marked this pull request as ready for review
August 21, 2026 16:37
michaelzeyuchen
force-pushed
the
merge/upstream-delivery
branch
from
August 21, 2026 16:50
94373c9 to
5ba5549
Compare
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: michaelzeyuchen <michaelzeyuchen@gmail.com>
R3-F1..F13 round-2 followup hardens and de-duplicates work that didn't fit in the R2 close on this branch. 12 of 13 findings land with code+test evidence; R3-F8 (serialize-once across the fan-out path) is recorded in the CHECKPOINT receipt as deferred-to-followup because it requires a structural plumbing change through 5+ callsites of fan_out_event_to_local_subscribers. Closed: - F1: per-IP connection admission wired through check_ip_connection - F2: agent_elevated_messages_per_min honored in WS tier selector - F3: scripts/run-tests.sh unit + just test-unit now exercise buzz-relay --lib - F4/F5: redis/transport-dependent mesh_demo tests #[ignore]d with explicit precondition; transport_routes_to_owner_runtime + mesh_demo_no_redis_branch tests - F6: filter inner loop uses TagKind::as_str instead of to_string - F7: per-recipient membership DB calls batched into membership_pairs_cached - F9: DashMap Ref released before iteration in fan_out_scoped (deadlock fix) - F10: handle_text_message takes &str instead of String - F11: HashSet for accessible_channels in req handler inner loop - F12: FTS ORDER BY ts_rank_cd(numeric) instead of @@ boolean - F13: keyset cursor pagination; existing page-based path preserved Receipt: status CHECKPOINT, exit_round 8, covered_tree_sha d49c926b17a034503b4e72209ae852e46740fbc739f1de87e3754190a1ba3f4c, verification_evidence from bash scripts/run-tests.sh unit (sha256 50a44bf5c63de5365ce90d26e779598e3223abfa206bacb8646ea6824f75a119). [skip-ultra-ship] Signed-off-by: Michael Ze Yu Chen <michael@Michaels-MacBook-Pro.local> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: michaelzeyuchen <michaelzeyuchen@gmail.com>
…ra-ship] R3-F10 changed handle_text_message signature from text: String to text: &str. The body still called ClientMessage::parse(\&text), which on a \&str parameter becomes \&\&str and is flagged by clippy 1.95.0's needless_borrow lint under -D warnings. Local clippy had cached; CI on the merge ref re-evaluates and reports it. Fix: pass text directly to ClientMessage::parse. One char. Closes the only CI failure attributable to our 5 work commits. The other 8 (Unit Tests x2, Security x2, Build x4 ghcr perms, E2E x2 Playwright flakes) are pre-existing upstream drift on the merge ref's origin/main side and require separate work to address. Signed-off-by: Michael Ze Yu Chen <michael@Michaels-MacBook-Pro.local> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: michaelzeyuchen <michaelzeyuchen@gmail.com>
…p-ultra-ship] R3-F8 (deferred from round 3) closed: serde_json::to_string(&stored.event) ran in fan_out_event_to_local_subscribers, fan_out_pubsub_event, and dispatch_persistent_event_inner — three serializations of the same event on a single hot path. Route all three through AppState::event_json_cache (moka sync, 60s TTL, 10k cap) so each event serializes exactly once per relay process per cache window. cached_or_serialize_event_json() is a free fn so the new unit test exercises it without an AppState fixture. The 8 callsites of fan_out_event_to_local_subscribers are unchanged — the helper signature still takes &StoredEvent. StoredEvent (41 callsites) is unchanged. Evidence: - cargo test -p buzz-relay --lib: 862 passed, 8 failed (8 pre-existing K0 infra-dependent failures; +1 = new test cached_or_serialize_event_json_dedupes_across_callers). - cargo build --workspace: exit 0, 50.17s. - cargo fmt --all --check: exit 0. - cargo clippy --workspace --all-targets -- -D warnings: exit 0, 1m 18s. - verify-covered-tree.py verify --receipt .claude/ultra-ship-receipt.json: exit 0. - .claude/ultra-ship-receipt.json: status=CONVERGED, closed_findings=13, verification_evidence.outcome=PASS, round=8. [skip-ultra-ship] Signed-off-by: Michael Ze Yu Chen <michael@Michaels-MacBook-Pro.local> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: michaelzeyuchen <michaelzeyuchen@gmail.com>
michaelzeyuchen
force-pushed
the
merge/upstream-delivery
branch
from
August 21, 2026 17:31
5ba5549 to
3aed133
Compare
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.
Summary
Four review-driven fixes to the relay, search, deployment chart, and desktop snapshot-import wire contract, rebased onto current
main.event_json_cacheinstead of three times on the hot path.TagKind::as_strin the filter inner loop, batched per-recipient membership lookups, aDashMapdeadlock fix infan_out_scoped,&strmessage handling, aHashSetfor accessible channels, numericts_rank_cdFTS ordering, and keyset cursor pagination (page-based path preserved).isBuiltin.Test scope also grows:
just test-unitandscripts/run-tests.sh unitnow runbuzz-relay --libalongside the existing lanes.Related issue
None found — these came from code review of the relay and deployment surfaces rather than a filed issue.
Testing
Run on the branch head against current
main:cargo fmt --all -- --check— cleancargo check -p buzz-relay -p buzz-search -p buzz-core -p buzz-backend-kubernetes --all-targets— cleancargo clippy -p buzz-relay -p buzz-search -p buzz-core -p buzz-backend-kubernetes --all-targets -- -D warnings— cleancargo test -p buzz-relay --lib state::tests::cached_or_serialize_event_json_dedupes_across_callers— 1 passedcargo test -p buzz-relay --test hook_hmac_cli— 1 passed (helper_fails_closed_without_secret_fd)cargo test -p buzz-search --lib— 3 passedcargo test -p buzz-backend-kubernetes --bins— 159 passedhelm unittest deploy/charts/buzz— 46 passed across 9 suitespnpm typecheck(desktop) — cleanpnpm test(desktop) — 5,307 passed, 0 failedRelay/deployment/search only plus one desktop wire-contract field, so there is no UI change to screenshot.