fix(datastore): fence the container tag upsert (#1902 stack: 3/3)
This part closes the tombstone window on the management API container tag upsert, the last of the three write paths.
ContainerTagUpserter.UpsertTag takes the resolved container repository id, opens its transaction at READ COMMITTED, and fences it first with the fenceRepositoryAlive helper from the bottom part; upsertContainerTag bounds the write at lifecycle.TombstoneTimeout and answers 404 not_found when the fence refuses.
The 404 arm logs one INFO line, so an operator can tell the tombstone race from a resolver miss.
A write that outruns the bound while the client is still connected answers 500, and its log line names the bound.
Before the bounded write, the route arms its own response write deadline at the bound plus tombstoneResponseGrace, as delete.go does, so that 500 reaches the client before the connection deadline drops it.
The npm dist-tag PUT and the npm deprecate routes now arm the same kind of response write deadline before their bounded write.
One helper in internal/format/npm/write_deadline.go arms it for both, so their 500 past the bound also reaches the client.
With all three paths fenced, the tombstone-window row of the spec, the deleteRepository description in api/openapi/v1.yaml and the Bruno doc move them out of the open set.
They no longer point the remaining gap at issue #901 (closed), and the spec row now states that a new write path must re-verify the repository in the transaction that writes its rows.
It carries its own guard, integration race and handler tests, and the docs land here because only this part makes their statement true.
No migration and no new SQL: the three writers reuse the existing ReVerifyRepositoryAlive statement.
Stack
This merge request is part 3 of 3 of one reviewed change (vespian_gl/issue-1902-close-the-repository-tombstone-window), split into a stack so each part is reviewable on its own. Merge the parts in this order, bottom first:
- !3979 (merged) fix(datastore): fence the npm dist-tag write (#1902 (closed) stack: 1/3) (merged)
- !3980 (merged) fix(datastore): fence the npm deprecate write (#1902 (closed) stack: 2/3) (merged)
- !3961 (merged) fix(datastore): fence the container tag upsert (#1902 (closed) stack: 3/3) (this merge request)
Parts 1 and 2 merged, so this merge request now targets main.
It is the top of the stack and merges last.
Closes #1902 (closed)
Database Review Evidence
Queries
No new or changed query statements to review: the statements this MR's writers dispatch are byte-identical to the merge base.
The change adds the existing repository re-verification as the first statement of three READ COMMITTED transactions: the container tag upsert, the npm dist-tag write and the npm deprecate write.
Collected by db-review-prep (query mode) at 2099a8408. No migrations changed.
This is a bot message