feat(npm): classify virtual tarball resolve outcomes, part 4/8 (S31 plan: 18/19)
Summary
Makes the recorded legs reflect requests that were actually sent: a probe request builder and not-sent marking on the memoised fetch, so refused or coalesced calls book no leg. It adds the recorder's verdict state (assembled list, read result, drain result) and the pure tarball outcome classifier that maps a read result or error to a resolution outcome, together with a status-recording response writer. This is part 4 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 the classifier ordering and no-error tables, the route-outcome and hosted/busy arm pins, status writer tests, drain-fallback and sent-legs tests, and the fetch-unsent preflight tests. 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 898 reviewable lines: about 262 lines of production code and 636 lines of tests. 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
Review of this part showed that npm recorded every hosted veto as hosted_rebuild_refused, where the Maven classifier records a failed hosted read as infrastructure_error and a budget expiry as budget_expired. Commit 00fc0a2d aligns npm with Maven and corrects the S31 clauses that stated the old mapping: the acceptance criterion on a vetoed hosted Hit, the Error Cases rows for a hosted-Hit failure and for a budget expiry, and the Wide events paragraphs on vetoed hosted reads. hosted_rebuild_refused now means a refused S11 rebuild only. No plan text changes.
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)