Skip to content

Remove duplicate server tests and the dead code they kept alive - #4375

Merged
SawyerHood merged 1 commit into
mainfrom
bb/test-audit-server-thr_s3kmw74uzx
Sep 25, 2026
Merged

SawyerHood merged 1 commit into
mainfrom
bb/test-audit-server-thr_s3kmw74uzx

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Many server, db, domain and contract tests duplicated a stronger test at the owning boundary. Examples:

  • three "Unsupported tool" variants that hit the same fallback branch;
  • twin public-thread and thread-parent tests;
  • ten "ships X enabled/disabled" builtin tests.

Others pinned incidental literals, such as exact gzip byte counts in payload-size.test.ts and copied icon and logo lists. Some couldn't fail at all: a check for a connect route that doesn't exist, and a "migrates without throwing" test that every db test already repeats.

A few kept dead production code alive:

What changed

Found by a read-only test audit using the repo test-audit skill (#4361).

  • Dead production code removed, with its tests:
    • hasCompletedEventLoopWorkForTests
    • pruneThreadEventsBeforeSequence and its transaction variant. The other prune wrappers are unchanged.
    • claimQueuedThreadMessage. Test call sites use claimQueuedThreadMessageGroup with { kind: "explicit-send" }.
    • isAgentDelegatedChildThread, inlined.
  • Tests rewritten or moved:
    • The randomized timeline-context-order-cache test now prunes through the live advanceThreadPruning path, and asserts that rows are actually pruned.
    • createHostDaemonClient moves into its only user, internal-session-protocol-version.test.ts. The wire schema is unchanged, so no HOST_DAEMON_PROTOCOL_VERSION bump.
  • Duplicates folded into their keepers or tables: the builtin plugin defaults, requestMatchesEntityTag cases and pending-interaction reason.
  • Not in this PR: the thread_dynamic_context_file_states table (no writer since Remove dead code and simplify module surfaces #2140) and its schema test. Dropping it needs a migration decision.

Production +1/−117, tests +137/−1555.

How you verified

  • pnpm exec turbo run test lint typecheck passes for @bb/server, @bb/db, @bb/domain, @bb/server-contract and @bb/host-daemon-contract.
    • The only failures were @bb/server timeouts at load average 40. The base commit shows them too, and they pass when rerun alone.
    • oxlint's no-comments errors match base.
  • An independent verifier used before and after worktrees on 175d5ac. For each removed test it wrote the bug that test catches as a production change, then checked that the old test fails and a remaining test also fails.
    • Result: 44 OK, 5 with no unique failure mode, 0 lost.
    • Builtin plugin icon names stay covered by PluginIcon.test.tsx ("resolves every named branding.icon the shipped plugins declare").
    • Both isParentNotifiableChildThread clauses stay caught.

AGENT GENERATED

🤖 Generated with Claude Code

Remove server, db, domain and contract tests that duplicate stronger
owner-boundary tests, pin incidental literals, or cannot fail, together
with the dead production code only those tests reached:
hasCompletedEventLoopWorkForTests, pruneThreadEventsBeforeSequence and its
transaction variant, claimQueuedThreadMessage, and isAgentDelegatedChildThread
(inlined). The isParentNotifiableChildThread unit tests stay because no
boundary test reaches the fork-with-parent clause.

The randomized timeline-context-order-cache test now prunes through the
live advanceThreadPruning path and asserts that it removes rows. Claim
fixtures use claimQueuedThreadMessageGroup with an explicit-send policy.
The test-only createHostDaemonClient moves from the host-daemon-contract
source into its one server test; the wire schema is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@SawyerHood
SawyerHood merged commit c6b24ed into main Sep 25, 2026
18 checks passed
@SawyerHood
SawyerHood deleted the bb/test-audit-server-thr_s3kmw74uzx branch September 25, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant