Repository navigation
test: prune duplicated and vacuous tests (test-audit pass) - #1425
Conversation
Applies the openclaw test-audit rubric: one owner per contract, no assertions that can't fail, no copied inventories. No production changes. - Delete replays of contracts owned elsewhere (sidecar guards, binding warning matrix, private-key builders vs golden fixture, slow-op no-op, old bearer-path checks, duplicate source grep, abuse dupes). - Retire apps/api/test/budget.test.ts into src/budget.test.ts, keeping the stronger BYO shared-vs-total fixture. - Pin vacuous status checks (not.toBe(415/409), 4xx ranges) to the real 400 + error code; fix the always-true abuse rate-cap test. - Use the real hasLinkCandidate in the webhook queue mock. - Fold copy-pasted pairs into it.each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeLbkfpUvucSWi2KdUJNkR
|
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 2
🚫 Excluded labels (none allowed): 1
Please check the settings in the CodeRabbit UI or the
|
No production caller; the live gate is byoBucketAllowed in apps/api. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeLbkfpUvucSWi2KdUJNkR
Requested by Zach · project thread
A second housekeeping pass on the test suite, judged by the openclaw
test-auditrubric: each contract gets one owner at its strongest boundary, assertions must be able to fail, and copied inventories go. The only production change removes the unusedplanAllowsByoBucketpredicate. Net change: −986 / +118 lines across 39 files.Before removing anything, I checked that a stronger test still covers the contract. Authorization, secret-masking, OpenAPI drift, Analytics Engine blob order, golden render parity and the PR #1284 keep list are all untouched.
Deleted: the contract is already owned elsewhere
Web
pages-reachability.test.ts: the test wraps a stub handler and then asserts the stub's own title, so the value it checks comes from the mock. It also never touches ASSETS orrun_worker_first.markdown-negotiation.test.tsowns the passthrough.proxy-transport.test.ts:withInheritedCookieis already proven through the realserverApiFetch/serverAuthFetchinapi-proxy.test.tsandauth-proxy.test.ts.API
abuse-email.test.ts: two tests that duplicatetest/abuse.test.ts.github-webhook-reconcile.test.ts: a byte-identical copy of the "never imports a binding writer" source grep ingithub-webhook-auto-promote.test.ts.github-promote.test.ts: a builder sanity check. The golden fixtures already pin it.session-auth.test.tsandworkspace-server-timing.test.ts: the "SLOW_OPS absent" checks. OnlywriteSlowOpPointreads that binding, and its own unit test covers it.routes/tokens.test.ts: "no GitHub login". This helper edge case is owned byworkspace-suggestion.test.ts.test/key-policy.test.ts: a weaker regex copy offiles-core-keys.test.ts.routes-workspace-{github,usage,files}.test.ts. The dedicated suites (routes-github-private-prefix*,routes-usage,routes-files) hit the same paths on the same app with stronger assertions./mecomment-settings PATCH.me.test.tscovers the echo and the persist, and the session-once test covers the alias.MCP
mcp.test.ts: the hard-coded list of 35 tool names. Themcp-tools.jsonfile snapshot already pins every name, scope and param.Billing
planAllowsByoBucketand its test (byo-bucket.ts,byo-bucket.test.ts). No production code called it, and the test assertedtruefor a predicate that returnstruefor every input. The live gate staysbyoBucketAllowedin apps/api. ThePLANS.*.byoBucketfield stays, so a Pro-only switch can still be flipped there.getPlanandresolveEffectiveLimitsdelegate cases.CLI
github.test.tsprivate-key builders and parsers (16 tests). Every case is a row ingithub-comment-golden-private-keys.json, whichgithub-render-golden.test.tsalready asserts.readSidecarMeta, andsidecar.test.tsowns them.other/self/absentrows. These replay theresolveStageBindingWarningmatrix that the attach suite owns.commands-staged.test.ts"strict superset" test. It builds its own fake client to re-prove the attach warning text and the staged message, both of which are already tested.cli-completion"includes update/changelog/docs" (an inventory check that never generates a script). Alsocli-help"update in essentials" and the vacuousconfig-inittest.comment-config.test.tssmoke subset. These cases are already in the canonical package and the golden table.mcp.test.tsinline tool-name list. Themcp-tools-local.jsonsnapshot pins it.Merged
apps/api/test/budget.test.tsis retired intosrc/budget.test.ts. Its unique cases moved over: 507/429 statuses, shrink/overwrite, BYO residue over the cap, unlimited omits fields,uploadsRemaining.srcfixture hadbytes == sharedBytes, so it couldn't tell the two apart.it.each:updateNotify*inauth-client.test.ts, and the 503/429 retry inclient-resilience.test.ts.Fixed: assertions that couldn't fail
abuse-email.test.tsrate-cap test: it wasexpect(true).toBe(true). It now asserts that no send and no KV write happen, and thatnotify-rate-cappedis logged.routes-files.test.tssign tests:not.toBe(415)andnot.toBe(409)would also pass on a 401 or 500. They now pin400 presign_unavailable.routes-github-private-prefix*.test.ts: the "4xx + error defined" checks would pass on an auth 401/403. They now pin400plusvalidation_errororinvalid_repo.github-webhook-auto-promote.test.ts: the assertion-free "no binding" test is folded into the unbound-repo test, which now also asserts nothing was promoted.github-webhook-queue.test.ts: the mock re-implementedhasLinkCandidate, so the adopt cases were testing the copy. It now spreads the real module.Verification
pnpm typecheckandpnpm lintare clean, and CI is green.pnpm testrun:apps/web/src/lib/auth-proxy.test.ts"settles with a synthetic 503…". It failed the same way onmainlocally and passes in CI. The local run used Node 22, and the repo wants Node ≥ 24.Left for later (not in this PR)
packages/comment-confighand-written parser tests largely duplicate its golden table (two assertions would need to become rows first).it.eachfolds: MCP "usage errors" tests, attach "is silent" binding rows, auth-client cookie pairs,storage_misconfiguredcases.client-*tests are the de facto SDK contract tests. Move them topackages/sdkrather than delete them.packages/storage/test/s3-live-smoke.test.tssays "not committed — run manually, then delete" but is committed (always skipped).🤖 Generated with Claude Code
https://claude.ai/code/session_01KeLbkfpUvucSWi2KdUJNkR