chore: v0.6.0 tech debt cleanup (#101, #104, #83)#107
Conversation
All other repository interfaces (TaskRepository, ScheduleRepository, DependencyRepository, WorkerRepository, CheckpointRepository) live in core/interfaces.ts. OutputRepository was the sole exception, defined in the implementations layer — violating DIP. Moves the interface to core, updates 8 import sites (5 production, 3 test/fixture). Zero behavioral change.
Three boolean flags (skipResourceMonitoring, skipScheduleExecutor, skipRecovery) allowed 8 possible configurations, only 3 valid. Replace with BootstrapMode enum: 'server' | 'cli' | 'run'. Adds mode mapping verification test. Integration tests now inject TestResourceMonitor instead of using skipResourceMonitoring flag. BREAKING: BootstrapOptions drops 3 boolean fields, adds mode. Acceptable for pre-1.0 semver.
The missed-run FAIL branch performed two sequential async DB writes (update schedule status + record execution) without atomicity. If update() succeeded but recordExecution() failed, the schedule would be cancelled with no audit trail. Replaces async calls with a synchronous transaction using runInTransaction(). Event emission now fires after the transaction commits, so handlers see consistent DB state. Adds atomicity rollback test verifying partial failure reverts both writes.
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant SE as ScheduleExecutor
participant DB as Database (TransactionRunner)
participant SR as SQLiteScheduleRepository
participant EB as EventBus
SE->>SE: tick() — finds due schedule
SE->>SE: handleMissedRun(schedule, now)
note over SE: MissedRunPolicy.FAIL
SE->>DB: runInTransaction(() => { ... })
activate DB
DB->>SR: updateSync(id, { status: CANCELLED })
DB->>SR: recordExecutionSync({ status: 'missed', ... })
alt recordExecutionSync throws
SR-->>DB: throws Error
DB-->>SE: err(BackbeatError) — rolled back
SE->>SE: log error, break (no event emitted)
else both ops succeed
DB-->>SE: ok(undefined)
deactivate DB
SE->>EB: emit('ScheduleMissed', { policy: FAIL })
SE->>SE: log "Schedule failed due to missed run"
end
|
Code Review SummaryNine reviewers analyzed this PR across architecture, complexity, consistency, documentation, performance, regression, security, tests, and TypeScript. Here's the consolidated feedback: Blocking Issues (Must Fix Before Merge)1. Dead
|
| Category | Score | Status |
|---|---|---|
| Architecture | 9/10 | APPROVED_WITH_CONDITIONS |
| Complexity | 9/10 | APPROVED |
| Consistency | 9/10 | APPROVED_WITH_CONDITIONS |
| Documentation | 7/10 | APPROVED_WITH_CONDITIONS |
| Performance | 9/10 | APPROVED |
| Regression | 9/10 | APPROVED |
| Security | 9/10 | APPROVED |
| Tests | 8/10 | CHANGES_REQUESTED |
| TypeScript | 9/10 | APPROVED_WITH_CONDITIONS |
Reviewer Consensus
Architecture: All three tech debt cleanups execute correctly:
- OutputRepository interface move follows established pattern ✓
- BootstrapMode enum eliminates invalid flag combinations (8 → 3 valid states) ✓
- ScheduleExecutor transaction wrapping fixes atomicity bug ✓
Quality verdict: These changes reduce complexity, improve type safety, and fix a real correctness issue. Address the 5 issues above (1 blocking + 4 should-fix) before merge. All suggestions are clear and actionable.
Reviewed by: Architecture, Complexity, Consistency, Documentation, Performance, Regression, Security, Tests, TypeScript reviewers
PR Recommendation: APPROVED_WITH_CONDITIONS (fix blocking issue + 4 should-fix items)
…n rollback The rollback test verified schedule status and execution history were restored, but did not check that ScheduleMissed was suppressed. Add event subscriber assertion so reordering the emit before the txResult.ok guard is caught by regression. Co-Authored-By: Claude <noreply@anthropic.com>
… JSDoc Remove unused Config interface (no imports across entire codebase) and add per-method JSDoc to OutputRepository to match peer repositories (ScheduleRepository, DependencyRepository, CheckpointRepository). Co-Authored-By: Claude <noreply@anthropic.com>
…trapOptions Extract the inline BootstrapMode-to-flags derivation into a pure, exported deriveModeFlags() function so the integration test exercises the real production code instead of duplicating the logic locally. Add missing JSDoc to BootstrapOptions fields. Co-Authored-By: Claude <noreply@anthropic.com>
- Bump version 0.5.0 → 0.6.0 - Update release notes with all 8 PRs (was missing #85, #86, #91, #94, #100, #106, #107) - Mark v0.6.0 as released in ROADMAP.md - Update FEATURES.md architecture section for hybrid event model - Expand "What's New in v0.6.0" with architectural simplification, bug fixes, tech debt - Fix README roadmap: v0.6.1 → v0.7.0 for loops - Update bug report template example version to 0.6.0
## Summary - Bump version `0.5.0` → `0.6.0` (package.json + package-lock.json) - Expand release notes with all 8 PRs (#78, #85, #86, #91, #94, #100, #106, #107) — was only covering #78 - Mark v0.6.0 as released in ROADMAP.md, update status and version timeline - Update FEATURES.md architecture section for hybrid event model (was describing old fully event-driven architecture with removed services) - Expand "What's New in v0.6.0" in FEATURES.md with architectural simplification, additional bug fixes, tech debt, breaking changes, migration 9 - Fix README roadmap version: `v0.6.1` → `v0.7.0` for task/pipeline loops - Update bug report template example version `0.5.0` → `0.6.0` ### GitHub Issues - Closed #82 (cancelTasks scope — PR #106) - Closed #95 (totalSize tail-slicing — PR #106) - Updated #105 release tracker checklist (all items checked) ## Test plan - [x] `npm run build` — clean compilation - [x] `npm run test:all` — full suite passes (822 tests, 0 failures) - [x] `npx biome check src/ tests/` — no lint errors - [x] `package.json` version is `0.6.0` - [x] Release notes file exists and covers all PRs - [ ] After merge: trigger Release workflow from GitHub Actions - [ ] After release published: close #105 --------- Co-authored-by: Dean Sharon <deanshrn@gmain.com>
Summary
Tech debt consolidation for v0.6.0, addressing three architectural and design improvements for maintainability and code organization.
Changes
#101: OutputRepository Interface in Core
OutputRepositoryinterface tocore/interfaces.tsfor DIP (Dependency Inversion Principle) complianceConfigadapter andgetConfig()function from bootstrap#104: BootstrapMode Enum
BootstrapOptionswithBootstrapModeenum#83: ScheduleExecutor Transaction Safety
Also Closes
Testing
Related Issues