carlos / platform Public

Lifetime detach, recovery and previous-owner cleanup skip the canary-retire deletion window closed

On branch console-remote-instances

Follow-up from the round 6 review of console-remote-instances (Astra, P2 #2). It was not fixed on that branch.

The gap. The canary-retire guard (retireUnsettled) refuses a retire while any record of the app was deleted in the last 15 minutes. It learns about deletions from noteRecordDeletion and from the audit log. Some lifetime paths delete or retire a record without either:

  • Domain detach. detachDomain goes to detachRetireLocked, then to retireRecordWithLifetimeLocked. That skips the wrapper that calls noteRecordDeletion. Its audit action is domain-detach, which recentRecordDeletion does not read.
  • Recovery. Recovery enters retirementStepsLocked directly, so it also skips the note.
  • Previous owner. allocCleanLocked notes the deletion of its own key, but not the previous owner's.

What can happen. With lifetimes on, a member detaches a first-route domain. Once the console's copy is gone, another box can still follow the canary. A static copy left behind carries no rollout identity, so the orphan-report check does not catch it. The retire can then go ahead at once, without waiting out the deletion window Paul approved.

Suggested fix. Record the deletion time and invalidate the caches at the shared retirement and deletion steps, not in each wrapper. That covers the locked callers, recovery and the previous-owner cleanup. Add a test: detach a domain, then retire the canary while remote reconciliation is paused. The retire should be refused for the window.

Related: #407 (the app-lock follow-up for the retire window) and #280 (Paul accepted the residual window on 2026-10-25).

Fixed and merged as acfa4f8 (branch retire-window-all-deletes-415).

  • retirementStepsLocked notes the deletion at entry. Its N1 tombstone is a deletion to every reader, and detach and recovery both reach it.
  • Every lifetime delete of a record goes through deleteRecordIfMatch, which notes and then deletes on the ETag. That covers the stale body, both allocation cleanups (the previous owner's is noted under its own app), deleteUnderRetiredSlot and the migration's corrupt-body delete.
  • Astra found one more path in review: the hourly trash sweep with lifetimes off. It notes before its purge now.
  • recentRecordDeletion also reads domain-detach audit rows, for a second console process.

The test you suggested is in: detach a first-route domain with lifetimes on, wipe the audit, and the retire is refused for the window. A sibling test does the same with only the audit row, on a second console. Both failed on the old code. Every console fixture now carries a witness that fails any console record delete without a fresh note. It caught the detach, recovery and trash-sweep paths on the old code, and it is mutation-checked.

Review: Astra round 1, READY AFTER FIXES. No P1, both P2s fixed. Record-write census: six units approved (#280). CI was green on the tip after re-merging main.