Skip to content

test(core): direct unit tests for FederationBridge's fed:-prefix and filtering logic - #124

Merged
Mearman merged 2 commits into
mainfrom
test/federation-bridge-mutation-coverage
Sep 15, 2026
Merged

Mearman merged 2 commits into
mainfrom
test/federation-bridge-mutation-coverage

Conversation

@Mearman

@Mearman Mearman commented Sep 15, 2026

Copy link
Copy Markdown
Member

Summary

  • FederationBridge was only exercised indirectly through end-to-end federation.integration.test.ts scenarios, leaving many individual branches, the fed:-prefix startsWith-vs-endsWith distinction, and getVisibleAgents/getFederatedRoomMemberships' filtering unobserved.
  • Adds a direct DI-based unit test file covering onAgentVisible's fed:@ key and federated tag, onAgentGone's prefix-match gating (including a case designed to distinguish startsWith from endsWith), onRoomMessage/onRoomJoin/onRoomLeave's federated-room gate and shadow-member bookkeeping, and getVisibleAgents/getFederatedRoomMemberships' fed:-prefix filtering.
  • Raises src/core/federation-bridge.ts's mutation score from a freshly-measured 42.86% (24 killed, 32 survived) toward the repo's 80% threshold.

Closes #107

Test plan

  • pnpm typecheck
  • pnpm lint
  • pnpm test (63 files, 467 tests, full suite green)

… directly

FederationBridge was previously exercised only indirectly through
end-to-end federation.integration.test.ts scenarios, leaving many
individual branches, the fed:-prefix startsWith-vs-endsWith distinction,
and getVisibleAgents/getFederatedRoomMemberships' filtering unobserved.

FederationBridgeDeps is a narrow, injectable surface built exactly for
direct testing: a fake deps object with vi.fn() collaborators asserts on
onAgentVisible's fed:<id>@<harness> key and federated tag, onAgentGone's
prefix-match gating (including a case that ends with but doesn't start
with the prefix, to kill a startsWith-vs-endsWith mutant), onRoomMessage/
onRoomJoin/onRoomLeave's federated-room gate and shadow-member bookkeeping,
and getVisibleAgents/getFederatedRoomMemberships' fed:-prefix filtering
(with the same prefix-position distinction).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-15T08:59:55.195151Z e95019e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…valent Map.set mutants

Verified against a fresh mutation run: onRoomLeave's refreshMembership
call had no assertion at all, a real gap distinct from the three
Map.set-after-in-place-mutation equivalents the same run also surfaced.
@Mearman
Mearman merged commit 884170b into main Sep 15, 2026
6 checks passed
@Mearman
Mearman deleted the test/federation-bridge-mutation-coverage branch September 15, 2026 09:12
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.21.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Raise src/core/federation-bridge.ts mutation score to 80%

1 participant