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)