Repository navigation
fix(investigations): restart only from the status it read - #2321
Merged
Merged
Maple Review Bot / Maple / review
succeeded
Nov 6, 2026 in 34s
Confidence 10/10 · No issues found
🟢 Confidence 10/10 · safe to merge. A two-line guard on status = existing.status, matching the documented "guard on the state it was decided from" rule, pinned by a test that fails without it.
no findings · tests covered · risk high
restartInvestigation's UPDATE now also requires the status it read, so a resolve landing between the read and the write is a 409 instead of being overwritten. The added PGlite test lands exactly that write and pins the 409, the unchanged row and the unsent turn.
restartInvestigationUPDATE guards onstatus = existing.status- New test wraps
Databaseto run a resolve between the restart's read and its update
What was checked
existing.statusis the post-sweep status fromgetInvestigation(InvestigationService.ts:618), andfailedstays restartable, so a swept run still restartsresolvedis inRESTARTABLE_INVESTIGATION_STATUSES(packages/domain/src/http/investigations.ts:66), so the new equality blocks only the concurrent change- The orphan claim path (
startedAtnull) still passes: the equality holds oninvestigatingand thestartedAt IS NULLbranch decides
eba5480 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.
Loading