Repository navigation
Description
A Crew archives only as a unit, and a Captain with a live Crew is never archived alone. Two windows let seats come into existence under a Crew that is already retired or a Captain that is already gone.
Where it breaks:
captainFor(apps/server/src/j5/a2a/CrewProposalService.ts:254-268) reads the Captain thread's projection and never checksarchivedAt. A roster proposal still open when the person archives or deletes the Captain can be approved afterward; the cascade inCrewCaptainArchiveCascade.tsalready ran when there was no live Crew, so the new seats are placed under an archived Captain and nothing retires them.ArchiveCrewServicereads the roster (ArchiveCrewService.ts:344), archives those members, and stamps the record retired only at:437. An approved addition can reserve and spawn a seat between those steps. That seat is live and addressable beneath a Crew record that says retired.
What should change:
- A proposal whose Captain thread is archived or deleted is refused at resolution with a message that names the Captain, and the boot sweep declines such proposals.
- Launch and addition take the same serialization as archive on the Crew record, so either the approved seats are included in the unit retirement or approval is refused before any seat is created. Whatever the mechanism (a status on the instance row checked inside the same transaction that reserves members, or a claim on the record), it has to hold across a restart between steps.
- The Captain cascade's boot reconcile catches a Crew created against an archived Captain, as a last line.
Tests to ship (CrewProposalService.test.ts, ArchiveCrewService.test.ts, CrewCaptainArchiveCascade.test.ts):
- approve an open roster after the Captain was archived; after the Captain was deleted
- archive interleaved after an addition's validation but before its reservation; after its reservation but before its spawn
- archive's roster snapshot taken before an addition lands
- in every case no running or addressable seat remains under a retired Crew
- drive interleavings with Deferred and receipts, never with sleeps or polling
Done when a retired Crew has no live seats and an archived Captain acquires no new Crews, under any interleaving with an open gate.
Related criteria: crews.md AC17, AC19.
Dependencies: land #224 first. Refusing a launch into a retiring Crew leaves reservations with no thread behind them, and unit archive has to be able to finish over those rows before this race can be closed and tested end to end. Soft: #221 first, so a refused launch always has a proposal linked to its recorded Crew.
Activity
fix(crews): no seat launches into a retired Crew or under a gone Capt…