Loading
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 smokegains 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.mdcarries the new count and the journey.internal/format/npm/virtual_conformance_integration_test.gois 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 onenpm installasks for.- The harness reuses the package's cleanup, blob store and cache stores helpers:
deleteNamespaceRowsand the two table-list slices (publish_stream_integration_test.go,remote_packument_harness_integration_test.go), the gate parameter onrtIntBlobStore(remote_tarball_integration_test.go), andrpCacheStores.pull_body_digestindriver.shtakes 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/3breakdown of each part's scope, files, scenarios and size, and it now asks for a## Usage datarow 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 repositoriessections (S30 Maven virtual, S32 container virtual);internal/virtualhas callers incmd/artifact-registry/wire_npm_virtual.go,wire_oci_virtual.goandwire_npm_remote.go; akind=1repository 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_foundand a missing packument answerspackage_not_found, which is what the handlers do. Criterion 7 and the "All upstreams denied" rule get the same route split:file_not_foundon the tarball route,package_not_foundon 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 smokepasses 103/103 in both boot modes: ephemeral boot, whereNPM_PUBLIC_REGISTRY_URLis empty and the virtual metadata read answers 500, and fixed boot withAR_ADDRESS=127.0.0.1:5061, where it answers 200 and then 304.- The conformance harness runs under
-tags integrationagainst Postgres from testcontainers; it passes, andgolangci-lint --build-tags=integrationreports 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-syncpasses 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)
- test(npm): npm virtual recipe and conformance h... (!3192 - merged) • David Fernandez • 19.5
👈 - test(npm): npm virtual composition rows, part 2... (!3193 - merged) • David Fernandez • 19.5
- test(npm): npm virtual failure, access and cond... (!3194 - merged) • David Fernandez • 19.5
Related to #900 (closed)
Edited by David Fernandez