S31 Step 16: dist-tags handler
Part of #290 (closed), S31 npm virtual. This slice composes code that is already merged: S11's hosted npm reads, S15's remote legs, and S13's resolution engine in internal/virtual, which Step 12 gave its first caller. The three npm_virtual_* tables land in internal/datastore/migrations/, the resolution reads in internal/datastore/, and the loading slice, the merge, the collection, and the serve surface in internal/format/npm/.
References: S31 spec · S31 plan (see "Step 16").
Type: feat | Depends on: Step 14 (composition root) (tracked as blocked-by links below).
This step's behavior reversed
!2018 (merged)'s decision, at note 3774142678, replaced the winner-only packument with a merge across every eligible upstream. The spec side landed with !2338 (merged), merged as c5ed5ef1d. #266 (closed) tracks the rest. This is the step the merge reverses rather than re-points, so it needs re-reading and not re-numbering.
The old scope read "served unchanged with no rewriting". That was two claims: the body is relayed byte for byte, and no re-point is applied to it. The merge kills the first and leaves the second, because a dist-tags body carries no URLs. A two-position read now serves bytes no position holds: the map is a union in which the lowest position wins each tag name.
The plan-side amendment travels as !2352 (merged), and no MR for this step may open before it merges, under the plan-before-code guardrail.
Scope
GET and HEAD on the dist-tags route, serving the merged dist-tags map with no rewriting applied to it. Sibling of Steps 15 and 17.
Files
internal/format/npm/virtual_disttags.go(Create).cmd/artifact-registry/wire_npm_virtual.go(Modify):npmVirtualDistTagsSlotonly..claude/skills/run-artifact-registry/SKILL.md,driver.sh(Modify): this route's section and this route's smoke check only. The check already exists from Step 14 and this step flips its expected status from501; the hard-coded smoke-check count is not touched here.- the paired test files (Create).
Acceptance
Spec AC, Packument re-point #9 (the merged dist-tags map served with no rewriting). The dist-tags slice of Spec AC, Resolution's "A just-published package is found on its hosted upstream", and the end-to-end half of that same list's "A tag-less hosted package is a Hit, not a Miss", both cited by name because the amendment renumbered the list. That half lands here because this is the only step where the criterion's three parts meet: a two-position list, a collection, and a served dist-tags body. Step 5 asserts the store-level half.
Plus Spec AC, Packument merge #6 (closed) (the two dist-tags surfaces agree), driven through this route against the packument route's own answer for the same fixture, because the rule lives in Step 13 part 1 and the agreement is only observable where both routes are mounted. Plus Spec AC, Validation and reads #1's dist-tags third (HEAD matches GET) and #4 (closed) on this route.
Tests
Handler tables across contributor mixes; the kind=1 document addressed directly rather than derived from a packument; HEAD parity.
The byte-identical assertion this suite used to carry is deleted, not adapted. A merged body matches no input, so an assertion against one position's document would have to be re-pointed at the merged bytes, which is Step 13 part 1's table and not this route's job. What lands here instead is that the bytes this route serves and the dist-tags object the packument route serves are equal for one fixture.
The tag-less hosted case inverts, and it needs two fixtures rather than one. Over [hosted_a, remote_b] where hosted_a holds a live version and no npm_tags row, the old assertion was 200 with hosted_a's {} and remote_b receiving no request. Now hosted_a's empty map is a contribution rather than a Miss, remote_b is asked, and the served document is the union of {} and remote_b's tags. The same read with remote_b removed from the list serves {}, and that second fixture is what still distinguishes a contributed empty map from a Miss, which is the property the criterion is about. Asserting only the two-position case would pass against a Miss that fell through to remote_b.
This suite mirrors Step 15's, so it is diffed against Step 15's for dropped subtests as well as added ones: reading the new file alone surfaces nothing about a predicate that went missing on the way across. That diff now has a deliberate deletion in it, and this paragraph is what tells the reviewer the byte-identical subtest was removed on purpose.
Size
Source ~270 · Test ~720 · Total ~990