-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
tech-debtTechnical debt items tracked for future cleanupTechnical debt items tracked for future cleanup
Description
Summary
ScheduleExecutor.handleMissedRun() performs two separate database operations without transaction protection. If the first succeeds but the second fails, the schedule is cancelled with no audit trail.
Affected Code
File: src/services/schedule-executor.ts (lines 385-415)
Two sequential operations:
scheduleRepo.update()— cancels the schedulescheduleRepo.recordExecution()— records the failed execution audit trail
If step 1 succeeds but step 2 fails, the schedule is cancelled with no audit record explaining why.
Proposed Fix
Inject Database into ScheduleExecutor (same pattern used in ScheduleHandler from #81) and wrap both calls in database.runInTransaction() using the sync variants (updateSync, recordExecutionSync).
Risk
Low — both operations target the same entity type and the audit trail gap is cosmetic.
References
- Identified during Issue refactor: add runInTransaction for atomic multi-step DB operations #81 planning (transaction atomicity refactor)
runInTransactioninfrastructure added in refactor: add runInTransaction for atomic multi-step DB operations #81
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
tech-debtTechnical debt items tracked for future cleanupTechnical debt items tracked for future cleanup