Skip to content

refactor: extract CooldownSynthesisManager from CooldownSession (Wave 2C, #375)#400

Merged
cmbays merged 1 commit intomainfrom
wave-2c-cooldown-synthesis-manager
Mar 22, 2026
Merged

refactor: extract CooldownSynthesisManager from CooldownSession (Wave 2C, #375)#400
cmbays merged 1 commit intomainfrom
wave-2c-cooldown-synthesis-manager

Conversation

@cmbays
Copy link
Owner

@cmbays cmbays commented Mar 22, 2026

Summary

  • Extract 13 synthesis IO methods (~230L) into dedicated CooldownSynthesisManager class
  • CooldownSession: 965 → 744 lines (-23%)
  • Constructor DI with CooldownSynthesisDeps interface
  • loadBridgeRunIdsByBetId wired as deps function (keeps BridgeRunSyncer out of synthesis deps)
  • 5 proposal types: new-learning, update-learning, promote, archive, methodology-recommendation

Quality

  • 23 BDD scenarios (CPO + CQO audited)
  • 21 unit tests
  • CRAP < 8 (worst 4.6)
  • ArchUnit 14/15 (CycleManager LCOM4 pre-existing)
  • Mutation 81.58% overall, 96.88% covered (threshold 70%)

Decomposition Progress

Wave Service Lines PR
1A BridgeRunSyncer 195L #396
1B CooldownBeltComputer 85L #397
2A CooldownFollowUpRunner 124L #398
2B CooldownDiaryWriter 191L #399
2C CooldownSynthesisManager 273L this PR
3A Final wiring + quality gates next

Part of #375

Summary by CodeRabbit

  • Refactor
    • Reorganized internal synthesis operations in cycle management for improved maintainability and code clarity.
  • Tests
    • Added comprehensive scenario-based and unit test coverage for synthesis management.

… 2C)

Extract 13 synthesis IO methods (~230L) into dedicated CooldownSynthesisManager:
- writeInput(): collect observations + learnings, write SynthesisInput file
- readAndApplyResults(): read SynthesisResult, apply proposals to knowledge store
- 5 proposal types: new-learning, update-learning, promote, archive, methodology-recommendation

CooldownSession: 965 to 744 lines (-23%). Constructor DI with CooldownSynthesisDeps interface.
loadBridgeRunIdsByBetId wired as a deps function (keeps BridgeRunSyncer out of synthesis deps).

Quality: 23 BDD scenarios (CPO+CQO audited), 21 unit tests, CRAP < 8, mutation 81.58%.

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.

@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

A CooldownSynthesisManager class was extracted to encapsulate synthesis file I/O and proposal application logic previously embedded in CooldownSession. The manager coordinates synthesis input writing, stale file cleanup, bridge-run ID resolution, and result reading with knowledge-store mutations. CooldownSession now delegates these responsibilities. Comprehensive BDD and unit test coverage was added alongside feature specifications.

Changes

Cohort / File(s) Summary
New CooldownSynthesisManager Implementation
src/features/cycle-management/cooldown-synthesis-manager.ts
Added dependency-injected manager class with writeInput() and readAndApplyResults() public methods. Orchestrates synthesis JSON file I/O, stale input cleanup, bridge-run ID mapping, knowledge-store observation querying, and proposal application (new-learning, update-learning with confidence clamping, promote, archive, methodology-recommendation logging). Includes error handling with warning logs that continue processing on failures.
Test Coverage for CooldownSynthesisManager
src/features/cycle-management/cooldown-synthesis-manager.feature, src/features/cycle-management/cooldown-synthesis-manager.steps.ts, src/features/cycle-management/cooldown-synthesis-manager.test.ts
Added Gherkin feature file with behavioral scenarios. BDD step definitions and unit tests exercise input writing (with stale cleanup, run-ID resolution, learnings embedding, missing directories), result reading/parsing, proposal filtering and application per type, and error resilience (observation read failures, parse failures, proposal application failures).
CooldownSession Refactoring
src/features/cycle-management/cooldown-session.ts
Extracted inline synthesis orchestration (filesystem operations, JSON handling, synthesis result reading, proposal application) into CooldownSynthesisManager. Updated prepare() to call synthesisManager.writeInput() and complete() to call synthesisManager.readAndApplyResults(). Removed direct helper imports and related utility functions.
Build & Setup Configuration
src/acceptance/setup.ts, stryker.config.mjs
Added import for cooldown-synthesis-manager BDD steps in acceptance setup. Extended Stryker mutation testing scope to include the new manager class.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 A synthesis so clean and bright,
Manager takes the heavy load,
Session delegates with delight,
Proposals marching down the road!
Error-handling hops with care,
Tests ensure the way is fair.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: extraction of CooldownSynthesisManager from CooldownSession, with relevant context (Wave 2C and issue reference).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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-2c-cooldown-synthesis-manager

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.

@cmbays cmbays merged commit f735014 into main Mar 22, 2026
2 of 3 checks passed
@cmbays cmbays deleted the wave-2c-cooldown-synthesis-manager branch March 22, 2026 22:22
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.

1 participant