refactor+test: mutation hardening — extract helpers and kill survivors#385
refactor+test: mutation hardening — extract helpers and kill survivors#385
Conversation
Extract isSyncableBet, collectBridgeRunIds, hasObservations, shouldSyncOutcomes, and hasMethod into cooldown-session.helpers.ts to make them testable independent of side-effecting orchestration. Wire the helpers back into cooldown-session.ts methods. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract findEarliestTimestamp, matchesCycleRef, resolveAgentId,
computeBudgetPercent, extractHistoryTokenTotal, sumTokenTotals,
countJsonlContent, and mapBridgeRunStatus into session-bridge.helpers.ts.
Replace inline .endsWith('.json') with shared isJsonFile filter.
Simplify tautological in-progress status mapping.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract hasNoGapsToBridge, hasBlockedGaps, hasBridgedGaps, formatConfidencePercent, and hasPipelineLearnings into execute.helpers.ts with targeted tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Exercise diary writing guards, force bypass, depth override, nextKeiko no-op without runsDir, and empty incompleteRuns path. These kill ConditionalExpression and BooleanLiteral mutants in cooldown-session.ts private orchestration methods. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use the shared isJsonFile helper from file-filters.ts in
workflow-runner.ts and execute.ts instead of inline
.endsWith('.json') callbacks. Kills MethodExpression mutants.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Exercise the ConditionalExpression and EqualityOperator mutants in getAgentContext by asserting that completed and failed runs reject dispatch, and non-existent runs throw descriptive errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Export listSavedKatas, loadSavedKata, saveSavedKata, and deleteSavedKata from execute.ts and add direct tests covering existsSync guards, JSON parsing errors, schema validation, and file deletion paths. These kill ConditionalExpression, BlockStatement, and ObjectLiteral mutants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR extracts pure helper functions across execute, cooldown-session, and session-bridge modules, then refactors existing code to use these centralized utilities. New saved-kata CRUD functions are exported, and comprehensive test coverage is added for all new helpers and refactored workflows. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~28 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Mutation score improvement
19 surviving mutants killed. Focus on ConditionalExpression, LogicalOperator, EqualityOperator, BlockStatement, MethodExpression, ObjectLiteral mutants (StringLiteral skipped per #375).
New helpers extracted
cooldown-session.helpers.ts:
isSyncableBet,collectBridgeRunIds,hasObservations,shouldSyncOutcomes,hasMethodsession-bridge.helpers.ts:
findEarliestTimestamp,matchesCycleRef,resolveAgentId,computeBudgetPercent,extractHistoryTokenTotal,sumTokenTotals,countJsonlContent,mapBridgeRunStatusexecute.helpers.ts:
hasNoGapsToBridge,hasBlockedGaps,hasBridgedGaps,formatConfidencePercent,hasPipelineLearningsTest plan
npm run typecheckpassesnpm run lintpassesnpm run test:unit— 3245 tests passnpm test(unit + integration) — all passnpm run test:mutation— 72.19% (above break threshold 70)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests