(janitor/test-prune): remove tautological port and lease constant tests - #6465
kilo-code-bot[bot] wants to merge 1 commit into
Conversation
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.
| import { | ||
| LEASE_TTL_MS, | ||
| HEARTBEAT_INTERVAL_MS, | ||
| STALE_THRESHOLD_MS, |
There was a problem hiding this comment.
[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.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Executive SummaryThe test deletions are safe and the remaining lease tests still cover Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (2 files)
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 |
Pull request was closed
Summary
Removes two groups of tests in
services/cloud-agent-nextthat 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 60000— tautological: each asserts anexport constagainst its own literal, so they can only fail if the source constant is edited (an intended change, not a regression).randomPortrange/integer/variety tests — dependency behavior: they verify only properties guaranteed byMath.random()([0,1)) andMath.floor()(integer).randomPortis the one-linePORT_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.tshas 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_000— tautological: each asserts anexport constliteral against itself. The survivingcalculateExpiry,isExpired, andisStaletests still exercise the constants through their consumers (calculateExpiry(now) === now + LEASE_TTL_MS,isStaleboundary cases useSTALE_THRESHOLD_MS).Why these cannot catch an additional regression
randomPortcontains no repo-owned branch logic. Its output properties are derived fromMath.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 oxlinton the edited file — 0 warnings/errors.