Skip to content

test(core): direct unit tests for ConnectionApproval's admission and fallback behaviour - #122

Merged
Mearman merged 1 commit into
mainfrom
test/connection-approval-mutation-coverage
Sep 15, 2026
Merged

Mearman merged 1 commit into
mainfrom
test/connection-approval-mutation-coverage

Conversation

@Mearman

@Mearman Mearman commented Sep 15, 2026

Copy link
Copy Markdown
Member

Summary

  • ConnectionApproval was only exercised indirectly through approval.integration.test.ts's end-to-end transport scenarios, leaving several individual branches, error messages, and fallback string literals unobserved.
  • Adds a direct DI-based unit test file using ConnectionApprovalDeps' fake collaborators, covering handleConnectionRequest's queued delivery event and live push, accept/reject's not-pending error messages, connectToRemote's name/fingerprint fallback when no local agent is registered and its fire-and-forget rejection handling, startDataServerOnly's PeerInfo recording and unref call, and listPendingConnections' entry lifecycle.
  • Raises src/core/connection-approval.ts's mutation score from a freshly-measured 54.55% (12 killed, 10 survived) toward the repo's 80% threshold.

Closes #105

Test plan

  • pnpm typecheck
  • pnpm lint
  • pnpm test (61 files, 438 tests, full suite green)

…our directly

ConnectionApproval was previously exercised only indirectly through
approval.integration.test.ts's end-to-end transport scenarios, leaving
several individual branches, error messages, and fallback string literals
unobserved. ConnectionApprovalDeps is a narrow, injectable surface built
exactly for direct testing: a fake deps object with vi.fn() collaborators
asserts on handleConnectionRequest's queued delivery event and live push,
accept/reject's not-pending error messages, connectToRemote's name/fingerprint
fallback when no local agent is registered yet and its fire-and-forget
rejection handling, startDataServerOnly's PeerInfo recording and unref call,
and listPendingConnections' entry lifecycle.
@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:08:43.135272Z ac42140 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.

@Mearman
Mearman merged commit 76e04a4 into main Sep 15, 2026
6 checks passed
@Mearman
Mearman deleted the test/connection-approval-mutation-coverage branch September 15, 2026 08:12
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.21.12 🎉

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/connection-approval.ts mutation score to 80%

1 participant