fix(archive): a scan never writes an older sidecar over a newer index commit

The scan's plain branch indexed a sidecar read without the lease. When an
upload or a partial writer (decode tiers, a verify) committed between that
read and the scan's transaction, the scan wrote its older copy over the
newer row and frames (dropping the uploaded frame rows), then recorded
the folder's current stamps, so incremental scans skipped the regression.

Under the row lock, SyncAsync now refuses an unleased read when the
sidecar no longer has the stamp the scan listed or the row holds another
frames version, and the scan reads the sidecar again under the lease. An
unleased sync records the stamps it was checked against, and the index
snapshot files each sidecar under the stamp it was read at. Under the
lease, a sidecar behind the locked row (an older copy put back) is
written again one frames version past the row, so the version never goes
back. Statuses cleared in this host's row only (Uncovered) now pass as a
parameter, so that rewrite never clears them in the shared sidecar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-12 21:35:24 +00:00
1 parent 1b84d74486
commit b187e6ce02
3 files changed
+154 -14

No files matched your search

+1 -1
View File
@@ -468,7 +468,7 @@ public sealed class ArchiveIngest : IArchiveIngest
&& await _db.Frames.CountBySequenceAsync(manifest.Id, cancellationToken).ConfigureAwait(false) == before;
if (!inStep)
{
await _indexer.SyncAsync(archive, sequence, manifest, cancellationToken).ConfigureAwait(false);
await _indexer.SyncAsync(archive, sequence, manifest, null, SequenceStatus.None, cancellationToken).ConfigureAwait(false);
return;
}
PositionMove? placed = null;