feat(maven): wire the checksum probe on and restate the sidecar posture, part 2/2 (S14 checksum observation plan: 1/1)

Summary

Part 2 of the checksum observation stack (#376 (closed)): it activates the probe part 1 (!3322 (merged)) shipped inert — flightCacheStore gains the seam and dispatches after a committed upsert, the flight holder moves to remote_flights.go, and NewHandler threads Deps.RemoteRepositoryFinder for the probe's URL re-check, wired from buildMavenDeps and shared with the dispatcher's read-path arm — and carries every surface the activation makes true or false: the S14/S30 sidecar-posture restatements, the S10 ADR-005 correction, the observability catalog, the customer-facing docs, the e2e catalog qualifications, and the e2e/functional adjustments that account for the probe's one .sha1 GET per immutable fill when it dispatches.

The probe is on for every constructed flight; a handler wired without the finder leaves it off, which is the one opt-out path. Its request build reads the credentials and then re-reads the repository row, refusing when its URL has left the flight's base URL — that read order is the refusal's soundness, so a rotated pair reaches only a URL the row still points at when the request is composed — and a moved URL logs its own upstream_url_changed reason. The build lives on the probe's own builder, which holds the finder as a required field, so the refusal cannot be reached without one. The probe stays observe-only: a mismatch, transport failure, non-200, cap breach, or shed leaves the fill's status, headers, body, and cache row unchanged; a disagreement writes one Warn-level maven_remote_checksum_mismatch record. Merge after !3322 (merged).

Governing ADRs

ADR-005 governs the S10 correction this MR carries: S10's ADR-005 reference and delivery-mode paragraph are restated as ADR 005's current Decision (the two-axis model: an instance-level default plus a per-namespace override) — a correction toward the ADR, not a deviation. Checked against the other ADRs S14 cites (001, 002, 007, 008, 009, 010, 022): no conflicts — the probe adds no schema, storage, API, retention, or boundary surface.

Why this size (LOC justification)

+1896 −482 across 31 files:

Group LOC
Fill-contract integration suites (consolidated probe file + the sidecar suites' probe switch) 746
Production seam (flight holder extraction, probe arm, handler/wiring) 683
Plan + specs + docs (plan entry, S14/S30/S10, observability, e2e catalog, user docs, run recipe) 506
Unit tests (probe builder/flights/parser + the wiring finder pin) 283
e2e harness + scenario adjustments (Unpermitted, four suites) 160

The integration suites assert the fill contract with the probe on and cannot land before the seam they exercise; the spec restatements cannot land after the behavior that makes them true. The consolidated probe file merges the revalidation and sidecar-cold cases the suites previously held twice, so a shared scenario has one body, not two.

Plan and spec amendments

  • docs/specs/S14-maven-remote.md — the sidecar-fetch posture restated everywhere it appears: no sidecar response relays an upstream sidecar; the one upstream .sha1 GET is the fill-time probe behind a committed immutable fill. The per-fill request counts are qualified to GETs to the requested path and to the probe's dispatch, so a shed or refused probe leaves one; Security considerations and the Follow-ups entry are marked delivered, and the Follow-ups entry is now the one definition of probe eligibility, linked from docs/dev/observability.md and docs/testing/e2e/maven.md.
  • docs/specs/S30-maven-virtual.md — the same restatement at its four statements, its two acceptance criteria narrowed rather than deleted.
  • docs/specs/S10-maven-hosted.md — the ADR-005 reference and the delivery-mode paragraph restated as ADR 005's two-axis model (an instance-level default plus a per-namespace override) rather than the retired redirect / proxy / hybrid triple. Its own commit, so a reviewer can drop the correction without touching the step.
  • docs/plans/2026-09-28-maven-remote-checksum-observation.md — the shipped step's entry recorded, and its text corrected where review proved it wrong: the switch references become the always-on probe, left off only by a handler wired without a finder; the credential-then-row read order and the upstream_url_changed reason; the flight unit's home and the URL re-check with its finder; the consolidated probe test file; the e2e Unpermitted helper and the cold-miss row's probe-GET guard; and the S14/user-doc link wording. The Status row records this MR.
  • docs/user/formats/maven.md — the remote/virtual how-to states the extra upstream .sha1 request each immutable fill makes, as a customer observes it.

Spec coverage

Spec: docs/specs/S14-maven-remote.md, the amended clauses this MR carries. The parser and dispatch decision table are covered by !3322 (merged)'s unit suites.

Criterion Tests
Mismatch fill: identical status, headers, and body; cache row commits; one Warn record TestRemoteChecksumProbe_MismatchObservesWithoutChangingTheFill
Agreement, 404, upstream 500, unparseable, and oversize bodies: no mismatch record, same fill outcome TestRemoteChecksumProbe_AgreementAndUnusableSidecarStaySilent
Immutable files only: metadata, a metadata parent behind a sidecar, and non-timestamped snapshots dispatch no probe TestRemoteChecksumProbe_ImmutableFilesOnly
A truncated (failed) fill dispatches nothing TestRemoteChecksumProbe_TruncatedFillDispatchesNothing
A failed upsert dispatches nothing TestFlightCacheStore_UpsertFailureDispatchesNoProbe
One probe GET per committed immutable fill, not per client request TestRemoteChecksumProbe_ParentFillProbesOnceAndSidecarIsSynthesized
A replacing 200 probes (artifact read and sidecar synthesis alike); a 304 commits and probes nothing TestRemoteChecksumProbe_ReplacingRevalidationProbes
A moved URL refuses at build, after the credential read and the row re-read that follows it TestRemoteChecksumProbe_URLMovedMidFillRefuses, TestProbeRequestBuilder_BuildChecksumProbeRequest_RefusesWhenTheURLMoved
A refused build logs its own reason: upstream_url_changed for a moved row URL, request_build_failed for every other build fault TestFillChecksumProbe_Dispatch_NoComparisonExitsLogDebugReason
A handler wired without the finder leaves every flight unprobed: no probe GET, no record TestRemoteChecksumProbe_FixtureOptOutIssuesNoSidecarGet
Production wiring sets every Deps seam, the finder included, and carries a non-nil value TestBuildMavenDispatcher_DepsLiteralCarriesEverySeam, TestBuildMavenDeps_WiresTheRepositoryFinder

Security considerations: credentials never appear on the mismatch record — pinned by the attribute sweep in the mismatch integration case — and the refusal's read order (credentials first, the row re-read last) is pinned by the builder's refusal case, whose finder hook asserts the credential read ran first, and by the mid-fill moved-URL case.

e2e scenarios

No scenario added or removed — the client-visible contract of every fill is unchanged. docs/testing/e2e/maven.md's sidecar paragraphs and the artifact-cold-miss row are qualified to the probe's GET; the scenario harness accounts for the detached probe GET through mavenupstream.Unpermitted — one permit per named path, leaving the caller's slice untouched — so a pending probe no longer races an exact count. The artifact-cold-miss row also waits for the probe's .sha1 GET now, so the production finder's key is exercised end to end, and the shared integration fixture's finder forwards the keys it is asked for, so a wrong probe key refuses instead of silently passing.

Testing

  • go test ./internal/format/maven/... ./cmd/artifact-registry/... green
  • the full internal/format/maven integration suite (-tags=integration) green
  • golangci-lint run clean (0 issues); the integration-tag pass (--build-tags=integration, with --max-same-issues=0 --max-issues-per-linter=0 --uniq-by-line=false) reports only pre-existing findings on lines this stack does not touch — nothing on any line this MR adds; the e2e-tag pass over the touched e2e packages is clean too
  • The integration suites run in CI; the e2e suites run in CI (no Caproni rig in this session)

Closes #376 (closed)

Edited by Moaz Khalifa

Merge request reports

Loading
Loading