Skip to content

Correctness fixes: checked pyramids only, frozen lists that stay consistent, a binding saved after its crops - #93

Merged
krokicki merged 13 commits into
labelled-anyfrom
correctness-fixes
Nov 23, 2026
Merged

krokicki merged 13 commits into
labelled-anyfrom
correctness-fixes

Conversation

@krokicki

@krokicki krokicki commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Fixes from the 2026-11-22 correctness review and its follow-up, one commit each with a test. No new feature, no stage or action change, no wire-format change.

What changes

Staging

  • A pyramid is served only once harness check-stage passed it: read_stage requires verification.ok true on a build before it is published and on a published pyramid before it is reused. harness stage writes the block with a null ok; a job that ended between the two commands no longer publishes. The live staged root was scanned: the 21 pyramids without a passed check all predate check-stage and no buffer references them.
  • verify_drop skips a dropped file only when the cache holds its bytes, not on a files.json entry alone.
  • The keeper reads the asset row with its references again under its lock and spares one referenced or used since the plan (new Registry.asset_row).

Frozen eval lists and the ledger

  • A deleted volume's frozen rows leave and each list closes up (indices and seq renumbered), so the next append no longer collides.
  • A volume re-registered under another artifact or with other candidates clears the buffer's frozen lists inside the same ledger transaction as the volume write; the buffer's reference to the old artifact goes with it when no other volume lives there.
  • A quarantined volume's frozen rows leave when a list is next served, before the buffer's round unregisters it.

mia-data

  • publish copies the binding after the crops, so a Conflict leaves the earlier binding and manifest authoritative and prepared_row does not call the new binding prepared.

Preparation requests

  • A request looks at every pinned dataset once more before it rests at needs-human, and once again right after that write (behind the patch marker prep-stuck-look), so a dataset that was shelved or prepared while others were still preparing is seen.

Client and locks

  • BufferDataset raises IndexError past len for the train split too, so a plain for over it ends.
  • LockDir.release looks at the holder before it renames anything, so a release after the lock was lost never takes a new owner's lock out of play.

Rollout

The prep-stuck-look marker means running requests pick up the request fixes after a worker restart. Nothing else needs a step.

Checks

Full suite (1931 tests), pixi run lint and pixi run typecheck pass; the diff names no real path or host.

@StephanPreibisch @jakobtroidl

krokicki and others added 13 commits November 22, 2026 21:19
Deleting a volume left holes in the buffer's frozen lists, and the next append
collided on the primary key (extend_frozen appends at the list's count) while the
split replay indexed the rows by position. The surviving rows now take indices
0..n-1 again, each with its seq.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
harness stage writes ok before harness check-stage records its verification, and
read_stage published on ok alone, so a job that ended between the two (a walltime
kill during the check) left a pyramid later rounds would reuse. A build with ok
and no verification now fails the round and stays for the .building-* sweep.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…epared

publish installed the new binding before copying the crops, and the reindex in
its finally stamped that binding's hash on whatever had landed, so a crop that
failed its checksum left a folder prepared_row called prepared with an empty or
partial set. The binding now lands once every crop is in; a Conflict leaves the
earlier publication authoritative.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… staged reference

put_volume replaced the volume row but only added references, so a volume that
moved to a new artifact left the buffer referencing the old one and the keeper
kept it on disk until the buffer retired. The reference now goes with the move
when no other volume of the buffer still lives in that artifact, as a deletion
already did.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…e it rests

The poll asked only about records not yet settled, so a dataset that stopped
early and was shelved while another was still preparing kept its stale
needs-human and the request rested at needs-human with nobody left to tell it
(a recheck comes only to a request already resting). Before resting, the round
reads every pinned record once more; behind a patch marker for the runs that
rest there already.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
It skipped any URL files.json listed, and a HEAD or a read by range lists a file
without keeping a byte, so a dropped replacement could be reported in place while
the offline stage job found an empty cache. The skip now asks cache_missing, as
raw_ready does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The sweep planned from one snapshot and deleted on the old row, while a buffer
that reuses a pyramid registers it with no lock: a registration between the plan
and the deletion left the buffer pointing at a missing directory. The keeper now
reads the row with its references once it holds the lock and leaves one that is
referenced or used since.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A map-style dataset with no __iter__ is iterated by index until IndexError, and
the train branch returned a crop before the bounds check, so a loop over the
dataset itself never ended. The check now comes first for every split.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A release by an owner whose lock had lapsed renamed the live lock aside before
reading whose it was, so for a moment the new owner's heartbeat found it gone.
Another owner's lock is now left alone; the put-back stays for one that changes
hands between the look and the rename.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
harness stage writes ok with a verification whose ok is null; check-stage sets it true. read_stage requires that
true, on a build before it is published and on a published pyramid before it is reused.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…n lists in the same write

put_volume compares the stored volume with the new one inside its transaction and removes every split's
frozen rows there, returning the count; a buffer-api that stops between the volume write and the clear can no
longer leave the new volume with rows drawn from the old candidates.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… served

The split route drops the rows of every quarantined volume before it reads the list, with the same compaction
that runs at unregister, so a revoked volume is not handed out through a frozen list while another volume keeps
the split open and the buffer's round has yet to unregister it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
buffer-api tells a request of a dataset that settles only once the request's stage reads needs-human, so one
that settled between the round's last look and that write was not seen until the next buffer-api start; the
request now looks once right after the write, under the prep-stuck-look marker.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@krokicki
krokicki changed the base branch from dataset-filters to labelled-any November 23, 2026 02:27
@krokicki
krokicki added this pull request to stack #75 November 23, 2026 02:27
@krokicki
krokicki merged commit 31995af into main Nov 23, 2026
1 check passed
@krokicki
krokicki deleted the correctness-fixes branch November 23, 2026 02:50
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