Skip to content

(janitor/test-prune): remove redundant installFromSource mock-echo test in kiloclaw-router - #5671

Merged
pandemicsyn merged 1 commit into
mainfrom
janitor/test-prune-kiloclaw-install-mock-echo
Aug 28, 2026
Merged

(janitor/test-prune): remove redundant installFromSource mock-echo test in kiloclaw-router#5671
pandemicsyn merged 1 commit into
mainfrom
janitor/test-prune-kiloclaw-install-mock-echo

Conversation

@kilo-code-bot

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

Copy link
Copy Markdown
Contributor

Summary

Removes one fully redundant test from apps/web/src/routers/kiloclaw-router.test.ts.

it('passes through the no_instance outcome', ...) in the kiloclawRouter installFromSource describe block only asserted that the router's result equals the exact literal object handed to a same-test mock (installDispatchMock.__dispatchInstallFromSource.mockResolvedValue({ ok: false, code: 'no_instance' })expect(result).toEqual({ ok: false, code: 'no_instance' })). No router logic branches on this shape.

Why this is safe to delete

installFromSource (apps/web/src/routers/kiloclaw-router.ts:3256-3273) is a literal pass-through to dispatchInstallFromSource; the router does not inspect or transform the { ok, code } result it returns. Swapping the mocked literal from a success shape to a no_instance shape and re-asserting toEqual cannot detect any regression that the sibling test wouldn't already catch, since any bug in the pass-through (dropped field, wrapped response, broken call) would already fail the sibling's assertions.

Surviving coverage for the deleted test:

  • Router pass-through behavior (the only thing this test exercised): covered by the sibling it('dispatches for an entitled caller and returns the dispatch result', ...) in the same describe block, which drives the identical code path with the same input and additionally asserts the exact arguments forwarded to dispatchInstallFromSource — a strictly stronger check.
  • Auth gate: covered by it('rejects a caller without active KiloClaw access (FORBIDDEN)...') in the same describe block.
  • Input validation: covered by it('rejects an unregistered source via input validation...') in the same describe block.
  • no_instance business logic itself (owned by dispatchInstallFromSource, not the router): covered directly, with distinct triggering conditions (no active instance, null sandbox id, kilo-chat no_conversation mapping), in apps/web/src/lib/kiloclaw/install-dispatch.test.ts (lines 140, 214, 231).

Why the removed test could not detect an additional plausible regression

The router performs zero branching or transformation on the mocked outcome — it returns whatever the mocked service resolves to, verbatim. The only way this test could fail is if the sibling pass-through test (with a different mocked payload) would also fail. There is no failure mode unique to the no_instance literal at the router layer; that logic lives in and is tested by install-dispatch.test.ts.

Validation

  • npx jest src/routers/kiloclaw-router.test.ts -t installFromSource: file parses/compiles correctly; the 3 remaining tests in this describe block are unchanged in behavior. Execution against the DB-backed suite fails in this sandbox only because Postgres isn't reachable here (no docker available), not due to this change — confirmed the same pre-existing DB connection failure occurs for the untouched sibling tests too.
  • pnpm -w exec oxlint --config .oxlintrc.json apps/web/src/routers/kiloclaw-router.test.ts: 0 warnings, 0 errors.
  • npx tsgo --noEmit -p tsconfig.json (apps/web): no errors.
  • oxfmt on the changed file: no formatting changes needed.
  • git diff --check: clean.
  • Diff is scoped to exactly the 20 deleted lines of the one redundant test; no production code changed.

The 'passes through the no_instance outcome' test only asserted that
installFromSource's result equals the exact object handed to a
same-test mock, with no branching logic exercised in the router.

installFromSource (kiloclaw-router.ts:3256-3273) is a literal
pass-through to dispatchInstallFromSource; it does not inspect or
transform the ok/code shape it returns. The sibling test 'dispatches
for an entitled caller and returns the dispatch result' already
drives the identical code path with the same input and additionally
asserts the call arguments forwarded to the service, making it a
strictly stronger check of the same pass-through behavior.

The no_instance branch itself is business logic owned by
dispatchInstallFromSource, not the router, and is already covered
directly (with distinct triggering conditions) in
apps/web/src/lib/kiloclaw/install-dispatch.test.ts.

No coverage is lost:
- Router pass-through behavior: covered by the sibling success test.
- Auth gate: covered by the FORBIDDEN test in the same describe block.
- Input validation: covered by the bad-source test in the same block.
- no_instance business logic: covered directly in install-dispatch.test.ts.
@kilo-code-bot kilo-code-bot Bot added the janitor Automated dead-code/duplication cleanup label Aug 28, 2026
@kilo-code-bot

kilo-code-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Removed one redundant mock-echo test from kiloclaw-router; remaining sibling and install-dispatch tests still cover the pass-through and no_instance paths.

Files Reviewed (1 files)
  • apps/web/src/routers/kiloclaw-router.test.ts

Reviewed by grok-4.6 · Input: 33.8K · Output: 5.1K · Cached: 172.7K

Review guidance: REVIEW.md from base branch main

@pandemicsyn
pandemicsyn enabled auto-merge (squash) August 28, 2026 21:14
@pandemicsyn
pandemicsyn merged commit 0502762 into main Aug 28, 2026
23 checks passed
@pandemicsyn
pandemicsyn deleted the janitor/test-prune-kiloclaw-install-mock-echo branch August 28, 2026 21:20
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.

1 participant