Skip to content

test: prune duplicated and vacuous tests (test-audit pass) - #1425

Merged
Zach Dunn (zachdunn) merged 2 commits into
mainfrom
claude/project-thread-trmsu6
Nov 20, 2026
Merged

Zach Dunn (zachdunn) merged 2 commits into
mainfrom
claude/project-thread-trmsu6

Conversation

@zachdunn

@zachdunn Zach Dunn (zachdunn) commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Requested by Zach · project thread

A second housekeeping pass on the test suite, judged by the openclaw test-audit rubric: 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 unused planAllowsByoBucket predicate. 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 or run_worker_first. markdown-negotiation.test.ts owns the passthrough.
  • proxy-transport.test.ts: withInheritedCookie is already proven through the real serverApiFetch/serverAuthFetch in api-proxy.test.ts and auth-proxy.test.ts.

API

  • abuse-email.test.ts: two tests that duplicate test/abuse.test.ts.
  • github-webhook-reconcile.test.ts: a byte-identical copy of the "never imports a binding writer" source grep in github-webhook-auto-promote.test.ts.
  • github-promote.test.ts: a builder sanity check. The golden fixtures already pin it.
  • session-auth.test.ts and workspace-server-timing.test.ts: the "SLOW_OPS absent" checks. Only writeSlowOpPoint reads that binding, and its own unit test covers it.
  • routes/tokens.test.ts: "no GitHub login". This helper edge case is owned by workspace-suggestion.test.ts.
  • test/key-policy.test.ts: a weaker regex copy of files-core-keys.test.ts.
  • Old bearer-path checks in 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.
  • The /me comment-settings PATCH. me.test.ts covers 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. The mcp-tools.json file snapshot already pins every name, scope and param.

Billing

  • planAllowsByoBucket and its test (byo-bucket.ts, byo-bucket.test.ts). No production code called it, and the test asserted true for a predicate that returns true for every input. The live gate stays byoBucketAllowed in apps/api. The PLANS.*.byoBucket field stays, so a Pro-only switch can still be flipped there.
  • Duplicate getPlan and resolveEffectiveLimits delegate cases.

CLI

  • github.test.ts private-key builders and parsers (16 tests). Every case is a row in github-comment-golden-private-keys.json, which github-render-golden.test.ts already asserts.
  • Sidecar hash and malformed guards in put and attach. They live in readSidecarMeta, and sidecar.test.ts owns them.
  • Put's binding-warning other/self/absent rows. These replay the resolveStageBindingWarning matrix 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). Also cli-help "update in essentials" and the vacuous config-init test.
  • comment-config.test.ts smoke subset. These cases are already in the canonical package and the golden table.
  • The mcp.test.ts inline tool-name list. The mcp-tools-local.json snapshot pins it.

Merged

  • apps/api/test/budget.test.ts is retired into src/budget.test.ts. Its unique cases moved over: 507/429 statuses, shrink/overwrite, BYO residue over the cap, unlimited omits fields, uploadsRemaining.
    • The BYO "allowed" case now uses the stronger fixture, where total bytes far exceed the cap but shared bytes don't. The old src fixture had bytes == sharedBytes, so it couldn't tell the two apart.
  • Copy-pasted pairs are now it.each: updateNotify* in auth-client.test.ts, and the 503/429 retry in client-resilience.test.ts.

Fixed: assertions that couldn't fail

  • abuse-email.test.ts rate-cap test: it was expect(true).toBe(true). It now asserts that no send and no KV write happen, and that notify-rate-capped is logged.
  • routes-files.test.ts sign tests: not.toBe(415) and not.toBe(409) would also pass on a 401 or 500. They now pin 400 presign_unavailable.
  • routes-github-private-prefix*.test.ts: the "4xx + error defined" checks would pass on an auth 401/403. They now pin 400 plus validation_error or invalid_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-implemented hasLinkCandidate, so the adopt cases were testing the copy. It now spreads the real module.
  • The test name "member session 200s" asserted a 400. It is renamed to say what it checks.

Verification

  • The changed files pass. pnpm typecheck and pnpm lint are clean, and CI is green.
  • One test failed in my local full pnpm test run: apps/web/src/lib/auth-proxy.test.ts "settles with a synthetic 503…". It failed the same way on main locally 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-config hand-written parser tests largely duplicate its golden table (two assertions would need to become rows first).
  • Possible it.each folds: MCP "usage errors" tests, attach "is silent" binding rows, auth-client cookie pairs, storage_misconfigured cases.
  • Some CLI client-* tests are the de facto SDK contract tests. Move them to packages/sdk rather than delete them.
  • packages/storage/test/s3-live-smoke.test.ts says "not committed — run manually, then delete" but is committed (always skipped).

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeLbkfpUvucSWi2KdUJNkR

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
@changeset-bot

changeset-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 098b150

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 2

  • coderabbit:review
  • review
🚫 Excluded labels (none allowed): 1

  • wip

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ade1cec8-ad1c-4bc3-8d51-fbcd37e7c8e8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@zachdunn Zach Dunn (zachdunn) self-assigned this Nov 20, 2026
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
@zachdunn
Zach Dunn (zachdunn) merged commit 27b7069 into main Nov 20, 2026
4 checks passed
@zachdunn
Zach Dunn (zachdunn) deleted the claude/project-thread-trmsu6 branch November 20, 2026 03:12
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.

2 participants