Skip to content

(janitor/test-prune): remove mock-echo pass-through tests in admin routers - #5761

Open
kilo-code-bot[bot] wants to merge 1 commit into
mainfrom
janitor/test-prune-admin-router-mock-echo
Open

(janitor/test-prune): remove mock-echo pass-through tests in admin routers#5761
kilo-code-bot[bot] wants to merge 1 commit into
mainfrom
janitor/test-prune-admin-router-mock-echo

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes three tautological "mock-echo" tests in the admin tRPC routers. Each asserts that a router procedure returns the exact value configured into a same-test mock, over production code that is a literal pass-through (no input transformation, no branching, no argument forwarding).

What was removed and why

Test Production code Why it can't catch a regression
admin.github.getKilocodeOpenPullRequestCounts — "returns PR counts for admin users" return getKilocodeRepoOpenPullRequestCounts({ ttlMs: 2 * 60_000 }) Asserts result equals the value it set on the mock; no toHaveBeenCalledWith, so the only failing change is the mock's own config.
admin.github.getKilocodeRecentlyMergedExternalPRs — "returns recently merged external PRs for admin users" return getKilocodeRepoRecentlyMergedExternalPRs({ ttlMs: 2 * 60_000, maxResults: 50 }) Same mock-echo; no argument assertion.
admin.kiloclawProviders.getRollout — "returns provider rollout config from the Worker" return client.getProviderRollout() No input, no transformation; asserts the mocked client result is echoed back.

Surviving coverage

  • The admin authorization gate is still covered for each endpoint by the sibling "throws FORBIDDEN for non-admin users" / "rejects non-admin users" tests in the same describe blocks.
  • The two endpoints that do perform real input transformation were retained: getKilocodeOpenPullRequestsSummary and getKilocodeRecentlyClosedExternalPRs (they assert toHaveBeenCalledWith for repos/includeDrafts, guarding the input?.repos ?? [...ALL_REPO_IDS] and includeDrafts ?? false defaults).

Verification

  • oxlint on both files: 0 warnings, 0 errors.
  • tsgo --noEmit (web): passed.
  • Jest suite could not be executed in this environment (shared PostgreSQL is unavailable — cleanupDbForTest fails at connection). The change is deletion-only.

The removed tests could not detect any additional plausible regression beyond what the surviving gate and arg-forwarding tests already cover.

…uters

Remove three tests that assert the router returns the exact value
configured into a same-test mock, over production code that is a literal
pass-through with no input transformation or branching.

- admin.github.getKilocodeOpenPullRequestCounts ("returns PR counts for
  admin users"): the procedure body is
  `return getKilocodeRepoOpenPullRequestCounts({ ttlMs: 2 * 60_000 })`.
  The test asserts `result` equals the value it set on the
  `getKilocodeRepoOpenPullRequestCounts` mock, with no argument-forwarding
  assertion, so the only detectable "regression" is the mock's own
  configuration. The admin gate is covered by the sibling
  "throws FORBIDDEN for non-admin users" test.

- admin.github.getKilocodeRecentlyMergedExternalPRs ("returns recently
  merged external PRs for admin users"): same shape —
  `return getKilocodeRepoRecentlyMergedExternalPRs({ ttlMs, maxResults })`
  with no argument assertion. FORBIDDEN gate already covered.

- admin.kiloclawProviders.getRollout ("returns provider rollout config
  from the Worker"): `return client.getProviderRollout()` with no input
  and no transformation. The only assertion is that the mocked client
  result is echoed back. Admin gate covered by "rejects non-admin users".

The surviving tests in each describe block still verify the admin
authorization gate, and the arg-forwarding tests for the summary/closed
endpoints (which do transform inputs via `?? ALL_REPO_IDS` and
`includeDrafts ?? false`) are retained.
@kilo-code-bot kilo-code-bot Bot added the janitor Automated dead-code/duplication cleanup label Aug 31, 2026
@kilo-code-bot

kilo-code-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • apps/web/src/routers/admin-github-router.test.ts
  • apps/web/src/routers/admin-kiloclaw-providers-router.test.ts

Reviewed by grok-4.6 · Input: 108.8K · Output: 4K · Cached: 104.8K

Review guidance: REVIEW.md from base branch main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

janitor Automated dead-code/duplication cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants