feat(npm): book tarball body faults on the resolve event, part 6/8 (S31 plan: 18/19)
Summary
A fault after the tarball response has committed, and a failed drain of the winner, now override the outcome the resolve event reports: the recorder keeps the first committed body fault, and the tarball handler records the per-ending fault and the drain failure. It also documents the tarball counters and event in the npm metrics.md and docs/dev/observability.md, and carries the spec, plan, and Maven virtual metrics corrections listed below. This is part 6 of an 8-part stack for the npm virtual observability step.
Governing ADRs
None. I checked docs/adr for a decision on observability, metric families, or virtual-repository resolution events; the only mentions are the technology-stack choice of LabKit for metrics and logging (ADR 006), which this change follows without deviating, and no ADR constrains these metric names, labels, or events.
Testing
Ships body-fault tests across sources and endings, including the HEAD drain verdicts, a failed-drain test that books the winner failed, a per-source and per-arm fault test, the event outcome code pin, and the first-fault-stands recorder test. The part builds and passes vet, lint, and tests on its own tree. No e2e row is added or affected: the families and the event are internal observability, not visible from outside the service.
Size
This part is 650 reviewable lines: about 98 lines of production code and 399 lines of tests, plus about 153 lines of documentation. Each part is already a function-granularity slice shipped with the tests that cover it, so splitting further would separate a function from its tests without making either easier to review.
Plan and spec amendments
docs/specs/S31-npm-virtual.md: the resolutions counter's label isresolution_outcome(notoutcome); the upstream-requestslegdescription addsfetchfor the tarball winner'sGET; the wide-event field list namesstatusinstead ofhttp_status; and the outcome list notes thatErrLeaderCanceledandErrFillAbandonedtakesingle_flight_timeoutandErrUploadSessionsBusytakesunavailable.docs/plans/2026-08-21-s31-npm-virtual.md: the cardinality figures are re-measured, so theoutcomeset holds 26 values and the union is 42 rather than 43; theresolution_outcomeset is pinned at 24 values (Maven's seventeen, the container slice's five, and the two the npm slice adds).internal/format/maven/virtual_metrics.md: all three virtual slices carry the resolution outcomes under the one label nameresolution_outcome, and npm's upstream-request counter is now described as carrying the sameleglabel rather than as a future addition.
Stacked MRs (review/merge bottom-up)
- feat(npm): add virtual resolution metric famili... (!3197 - merged) • David Fernandez • 19.5
- feat(npm): record virtual per-position outcomes... (!3198 - merged) • David Fernandez • 19.5
- feat(npm): record virtual resolution at the sea... (!3199 - merged) • David Fernandez • 19.5
- feat(npm): classify virtual tarball resolve out... (!3200 - merged) • David Fernandez • 19.5
- feat(npm): emit the virtual tarball resolve eve... (!3201 - merged) • David Fernandez • 19.5
- feat(npm): book tarball body faults on the reso... (!3202 - merged) • David Fernandez • 19.5
👈 - feat(npm): record virtual metadata merge outcom... (!3203 - merged) • David Fernandez • 19.5
- feat(npm): emit the virtual resolve event on me... (!3204 - merged) • David Fernandez • 19.5
Related to #899 (closed)