Repository navigation
test: remove ineffective coverage and strengthen regression guards - #872
Conversation
Audit 811 test-bearing files and remove 169 declarations that only check test infrastructure or source spellings, cannot distinguish relevant regressions, or do not exercise their stated behavior. Preserve runtime and configuration coverage, including the named broker matrix cases. Document five surviving mutation probes, removal reasons and verification limits in test-audit.md.
dustywusty
left a comment
There was a problem hiding this comment.
Most of the audit holds up. Roughly 80% of the removals can go: source-string checks, tests that can't fail, and self-matching include_str! checks. A handful of deletions remove the only guard on something real, though, and one of the stated reasons is wrong. Requesting changes for those.
The underlying disagreement
test-audit.md:77 says the criterion was "executed end-user product behavior". Lint, architecture and test-infrastructure guards were cut by definition, not because they failed to work. Several of them were the only protection for a production rule or for CI itself. That criterion is worth agreeing on before we merge this.
Blocking
- It conflicts with main and CI never ran. #861 edited
assertion-shape.test.ts, which this PR deletes. No checks ran on the branch, so the Proof table is from local runs only (Bun 1.4.2 against the pinned 1.4.3, and no Cargo). - Real guards deleted with nothing replacing them. For each one I grepped for surviving coverage and found none.
brokered-provenance.test.ts. The audit row says "test-authoring conventions… synthetic snippets", but test 1 scans productionserver/src/plugins. It was added after an Arcade bug shipped:store.tshard-codedcomposio://${toolkit}and every Arcade connection disappeared from settings.access.tsstill says this test enforces the rule.server/tests/support/database.test.ts. It stops the test helper from using the liveopenbotdatabase. Integration tests TRUNCATE tables.scripts/test-ci.test.ts. It is the regression test for #451 (exit-code and stderr passthrough).test:ciis still the CI gate (ci.yml:372).bunfig-preload.test.ts. If the root and server preload lists drift, test files drop out silently.MINIMUM_TESTS = 400won't notice when about 5.6k tests normally run.test-network-guard.test.ts. The guard is still loaded, but nothing proves it blocks anything. Its first version leaked throughhttps.getandBun.fetch. If it regresses, tests could make live vendor calls with a developer's keys.scripts/mutation-register.test.ts. It was the only CI check on that tool;test:mutationsisn't inci.yml.
- Replace these before deleting them. The mutation findings are correct, but deleting the test leaves the mutation passing.
- PKCE S256.
plugin-oauth-callback.test.ts:155still lets a constant challenge pass. The RFC 7636 Appendix B vector fixes that. - Skills checksum.
skillsis hashed attenant-package.ts:787, but no test checks that editingskills.yamlchanges the checksum. Theagents/test attenant-package-agent-files.test.ts:189is the pattern to copy. - Component store. The removed integration test was weak, but it was the only one that ran the component data functions' SQL against Postgres. Strengthen it instead.
- People search.
escapeLikeandMAX_PAGEinpeople/store.tsnow have no tests. Fix the fixtures (seed a name like "NinetyX Percent" and more than 200 rows) rather than drop the coverage. - Compose migrator.
servicesis already parsed incompose.test.ts, soexpect(services.migrate.command).toEqual(["bun","scripts/migrate.ts"])is one line.
- PKCE S256.
Should fix
assertion-shape.test.ts. It catches exactly the defect this PR is about. Its only problem is an allowlist keyed by line number, which is also why this conflicts with main. Restored at this head, it fails only on lines this PR shifted. Keying it by expression, asmutation-register.ts:39-42already recommends, fixes it without deleting it.- Known audit gaps. The ledger test was the only record of 13 sign-in-flow transitions that don't write audit rows. Please move that list to an issue.
test-audit.md. It records details of one run (Bun version, memory monitoring, counts), so it belongs in the PR description rather than at the repo root.- Transcript memo test. The
.comparetest intranscript-attachmentscould actually fail if the comparator were dropped, so keep it.
Stale references to deleted tests
None of these files are in the diff, so I couldn't comment inline. Each comment cites a deleted test as the thing that enforces a rule. Either restore the test or reword the comment so it doesn't claim enforcement that no longer exists.
The rule they describe is now unenforced:
- server/src/plugins/access.ts:28 (
brokered-provenance.test.ts) - server/src/plugins/access.ts:232 (
brokered-provenance.test.ts) - server/src/plugins/access.ts:285 (
brokered-provenance.test.ts) - server/src/plugins/plugin-store/servers.ts:1131 (brokered-provenance)
- server/scripts/test-network-guard.ts:69 (
test-network-guard.test.ts) - server/scripts/test-network-guard.ts:130 (
test-network-guard.test.ts) - server/bunfig.toml:11 (
bunfig-preload.test.ts; the path was already wrong, and it now points at nothing) - server/src/plugins/route-groups/connections.ts:1624 (
pending-authorization-audit-ledger.test.ts; the 13 known gaps lived there) - server/src/plugins/plugin-store/context.ts:1894 (
sole-definition.test.ts) - app/src/lib/lookup.ts:16 (
sole-definition.test.ts)
Behavior is still covered for today's brokers, but the comment is stale:
- server/src/plugins/broker.ts:660 (
broker-authorization-pairing.test.ts)
Stale wording only:
- scripts/mutation-register.ts:41-42 (
assertion-shape.test.ts,sole-definition.test.ts) - server/tests/support/stub-broker.ts:11 (
broker-stub-ratchet.test.ts) - server/tests/composio-connect-adopts-held-account.test.ts:310 (
fixture-identity-distinct.test.ts)
Fine as is
- Rust. The deletions look clean under
clippy --all-targets -D warnings: nothing is left unused. The two that looked risky are covered more strictly elsewhere.stopping_names_the_harness_profilematched its own string; the Stop test's fake engine atmain.rs:6353covers that behavior.the_login_program_prints_the_whole_storeis covered byplan.rs:1039. - Also fine to delete: crewai token restoration (it was testing pytest's monkeypatch), the model-spec source checks, the composio and arcade completeness tables, the computer-client signal checks, and the audit trigger scans (covered by
audit-retention.integration).
dustywusty
left a comment
There was a problem hiding this comment.
Thanks, this addresses everything from my earlier review.
- Restored guards. brokered-provenance, test-database refusal, test-ci, bunfig preload, mutation-register and source-scan are byte-identical to the originals. The network-guard test has one small type-only cleanup.
assertion-shape. Keying exceptions by expression plus the enclosing test fixes the line-number brittleness without losing the check.- Mutation checks. I broke the code locally and confirmed the new tests catch it:
- PKCE fails when the challenge is the constant RFC example, and when the encoding is
base64instead ofbase64url. - The skills checksum test fails when
skillsis dropped from the hash.
- PKCE fails when the challenge is the constant RFC example, and when the encoding is
- People search and component store. I couldn't run these (no local Postgres), but from reading them they would now fail if the code broke: the underscore and percent fixtures, the 201-row page cap, and exact rows with the 1–50 limit clamp for the component functions. CI runs them.
- Stale references. None remain. The
connections.tscomment now points at #876. channel-new-error-state. Switching frommock.moduleto restorable spies makes sense; it fixes the mocks leaking into later suites.
Approving.
Takes #872's removal of the form-submit source test, and keeps the demonstrations entry out of the assertion allow-list, since this branch removes that feature and its test.
Takes #872's allow-list format, which matches an entry by its test and expression rather than its line, with the expressions this branch changed (seats instead of bare Bot ids) and the cleared enterprise-controls entry removed.
Anthropic's SDK 2.x sends the key as Authorization: Bearer instead of x-api-key. Same change as main's #872.
What this changes
Removes ineffective coverage while retaining tests that protect users indirectly through database safety, network isolation, CI reliability, and production architecture rules. Production behavior is unchanged.
The initial audit covered 811 test-bearing files. After review, the cleanup deletes 13 complete test files and removes individual source-spelling checks, self-matching assertions, mock-only checks, and misleading cases elsewhere.
Review corrections
Where it runs
No new persistent state, serialization, browser fan-out, listener, port, or schedule. Both replicas run unchanged production behavior.
Boundary and audit
Gateway enforcement, refusal/failure auditing, and client trust boundaries are unchanged. The existing missing lifecycle audit events remain tracked in #876.
Changelog
No changelog entry: this changes tests and comments, with no deployment behavior change.
Proof
Latest main merge
Merged main at
f678b330while preserving the approved audit changes. The two conflicts were a deleted form-source guard and obsolete line-number metadata in the assertion guard. Validation after this merge: 56 focused tests passed; full formatting/lint, all six workspace typechecks, the existing server test-type baseline, and app/extension builds passed. Heavyweight checks ran sequentially (34–41% free memory). The earlier full-suite counts below predate this merge; CI reruns on the updated PR head.Validation uses pinned Bun 1.4.3 after a frozen-lockfile dependency install. Heavyweight checks run sequentially, with memory monitored.
The focused-suite counts overlap the full app/server runs; they are not additive. The full server run preceded the final skins merge; the changed preferences suites and assertion/provenance guards were rerun afterward. The full app run includes that merge.
Eight temporary production mutations were all caught by assertions: arbitrary and RFC-example constant PKCE challenges; skills omitted from the checksum; removed people page cap; unescaped wildcard search; unbounded component arguments; removed component time filtering; and removed refusal filtering. Every production mutation was reverted.
Limits: Rust was not compiled/run locally because Cargo is unavailable. Live vendor/browser/deployment suites remain opt-in. Unchanged Python framework integration suites were statically reviewed; the 33 edited Python model-spec cases passed during the original audit. This is a semantic audit plus selected mutation proofs, not exhaustive mutation testing.