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 is resolution_outcome (not outcome); the upstream-requests leg description adds fetch for the tarball winner's GET; the wide-event field list names status instead of http_status; and the outcome list notes that ErrLeaderCanceled and ErrFillAbandoned take single_flight_timeout and ErrUploadSessionsBusy takes unavailable.
  • docs/plans/2026-08-21-s31-npm-virtual.md: the cardinality figures are re-measured, so the outcome set holds 26 values and the union is 42 rather than 43; the resolution_outcome set 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 name resolution_outcome, and npm's upstream-request counter is now described as carrying the same leg label rather than as a future addition.

Stacked MRs (review/merge bottom-up)

Related to #899 (closed)

Edited by David Fernandez

Merge request reports

Loading
Loading