carlos / platform Public

Canary retire: a create between the final re-list and the delete can slip through (app lock follow-up) closed

From console-remote-instances (Paul accepted this window on 2026-10-25, with an app lock to follow).

The canary-retire guard now refuses when any record names the channel, any record of the app changed or was deleted in the last 15 minutes, or any needed box report was read incompletely. It re-lists just before the delete and deletes only the exact pointer it checked. Record writes take no app lock, so a follower created in the milliseconds between that final re-list and the delete can still be missed.

Wanted: an app-level lock (or an equivalent conditional write) held by instance creates, channel changes and retirement, so that retirement and a new follower serialise.

Fixed and merged as 78c2365 (branch retire-app-lock-407), using the app-lock option.

  • The canary retire holds s.lockApp from its final re-list (recordStamps) through the pointer DeleteIfMatch.
  • Every console write that can add a follower holds the same lock. That covers record creates (lifetimes-off instance create, sidecar create, first-route attach) and channel-bearing updates (the channel move, a confirmed proposal, instance update, gate, rate limit, updates, install). Each keeps its own provision call inside withRecordLock. Lifetime creates already held it through withAppHost.
  • Writes that cannot add a follower (moves, seed and run state, asset generations, tombstones, deletes) are deliberately not locked.
  • A create or channel move that waits for the retire lands after the pointer is gone, which the create door already allows.

TestRetireSerialisesWithFollowerWrites starts a create, and separately a channel move, while the retire holds the lock. Both landed inside the window on the old code; now they wait, and the retire goes through. A witness in every console fixture fails any console create or channel change made without the writer's own app lock. On the old code it names createRecordMarked, createSidecarMarked and handleAPIInstanceChannel.

Review: Astra round 1, READY AFTER FIXES. No P1, both P2s (witness lock ownership, losing conditional writes) fixed. Record-write census: ten units approved, plus one re-pin after merging region-ha-p1a, also approved (#280). Console only, and CI was green on the tip after re-merging main.