The kept-plan stamp left out whether a planned sequence's photos are hashed.
A verify writes frames.sha256 (and only status and verified_at on the row)
without another frames version, so after verifying never-hashed photos the
same dry run kept answering "verify the sequence first" for up to five
minutes, and its confirmation queued a job certain to fail.
- SequenceRepository.GetStampAsync adds, for every planned sequence, how many
of its photos have their hash in the index (one grouped query over the
archive with all, the selected ids in batches of 500 otherwise).
- ReorganizePlanCache keeps a refusal (nested_target, not_found) as it keeps
a plan: for the same stamp and templates it is the same, and a long plan
that ends refused after a cut-off is no longer planned again on every retry.
Failures are still not kept.
- Planning is bounded: at most two plans are made at once, the others wait for
their turn; a plan still being made 15 minutes after it was asked, let go at
capacity, or when the server stops is cancelled, and whoever waits for it
gets 503 plan_dropped. A read that hangs keeps its turn until it returns but
no longer keeps its waiters.
- The Capacity summary now says what eviction does (the kept plan asked for
first, else the plan being made asked for first); the stamp, protocol and
endpoint docs say that a verify hashing photos is a change the plan reads.
- Tests: a scan's photos, verified, are planned again and renamed by the job;
the stamp follows hashes of planned photos only; refusals kept, failures
not; turns, eviction and deadline of plans being made, a hung read included.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 56582df45453fc555e525f19de7de1803204d12c)
A kept dry run was keyed on a stamp of every sequence row of the archive,
updated_at and verified_at included, so any upload, ingest status write,
verify or tag edit anywhere invalidated it and the confirm planned the whole
selection again. The plan was also bound to the request, so a proxy cutting
the request off cancelled it and a retry started over.
- The stamp (SequenceRepository.GetStampAsync) now hashes only what the
planner reads from the index: every row's id and folder (collisions and
what a moving folder carries), the planned rows' title, first capture,
camera, lens, photo count and frames version, and the titles of the rows
inside a planned folder. With all, every row is planned.
- ReorganizePlanCache makes a plan on the thread pool with the host's
stopping token, once per key for concurrent requests; a request cut off
only stops waiting, and the same request again waits for the plan or
takes it. Refusals and failures are still not kept.
- A kept plan is dropped by its own timer five minutes after it was made
(and never used past that), instead of staying until the next request.
- The protocol and endpoint docs say that plan_changed answers changes the
index has; one made on disk alone is found by the job, which fails and
changes nothing. The Capacity doc no longer claims a step per sequence.
- Tests: what the stamp follows and ignores, a kept plan surviving an upload
elsewhere and a verify, one plan for concurrent requests and after a
cut-off, the timer, an all:true apply carrying a nested sequence beside a
blocked-only one, the first sequence told before a pause. The
no-archive-module job_unavailable test expected a folder the planner no
longer plans without a sidecar; it now expects the unreadable step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 7e01a4f85fe4b880ddd98a481fc8591649cec254)
An all:true dry run reads every sidecar and photo folder of the archive inside
the request, and the confirm planned the whole archive again before answering
202. The server now keeps each dry run's plan for five minutes (eight plans at
most) by archive, selection, templates and a stamp of the archive's index rows:
the same dry run again and its confirmation take the kept plan, and any change
the index records (an upload, an edit, a move, a scan, a verify) gives another
stamp and a new plan. A change made on disk alone is not in the stamp; the move
job still plans again and refuses a plan that no longer matches.
Server tests now cover an all:true apply around a sequence already in place, a
real plan_changed after an upload, a move job paused between two sequences and
resumed, archive_offline, job_unavailable, more than 1,000 ids and the kept
plans themselves; a Data test covers the index stamp.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 71bb53fbf8eb7d0327ea692d046634b12f8d37e9)