feat(npm): wire rebuild enqueue + tests (npm hosted step 12, part 5/5)

This change is split into 5 stacked MRs to keep each within review size. Each part targets the previous one (part 1 targets main); review and merge bottom-up, part 1 first.

Part 5 of 5 of docs/plans/2026-05-11-npm-hosted.md — Step 12: packument cache rebuilder (in-process).

Wires the inline-build paths to the rebuilder (packument_get.go and disttags.go call enqueueRebuild after serving a cache-miss; buffered.go gains the s22-observability registration marker), adds the test-only export seams in export_test.go, and lands the integration suite in packument_cache_integration_test.go. Also updates the Step 12 plan entry to match the shipped behavior.

Spec coverage

Acceptance criterion Test
AC 29 — concurrent enqueues produce one rebuild per package TestRebuildPackumentCache_Singleflight
Zero-versions package rebuilds cleanly TestRebuildPackumentCache_ZeroVersions
Deterministic rendered bytes TestRebuildPackumentCache_DeterministicBytes
Prior attachment left unreferenced (GC-eligible) TestRebuildPackumentCache_PreviousAttachmentUnreferenced
Per-rebuild allocation is bounded TestRebuildPackumentCache_MemoryBound
Panic safety — panic increments result="panic", process survives TestRebuildPackumentCache_PanicSafety

Related to #130 (closed)

Stacked MRs (review/merge bottom-up)

Edited by David Fernandez

Merge request reports

Loading
Loading