useCommitTask
The useCommitTask hook (hooks/useCommitTask.ts) is the master orchestrator that fires when the user presses “Commit” on the wizard hub. It is the largest hook in the application (~450 lines).Execution Sequence
- Validate the draft via validateTaskDraft()
- Acquire the SyncLock mutex
- Execute the Triple-Write Orchestrator:
- Step 1: Convex mutation to create/update the task and generate instances
- Step 2: Local SQLite write via insertTaskToLocalDb()
- Step 3: Hardware alarm sync via scheduleNextAlarm()
- Handle success or rollback failure
- Release the SyncLock
- Navigate back to the dashboard