Repository navigation
(janitor/test-prune): remove tautological constant and type-only test assertions - #8997
kilo-code-bot[bot] wants to merge 1 commit into
Conversation
Remove test assertions that re-state literal constants or exist only to typecheck, without exercising runtime behavior: - auto-routing-contracts: drop the never-run compile-only cross-pair helper; the runtime TaxonomyRouteKeySchema test already rejects the cross-pair. - code-reviews analytics: drop literal re-statements of schema/taxonomy version constants (already enforced by the schema's z.literal + reject tests) and label/impact-point maps, keeping the impact-points derivation assertions that exercise real logic.
| expect(CODE_REVIEW_ANALYTICS_CHANGE_TYPE_LABELS.bug_fix).toBe('Bug fix'); | ||
| expect(CODE_REVIEW_ANALYTICS_IMPACT_POINTS).toEqual({ low: 1, medium: 2, high: 3 }); | ||
| it('derives impact points from impact and confidence', () => { | ||
| expect(getCodeReviewAnalyticsImpactPoints('high', 'high')).toBe(3); |
There was a problem hiding this comment.
SUGGESTION: The retained test now only pins the high impact score
Dropping the CODE_REVIEW_ANALYTICS_IMPACT_POINTS assertion leaves the low: 1 and medium: 2 entries untested. The map is declared as const satisfies Record<CodeReviewAnalyticsImpactLevel, number>, so the compiler only enforces that those keys exist and hold numbers, not their values. A wrong score for low or medium would now pass the suite while silently changing analytics impact scoring. Consider adding assertions for getCodeReviewAnalyticsImpactPoints('medium', 'high') and getCodeReviewAnalyticsImpactPoints('low', 'high') next to the two kept cases.
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Executive SummaryTest-only cleanup is sound overall; the only regressions are reduced pinning of the analytics impact-point scores and loss of the sole type-level guard on Assumptions: Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Reviewed by deepseek-flash-latest · Input: 40.4K · Output: 10K · Cached: 584.6K Review guidance: REVIEW.md from base branch |
|
Meta Janitor: Closing because Kilo bot review contains actionable feedback. A future janitor run can recreate this cleanup against current main. Feedback: #8997 (comment) #8997 (comment) |
Pull request was closed
Summary
Removes test assertions that re-state literal constants or exist only to typecheck, without exercising runtime behavior. Both deletions target the same failure mode: an assertion whose expected value is either the source literal itself or a compile-time-only fact already enforced at the authoritative runtime boundary.
Changes
packages/auto-routing-contracts/src/taxonomy.test.tsDeleted the never-run compile-only helper:
rejects a subtask from another task typealready assertsTaxonomyRouteKeySchema.safeParse('debugging/code_generation').success === false, pinning the same cross-pair rejection at the authoritative runtime schema, not just in the type layer.taxonomyRouteKeysignature would not change any runtime behavior (the schema is the authority), and the runtime schema test already catches an actual cross-pair acceptance.apps/web/src/lib/code-reviews/analytics/contracts.test.tsReplaced the
exports stable labels, versions, and impact pointstest, dropping four literal re-statements and keeping the two real-logic assertions:Removed:
SCHEMA_VERSION === 1,TAXONOMY_VERSION === 1,CHANGE_TYPE_LABELS.bug_fix === 'Bug fix',IMPACT_POINTS === { low: 1, medium: 2, high: 3 }.Kept (renamed to
derives impact points from impact and confidence):getCodeReviewAnalyticsImpactPoints('high', 'high') === 3and('high', 'low') === 0.Classification: constant/literal re-statement.
Surviving coverage:
CodeReviewAnalyticsManifestSchema'sz.literal(CODE_REVIEW_ANALYTICS_SCHEMA_VERSION / TAXONOMY_VERSION)plus the existingrejects unsupported taxonomy values and versionstest (rejectsschemaVersion: 2andtaxonomyVersion: 2).as const satisfies Record<…>at compile time and are pure data with no behavior.Why they can't detect an additional regression: each assertion's expected value is the source literal itself, so they can only fail when the source is intentionally edited (mechanical churn), never when a bug is introduced. The version values are the same reference consumed by
z.literal, so the schema/reject tests already pin them behaviorally.Verification
pnpm --filter auto-routing-contracts run test— 226 passed (incl. the 4 taxonomy tests).pnpm --filter auto-routing-contracts run typecheck— clean.pnpm --filter auto-routing-contracts run lint— clean.oxlint apps/web/src/lib/code-reviews/analytics/contracts.test.ts— clean.apps/webJest suite could not be run in this environment (requires Postgres/Redis); the change only removes assertions and two now-unused imports, and the file lints clean.