feat(npm): record virtual per-position outcomes, part 2/8 (S31 plan: 18/19)

Summary

Adds the per-position outcome recorder for npm virtual resolution: the recorder type, its context key and accessors, and the observation methods for lookup, probe, fetch, outage-read, unhealthy, and exclusion outcomes. It also adds the request-sent predicates that decide whether a leg counts, and declares the not-sent sentinel errors those predicates recognise. This is part 2 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 recorder unit tests in virtual_observe_internal_test.go with fakes for the upstream, prober, fetcher, and cache: observation order, lookup and probe outcomes, fetch failure and leg booking, cancellation, retry, refused-before-send, coalesced fetch, outage read, health verdict, and exclusion reasons. 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 789 reviewable lines: about 365 lines of production code and 424 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.

Stacked MRs (review/merge bottom-up)

Related to #899 (closed)

Edited by David Fernandez

Merge request reports

Loading
Loading