Skip to content

pool: a checklist for a verb that replaces a claim's record or moves it to another pool - #675

Merged
CMGS merged 3 commits into
mainfrom
pool-swap-checklist
Nov 30, 2026
Merged

CMGS merged 3 commits into
mainfrom
pool-swap-checklist

Conversation

@CMGS

@CMGS CMGS commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What

One new file, sandboxd/pool/CHECKLIST.md (170 lines). No code changes.

It is a checklist for anyone who adds or changes a verb in package pool that publishes a new *types.Sandbox for an existing id, changes a claim's Key or PolicySource, or moves a claim into another pool. Resize is the one such verb today, and the last column of every table says how it handles that row.

Why

Resize was the first verb to replace a claim's record under another pool key. Every defect review found in it had the same shape: a holder of the old record, a rule chosen by the pool key, or a check a claim passes once at admission, that the new verb had not been walked against. The lease rule, the policy layer, the evacuation's pending list, unfence's list, the replica row's key, the inject check and the move waiter were all of this kind. Nothing in the code forces that walk: the rules sit at their own entry points across the package.

What is in it

  1. Who can still hold the old record: the waiters on Transition and what each answers after a swap; the passes that copy pointers out of m.claimed, which of them write to the registry before they notice, and which conclude something global; the state keyed by the pointer.
  2. Fields a copy through the journal form drops.
  3. Rules chosen by the pool key: which key each reads (Key or PolicyKey), and whether it is read on every use or fixed on the record at claim.
  4. Checks a claim passes once, at admission.
  5. Stores that must agree, and their write order.
  6. Usage events.
  7. Known gaps of resize: fifteen accepted, each with its reason; none open after pool: a resize is refused on a fenced node when its target pool replicates; a volume change that meets a resize answers 503 #676.

It cites files and functions, never line numbers.

The two gaps it found

Reading the pool for this list found two rows resize did not handle. Both are fixed in #676, and the list records them as handled:

  • A claim that enters a replicating pool while the node is fenced was published and then answered lease lost until the fence lifted.
  • A volume PUT or PATCH whose volume lookup straddled a resize answered 404 for a claim that still exists.

Merge order

Merge #676 first: the second commit here describes its two checks as present.

How it was checked

Five readers read sandboxd/pool, the outbound files and types in full (not sampled) and listed every site in the seven categories with file and line. Every row of the checklist was then confirmed against the function it names. All 259 identifiers the file puts in backticks exist in the source.

Note: the first commit's message says "thirteen accepted gaps"; the file has fifteen. The squash message should say fifteen.

…it to another pool

Resize is the first verb that publishes a new record for an existing id
under another pool key. Every defect review found in it had one shape: a
holder of the old record, a rule chosen by the pool key, or a check a claim
passes once at admission, which the new verb was not walked against.
Nothing in the code forces that walk, because the rules sit at their own
entry points across the package.

CHECKLIST.md lists those sites by function: who can still hold the old
record (waiters on Transition, passes that copy pointers out of m.claimed,
state keyed by the pointer), the fields a copy through the journal form
drops, the rules chosen by Key or PolicyKey and whether each is read on
every use or fixed on the record, the admission checks, the stores that
must agree and their write order, and the usage events. The last column
says how Resize handles each row, and the last section lists what Resize
does not handle: thirteen accepted gaps with their reason, and two open
ones (a volume change that waited for a resize answers 404; a claim that
enters a replicating pool on a fenced node is not refused).

No code changes.
CMGS added 2 commits November 30, 2026 22:12
…ange as handled

The two open gaps of resize are fixed in their own change: fencedFor checks
the pool the claim's policy follows, at the start and at the swap, and a
volume change answers ErrReplaced for a replaced record. The volume row is
also corrected: the change does not wait on the claim's lock for a
hibernated claim, which answers ErrPaused first; it meets the swap during
its volume lookup. The file lists fifteen accepted gaps, not thirteen as
the first commit's message says.
foldTunBytes runs only from FlushClaims at shutdown, so no later fold
repairs a count written to a replaced record. SetEgressLimit is a fourth
caller of rewriteArchiveRow. resolveMoveIn does check its record. pendingCks
is keyed by checkpoint id. archive can answer ErrReplaced, and archive and
replicate upload a checkpoint before their second lock, which they delete
when the record was replaced. The tun door writes its final count onto the
record it holds. Hibernate, not the cold boot, ends the old connections.
AdmitMove and readerSource also call tenantRemoved.

Three accepted gaps stated their reason too strongly: Renew's window
includes a tenant lookup on a cache miss; a pool removed during the call
leaves the disk not grown; a row consumed through a stale record stays
consumed until the hourly sweep or the next replica.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant