test(npm): npm virtual recipe and conformance harness, part 1/3 (S31 plan: 19/19)

Summary

Part 1 of 3 of the S31 (npm-virtual) plan, step 19: the end-to-end harness and e2e catalog. This stack has 3 MRs, each targeting the previous one; review and merge them bottom-up. The spec is S31 (npm-virtual).

This part adds the run-recipe journey and the Go conformance harness:

  • driver.sh smoke gains six npm virtual checks (97 to 103): seed an npm install fixture, publish it to a hosted repository, read the merged packument through the virtual repository, pull the tarball and compare its body to what was published, and deny the package on the remote association so the journey never reaches the public registry. SKILL.md carries the new count and the journey.
  • internal/format/npm/virtual_conformance_integration_test.go is a hermetic install journey against real Postgres, the production handlers, and a loopback upstream (TestNpmVirtualConformance_InstallJourney), run once for the full packument and once for the abbreviated one npm install asks for.
  • The harness reuses the package's cleanup, blob store and cache stores helpers: deleteNamespaceRows and the two table-list slices (publish_stream_integration_test.go, remote_packument_harness_integration_test.go), the gate parameter on rtIntBlobStore (remote_tarball_integration_test.go), and rpCacheStores. pull_body_digest in driver.sh takes the digest width, so the npm journey no longer carries its own copy.
  • Plan and spec corrections the work surfaced, listed below.

Parts 2 and 3 add the e2e scenario rows and their catalog entries.

Plan and spec amendments

  • Plan step 19 is rewritten to the three-part shape this stack ships, with a #### Part 1/2/3 breakdown of each part's scope, files, scenarios and size, and it now asks for a ## Usage data row for each declared scenario that emits an event. Its size forecast is recomputed from the measured diff.
  • Plan stale premises corrected: the sibling catalogs already carry ## Virtual repositories sections (S30 Maven virtual, S32 container virtual); internal/virtual has callers in cmd/artifact-registry/wire_npm_virtual.go, wire_oci_virtual.go and wire_npm_remote.go; a kind=1 repository is reachable through the management API, so the plan's uninstrumented-window paragraph now says the window is open to real traffic and why that is still acceptable.
  • Spec Resolution criterion 6 is corrected: a missing tarball answers file_not_found and a missing packument answers package_not_found, which is what the handlers do. Criterion 7 and the "All upstreams denied" rule get the same route split: file_not_found on the tarball route, package_not_found on both metadata routes.

The plan's Status table is not edited here.

Governing ADRs

None. The change adds tests, a run recipe, and documentation; it changes no runtime behavior.

Testing

  • driver.sh smoke passes 103/103 in both boot modes: ephemeral boot, where NPM_PUBLIC_REGISTRY_URL is empty and the virtual metadata read answers 500, and fixed boot with AR_ADDRESS=127.0.0.1:5061, where it answers 200 and then 304.
  • The conformance harness runs under -tags integration against Postgres from testcontainers; it passes, and golangci-lint --build-tags=integration reports nothing in the new file.
  • E2e catalog: part 1 adds no scenario row. The e2e rows and their catalog entries land in parts 2 and 3, each in the same part as the test that declares it so lint:e2e-catalog-sync passes at every part.

docs/user/** is not affected: nothing here changes a customer-visible surface. Documenting the Maven and npm virtual repositories for users is a follow-up.

Size

About 1,100 reviewable LoC (about 920 added, 185 removed), split by file group:

  • Conformance harness (virtual_conformance_integration_test.go): 594. One journey, run for the full and the abbreviated packument, plus a subtest that checks the two variants carry different validators. Each variant and the validators subtest build their own fixture (three Postgres, blob store, and upstream fixtures), which is why the file is one harness and not two.
  • Existing integration test files, reworked so the harness shares their helpers instead of copying them (publish_stream_integration_test.go, remote_packument_harness_integration_test.go, remote_tarball_integration_test.go): 118 changed lines.
  • Run recipe (driver.sh, SKILL.md): 202.
  • Plan and spec edits: 191.

Stacked MRs (review/merge bottom-up)

Related to #900 (closed)

Edited by David Fernandez

Merge request reports

Loading
Loading