You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7cea13d
Browse filesBrowse the repository at this point in the historyBrowse files
Wire the same-SHA replay through one atomic reservation
ReserveCandidateVersion had zero production callers. The real ingress created
and catalogued in four statements, so a second upload of identical bytes wrote a
fresh raw storage object and then attached it to the version already on record,
and a repeat ingest redid Docling, embedding and projection work that version
already owned -- conversions that run up to 900s.
ReservePipelineCandidateVersion now owns the raw object, the version and the
asset binding in ONE statement, and PostgresCatalogStore.RecordAssetVersion
routes through it. The object INSERT names a version that does not exist yet
because both foreign keys are DEFERRABLE INITIALLY DEFERRED (0093:378-394);
every hand-off travels through a RETURNING projection, since data-modifying CTEs
cannot observe each other's effects on the underlying tables.
The statement projects replay_is_active -- ready AND activated AND the document's
active version -- surfaced as CandidateVersion.ReplayedActive and
DocumentVersionRecord.ReplayedActive. DocumentVersionRecord deliberately gets NO
bare Replayed: identity of bytes without liveness would let a caller
short-circuit on a still-processing version and mark an unindexed document
searchable. document_processor short-circuits ONLY on ReplayedActive, omitting
pipeline_activation_job_id so the queue worker still settles the job; every other
case, replay included, falls through to Pipeline.Run unchanged, so this is a
strict improvement rather than a trade.
A replay's duplicate bytes are ledgered under a non-raw kind bound to the same
version. That row is not decoration: SoftDeleteDocument sweeps storage_objects by
document_id with no kind filter, and FinalizeDocumentDelete refuses to finish
while any live row carries that document_id -- without it the duplicate asset's
bytes would outlive their document. CreateStorageObject is kept for that reason;
UpdateStorageObjectVersion, LinkAssetDocumentVersion and the duplicate
deterministicDocumentVersionID are deleted as dead.
Verified on a disposable database with all 68 migrations, driving the rendered
live query text: fresh insert, replay onto a non-activated version, idempotent
re-drive that does not demote the raw object, replay onto an activated version,
and a same-key different-sha attempt that returns zero rows. End state one live
version, one live raw object, duplicates reaped by the delete sweep, and the
version still owned by the FIRST asset. T1 was proven to fail against the old
body by executing it: two live raw objects where it asserts one.
The sqlc.arg(id)::uuid cast in `binding` is load-bearing, not cosmetic -- sqlc's
static analyzer cannot name a select-list expression wrapping a named parameter
(sqlc-dev/sqlc#1646, #3991) and codegen fails for the whole package without it.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KzRkrbwUqo2oWsryXKc34F
0 commit comments