Repository navigation
test: raise unit test coverage to 100% and enforce it - #1632
Merged
Merged
Conversation
…erage Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…outes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ialog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…el downloads Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alogs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ve dialog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…strument card Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…efaults Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…strument-stubs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… summary fixtures Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e counts each function once Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge from localhost Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eir agent docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 5, 2026
Open
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.
Raises unit-test coverage from about 50% to 100% on every metric across
apps/{api,gateway,web}andpackages/*, then makes 100% the gate locally and in CI.Coverage
By workspace (lines / branches)
apps/apiapps/gatewayapps/webpackages/demopackages/instrument-bundlerpackages/instrument-interpreterpackages/instrument-librarypackages/instrument-stubspackages/instrument-utilspackages/licensespackages/playground-urlpackages/react-corepackages/release-infopackages/runtime-bundlerpackages/runtime-corepackages/runtime-internalpackages/runtime-metapackages/schemaspackages/serve-instrumentpackages/subject-utilspackages/vite-plugin-runtime"Before" is the
c6bf765b4run, recomputed under this PR's coverage scope (see below). The before denominators are larger: they include the phantom SWC entries fixed here and the dead code deleted here. Now 392 test files and 4,392 tests, plus 5it.failspinning filed bugs.What changed
Unit tests under each workspace's
__tests__/, one commit per batch (test(<scope>): …). Each batch was written by one agent, reviewed by a second, adversarial agent and fixed before it was committed.Dead code removed (
refactor(api|web|react-core|instrument-utils|runtime-internal)). The last ~50 uncovered branches were code no input can reach. Each was proved dead from the types, every caller, or the library contract, then deleted or restructured so the impossible state cannot be written.tsc, the unit suite and e2e confirm nothing reachable went:onOpenChangeon dialogs without a trigger (Radix only ever passesfalse);?? []/?? {}fallbacks on non-null values;.otherwise(() => null)after exhaustive matches, now.exhaustive();inttype name.One deletion was wrong and a test caught it before commit: a preview code path shared the expression. It was restored.
fix(api): the in-memory replica set is now stopped on shutdown (In-memory replica set is never stopped when the api shuts down under NODE_ENV=test #1651).Enforcement:
coverage.thresholds: { 100: true }.pnpm test:coverage.AGENTS.mdhard rule: uncoverable code is proved dead and deleted, never ignored or excluded. "Before you are done",odc-done,odc-testing, the testing strategy and the playbooks now namepnpm test:coverage.New vitest projects for
runtime-core,instrument-libraryandinstrument-stubs.instrument-librarymaps/runtime/v1/*imports to source, so its tests need no build.Catalog devDeps:
happy-domand@testing-library/{react,dom}added togateway,runtime-coreandinstrument-library, plusreact/react-domworkspace links ininstrument-library.pnpm installalso bumped@testing-library/dom10.4.1 → 10.4.2 andws8.21.0 → 8.22.0 in the lockfile.Coverage scope: excludes test fixtures and helpers (
__tests__,__mocks__,apps/web/src/testing), the generatedroute-tree.ts, and the bare entrypoints (webmain.tsx, gatewayentry-client.tsxandmain.ts).apps/api/vitest.config.ts: SWC now transforms onlyapps/apisources. Before this, SWC also transformed the workspace packages the api imports, and the merged report counted each of their functions twice with one copy never hit.packages/react-core/vitest.config.ts: sets happy-dom'sdisableIframePageLoading, soInteractiveContenttests no longer make real requests tolocalhost:3000.Bugs found
Verified and filed as #1633–#1653. #1651 is fixed in this PR. The others are pinned by tests:
it.failsasserts the correct behaviour, and the remaining tests are named as defects. Each issue says which test to flip when it is fixed.Verification
pnpm lint: green (34/34 tasks).pnpm test:coverage: green at 100% on all four metrics.vitest list --filesOnlycollects every added test file.pnpm test:e2e: 277/277 passed.Exception: no new
testing/spec. The tests and the dead-code removal change no reachable behaviour, and the existing suite passes unchanged.Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com