Skip to content

(janitor/test-prune): remove redundant expectTypeOf assertions in cloud-agent-next tests - #6878

Merged
kilo-code-bot[bot] merged 1 commit into
mainfrom
janitor/test-prune-cloud-agent-expect-typeof
Sep 29, 2026
Merged

kilo-code-bot[bot] merged 1 commit into
mainfrom
janitor/test-prune-cloud-agent-expect-typeof

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes four expectTypeOf assertions across two services/cloud-agent-next test files. expectTypeOf (from expect-type, re-exported by Vitest) emits no runtime check — every matcher is () => true — so these assertions can never fail at test-execution time and are pure type-system noise.

Why each removal cannot detect a regression

src/sandbox-state/ports/reconcile.test.ts

  • Removed: it('is assignable from the production control transport') — expectTypeOf<SandboxControlSocketHandler['sendRequest']>().toMatchTypeOf<ReconcileSendRequest>().
  • Why it cannot fail: toMatchTypeOf is compile-time only. The same one-way assignability is already enforced authoritatively at the production call site persistence/SandboxControl.ts:756 (createReconcilePort(request => this.socketHandler.sendRequest(request))). If sendRequest's signature ever becomes incompatible with ReconcileSendRequest, tsgo fails there — independent of this test. The compile-time expectTypeOf adds no runtime coverage and no compile-time check the production code does not already perform.
  • Surviving coverage: the four remaining cases exercise createReconcilePort runtime behavior (phase send with attempt identity/timeout, changed-ack rejection, retryable non-ack, readiness probing).

test/unit/wrapper/kilo-api.test.ts

  • Removed: three expectTypeOf(...).toEqualTypeOf<...>() lines (result, prompt, command).
  • Why they cannot fail: each compares a value whose declared type is already the generic argument. result = await client.sendPrompt(opts) is typed SessionPromptResponse by sendPrompt's return type, so the assertion is expectTypeOf<SessionPromptResponse>().toEqualTypeOf<SessionPromptResponse>() — T vs T, which is trivially true and provides no compile-time or runtime signal.
  • Surviving coverage: the same tests retain their runtime assertions (expect(result).toEqual(completion), expect(prompt.info.error).toEqual(failedCompletion.info.error), expect(command).toEqual(failedCompletion), etc.), which verify the actual values.

Verification

  • pnpm exec vitest run src/sandbox-state/ports/reconcile.test.ts test/unit/wrapper/kilo-api.test.ts — 54 passing (was 55; the one removed test was the expectTypeOf-only case).
  • pnpm exec tsgo --noEmit (cloud-agent-next) — passes.
  • pnpm -w exec oxlint --config .oxlintrc.json <two files> — 0 errors / 0 warnings.

…ud-agent-next tests

- Drop the `is assignable from the production control transport` case in
  sandbox-state/ports/reconcile.test.ts. `expectTypeOf(...).toMatchTypeOf(...)`
  is a compile-time-only assertion with no runtime behavior, and the exact
  assignability it states is already enforced by the production call site in
  persistence/SandboxControl.ts (`createReconcilePort(request =>
  this.socketHandler.sendRequest(request))`), which fails typecheck if
  `sendRequest` ever becomes incompatible with `ReconcileSendRequest`. The four
  remaining cases in the file keep the runtime coverage of `createReconcilePort`.
- Drop the three `expectTypeOf(...).toEqualTypeOf<...>()` lines in
  test/unit/wrapper/kilo-api.test.ts. Each compares a value whose declared type
  is already the generic argument (e.g. `result` from `sendPrompt`, which returns
  `Promise<SessionPromptResponse>`) against itself, i.e. `T` against `T`, so they
  can never fail. The surrounding `expect(...)` assertions already verify the
  actual runtime values (`result`/`prompt`/`command`).

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
@kilo-code-bot kilo-code-bot Bot added the janitor Automated dead-code/duplication cleanup label Sep 29, 2026
@kilo-code-bot
kilo-code-bot Bot enabled auto-merge (squash) September 29, 2026 07:42
@kilo-code-bot

kilo-code-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Test-only cleanup removing four compile-time-only expectTypeOf assertions; the removed imports (SandboxControlSocketHandler, SessionCommandResponse) and assertions are genuinely redundant, and no runtime behavior is affected.

Files Reviewed (2 files)
  • services/cloud-agent-next/src/sandbox-state/ports/reconcile.test.ts
  • services/cloud-agent-next/test/unit/wrapper/kilo-api.test.ts

Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

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.

1 participant