fix(datastore): fence the npm dist-tag write (#1902 stack: 1/3)
This part closes the tombstone window on the npm dist-tag PUT.
NpmDistTagTxWriter.SetTag takes the repository id the handler already resolved, opens its transaction at READ COMMITTED, and fences it first with the new fenceRepositoryAlive helper, which re-reads the repository row with a shared lock and maps a miss to datastore.ErrRepositoryConcurrentlyDeleted.
The dist-tag handler bounds the write at lifecycle.TombstoneTimeout and answers the repository-tier 404 repository_not_found when the fence refuses.
It stands on its own: the helper, its stub-verifier unit test, the writer's guard and integration race tests, and the handler tests all ship here, and the other two write paths are untouched until the parts above.
Stack
This merge request is part 1 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) (this merge request)
- !3980 (merged) fix(datastore): fence the npm deprecate write (#1902 (closed) stack: 2/3)
- !3961 (merged) fix(datastore): fence the container tag upsert (#1902 (closed) stack: 3/3)
It is the bottom of the stack and merges first. !3980 (merged), the part above it, targets this one and merges after it.
Related to #1902 (closed)
This is a bot message