Archive and Wake are each one conditional write that acts only when it moved the repository, and a Wake asked during an Archive's stop starts production after that stop #45
No reviewers
Labels
No labels
agent-work
agent-working
ultracode
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
trevato-apps/forge!45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev/archive-wake-atomic"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem. Archive and Wake were not atomic. Two Archives from the same view both stopped the app and both wrote an
archivedevent. A Wake during a slow Archive stop did not start the app: the stop aborted the deploy that the Wake reused. The result was an awake repository with production down.Root cause.
updateRepoSettingswrotearchived_atwithout a condition. It found the transition by a comparison with therepoit read before. The stop and the reconcile were not in order with each other.Fix.
moveArchivedincore/repos.tsis one conditionalUPDATE ... WHERE archived_at IS NULL(orIS NOT NULL). It returns true only when one row changed. The action stops or reconciles only then, and writesarchivedin the event only then.updateRepoSettingstakesOmit<RepoSettings, "archived">, so it cannot writearchived_at.Test.
test/apps-archive-race.test.ts(real apps runtime). A Wake during an Archive's stop (a redeploy is in flight) leaves production running. Two Archives from one stale view give onearchivedevent. On main: both fail (productionfailed; 2 events). With the fix: both pass.archive-web,crewandgueststests use asetArchivedInhelper onmoveArchived.Validate (fast). Result: flaky, no new failure.
contain.test.tsis baseline (box DNS).tui-sentinel.test.tsfailed one time in the full run. It passes alone on this branch and is not red on main. tsc passes.