Skip to content

refactor: extract shared types and deprecate kataka fields (Wave 3A, #375)#401

Merged
cmbays merged 1 commit intomainfrom
wave-3a-final-wiring
Mar 22, 2026
Merged

refactor: extract shared types and deprecate kataka fields (Wave 3A, #375)#401
cmbays merged 1 commit intomainfrom
wave-3a-final-wiring

Conversation

@cmbays
Copy link
Owner

@cmbays cmbays commented Mar 22, 2026

Summary

Final wiring pass for the CooldownSession decomposition (#375):

  • Extract shared types to cooldown-types.tsBetOutcomeRecord, IncompleteRunInfo, CooldownSessionResult, CooldownPrepareResult moved out of the orchestrator. 10 import sites updated, re-exports maintain backward compat.
  • @deprecated tags on kataka legacy fieldskatakaConfidenceCalculator and katakaDir in both CooldownSessionDeps and CooldownBeltDeps.
  • Remove unused BeltComputeResult import from cooldown-session.ts.

Decomposition Summary (all 6 PRs)

Wave Service Lines PR
1A BridgeRunSyncer 195L #396
1B CooldownBeltComputer 85L #397
2A CooldownFollowUpRunner 124L #398
2B CooldownDiaryWriter 191L #399
2C CooldownSynthesisManager 273L #400
3A Type extraction + deprecation this PR

CooldownSession: 1,359 → 673 lines (-51%)

Quality Gates

  • Verify (lint + typecheck + unit + integration + e2e + build): PASS
  • 113 BDD acceptance scenarios: PASS
  • dep-cruiser (394 modules): zero violations
  • ArchUnit: 14 of 15 (pre-existing CycleManager LCOM4)
  • CRAP: all cooldown files < threshold
  • Mutation: 85.03% (threshold 70%)

Closes #375

Test plan

  • npm run verify — full suite passes
  • npm run test:acceptance — 113 BDD scenarios
  • npm run test:arch — dep-cruiser clean
  • npm run test:arch:unit — 14 of 15 ArchUnit rules
  • npm run test:crap — cooldown files all clean
  • npm run test:mutation — 85.03%

Summary by CodeRabbit

  • Chores
    • Added deprecation notices for legacy configuration parameters katakaConfidenceCalculator and katakaDir. Migrate to agentConfidenceCalculator and agentDir respectively before v1 removal.

… fields (Wave 3A, #375)

Move BetOutcomeRecord, IncompleteRunInfo, CooldownSessionResult, and
CooldownPrepareResult to dedicated cooldown-types.ts. This decouples the
5 extracted services from the orchestrator module. Add @deprecated tags
on katakaConfidenceCalculator and katakaDir fields in both
CooldownSessionDeps and CooldownBeltDeps.

CooldownSession: 744 to 673 lines. Full decomposition: 1,359 to 673
lines (-51%) with 5 extracted services totaling 868 lines of focused,
tested code.

Quality gates: verify pass, 113 BDD scenarios, dep-cruiser clean,
ArchUnit 14 of 15, CRAP clean on cooldown files, mutation 85.03%.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@cmbays cmbays merged commit 5a4c546 into main Mar 22, 2026
1 of 3 checks passed
@cmbays cmbays deleted the wave-3a-final-wiring branch March 22, 2026 22:58
@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0247a65e-89c8-4f76-bd9f-71452ca319b4

📥 Commits

Reviewing files that changed from the base of the PR and between f735014 and 9ab4d2a.

📒 Files selected for processing (11)
  • src/features/cycle-management/bridge-run-syncer.steps.ts
  • src/features/cycle-management/bridge-run-syncer.test.ts
  • src/features/cycle-management/bridge-run-syncer.ts
  • src/features/cycle-management/cooldown-belt-computer.ts
  • src/features/cycle-management/cooldown-diary-writer.steps.ts
  • src/features/cycle-management/cooldown-diary-writer.test.ts
  • src/features/cycle-management/cooldown-diary-writer.ts
  • src/features/cycle-management/cooldown-session.ts
  • src/features/cycle-management/cooldown-types.ts
  • src/features/dojo/diary-writer.test.ts
  • src/features/dojo/diary-writer.ts

📝 Walkthrough

Walkthrough

This PR reorganizes cooldown-related type definitions by extracting IncompleteRunInfo, BetOutcomeRecord, CooldownSessionResult, and CooldownPrepareResult from cooldown-session.ts into a new dedicated module cooldown-types.ts. Multiple consumers update their imports, while cooldown-session.ts re-exports these types for backward compatibility. Deprecation markers are added to legacy dependency aliases in CooldownBeltDeps.

Changes

Cohort / File(s) Summary
Type Definition Extraction
src/features/cycle-management/cooldown-types.ts
New module defining four exported type interfaces: IncompleteRunInfo, BetOutcomeRecord, CooldownSessionResult (with optional fields for artifacts), and CooldownPrepareResult (prepare-stage variant without completion timestamps).
Session Module Refactoring
src/features/cycle-management/cooldown-session.ts
Removed local type declarations, added imports and re-exports from cooldown-types.js for backward compatibility. Added @deprecated JSDoc markers to katakaConfidenceCalculator and katakaDir properties. Removed unused BeltComputeResult import.
Bridge & Diary Import Updates
src/features/cycle-management/bridge-run-syncer.ts, src/features/cycle-management/bridge-run-syncer.steps.ts, src/features/cycle-management/bridge-run-syncer.test.ts, src/features/cycle-management/cooldown-diary-writer.ts, src/features/cycle-management/cooldown-diary-writer.steps.ts, src/features/cycle-management/cooldown-diary-writer.test.ts
Updated BetOutcomeRecord and IncompleteRunInfo imports to source from ./cooldown-types.js instead of ./cooldown-session.js.
Dojo Diary Import Updates
src/features/dojo/diary-writer.ts, src/features/dojo/diary-writer.test.ts
Updated BetOutcomeRecord import to source from @features/cycle-management/cooldown-types.js instead of @features/cycle-management/cooldown-session.js.
Deprecation Markers
src/features/cycle-management/cooldown-belt-computer.ts
Added JSDoc @deprecated annotations to katakaConfidenceCalculator (replaced by agentConfidenceCalculator) and katakaDir (replaced by agentDir) properties in CooldownBeltDeps interface.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Types freed from tangled session threads,
Now nestled in their cozy cooldown bed,
Old aliases fade with gentle @deprecated grace,
While bridges and diaries find their new import place!
A cleaner split, a lighter load—
The refactoring road brings order to the code. 📚✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wave-3a-final-wiring

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor and re-scope mutation testing for core execution paths after PR #374

1 participant