Skip to content

(janitor/test-prune): remove tautological port and lease constant tests - #6465

Closed
kilo-code-bot[bot] wants to merge 1 commit into
mainfrom
janitor/test-prune-cloud-agent-next
Closed

kilo-code-bot[bot] wants to merge 1 commit into
mainfrom
janitor/test-prune-cloud-agent-next

Conversation

@kilo-code-bot

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

Copy link
Copy Markdown
Contributor

Summary

Removes two groups of tests in services/cloud-agent-next that cannot detect a plausible production regression. No production code changed.

Removed

src/kilo/ports.test.ts (deleted)

  • PORT_RANGE_MIN is 10000 / PORT_RANGE_MAX is 60000tautological: each asserts an export const against its own literal, so they can only fail if the source constant is edited (an intended change, not a regression).
  • randomPort range/integer/variety tests — dependency behavior: they verify only properties guaranteed by Math.random() ([0,1)) and Math.floor() (integer). randomPort is the one-line PORT_RANGE_MIN + Math.floor(Math.random() * (PORT_RANGE_MAX - PORT_RANGE_MIN)); the tests re-prove the JavaScript standard library, not repo-owned logic.

ports.ts has no branch or edge case left uncovered.

src/core/lease.test.ts (constants block removed)

  • LEASE_TTL_MS === 90_000, HEARTBEAT_INTERVAL_MS === 30_000, STALE_THRESHOLD_MS === 90_000tautological: each asserts an export const literal against itself. The surviving calculateExpiry, isExpired, and isStale tests still exercise the constants through their consumers (calculateExpiry(now) === now + LEASE_TTL_MS, isStale boundary cases use STALE_THRESHOLD_MS).

Why these cannot catch an additional regression

  • The constant assertions follow entirely from the source declaration; the only way to fail them is to edit the constant, which is the intended change.
  • randomPort contains no repo-owned branch logic. Its output properties are derived from Math.random/Math.floor, and an out-of-range or fractional port would be an obviously broken rewrite rather than a subtle regression.

Verification

  • pnpm exec vitest run src/core/lease.test.ts src/kilo — 14 files / 430 tests pass.
  • pnpm exec tsgo --noEmit — passes.
  • pnpm exec oxlint on the edited file — 0 warnings/errors.

Delete ports.test.ts and the lease constant assertions. Both restate
literal constant values (PORT_RANGE_MIN/MAX, LEASE_TTL_MS, etc.) and,
for randomPort, only verify properties guaranteed by Math.random() and
Math.floor(). None of them can detect a plausible production regression.
@kilo-code-bot kilo-code-bot Bot added the janitor Automated dead-code/duplication cleanup label Sep 21, 2026
@kilo-code-bot
kilo-code-bot Bot enabled auto-merge (squash) September 21, 2026 07:39
import {
LEASE_TTL_MS,
HEARTBEAT_INTERVAL_MS,
STALE_THRESHOLD_MS,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SUGGESTION]: HEARTBEAT_INTERVAL_MS becomes an unused export

Removing this import drops the last reference to HEARTBEAT_INTERVAL_MS anywhere in the repo. It is still exported from src/core/lease.ts:17, but after this change nothing imports or exercises it (lease.ts itself, the wrapper, and the other HEARTBEAT_INTERVAL_MS constants in user-kilo-facade.ts/gastown are unrelated). The surviving calculateExpiry/isStale tests only cover LEASE_TTL_MS and STALE_THRESHOLD_MS, so this constant is now dead code. Consider deleting the export (or retaining a non-tautological consumer) in a follow-up; non-blocking for this test-prune change.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

The test deletions are safe and the remaining lease tests still cover LEASE_TTL_MS/STALE_THRESHOLD_MS; one non-blocking follow-up: removing the test import leaves HEARTBEAT_INTERVAL_MS as an unused export in src/core/lease.ts.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
services/cloud-agent-next/src/core/lease.test.ts 4 HEARTBEAT_INTERVAL_MS is no longer referenced anywhere after this import removal and is now dead exported code in lease.ts
Files Reviewed (2 files)
  • services/cloud-agent-next/src/core/lease.test.ts - 1 issue
  • services/cloud-agent-next/src/kilo/ports.test.ts - deleted (no issues; randomPort/PORT_RANGE_* still exercised via mocks in wrapper-client.test.ts and session-service.test.ts)

Fix these issues in Kilo Cloud


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

Review guidance: REVIEW.md from base branch main

auto-merge was automatically disabled September 22, 2026 15:47

Pull request was closed

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