feat(maven): add the inert checksum probe arm and its URL builder, part 1/2 (S14 checksum observation plan: 1/1)

Summary

Part 1 of the two-part stack delivering the observe-only fill-time checksum mismatch observation for Maven remote repositories (#376 (closed)): the probe arm (internal/format/maven/remote_checksum_probe.go), the probe-only .sha1 URL composition (remote_upstream.go), and their unit tests — all package-internal and inert. No production caller constructs the probe on this MR, so fill behavior is unchanged and no spec text moves.

Part 2 (!3323 (merged), stacked on this branch) wires the seam on from wire_maven.go through NewHandler and carries the S14/S30 sidecar-posture restatements with it, so no link of the stack leaves spec text false on main.

Governing ADRs

None govern this part. Checked against the ADRs S14 cites (001, 002, 005, 007, 008, 009, 010, 022): part 1 adds no boundary, schema, storage, API, retention, or delivery-mode surface — the probe is observe-only and, on this MR, unreachable from production. The S10 ADR-005 correction rides part 2.

Why this size (LOC justification)

+1807 −57 across 8 files. The bulk is the probe's unit suite, which cannot leave the code it tests:

Group Files LOC
Probe unit tests remote_checksum_probe_test.go 1213
URL-composition tests remote_upstream_test.go, remote_upstream_rejections_test.go 198
Probe arm remote_checksum_probe.go 301
URL composition + request builder remote_upstream.go, parse.go 39
CI .gitlab-ci.yml (fuzz:maven gains FuzzParseDeclaredSHA1) 3
Plan Approach restated for the stack; review-proven corrections 39

A split that moved the unit suite off the code it covers, or the seam onto main without the probe, buys no smaller reviewable unit.

Plan and spec amendments

  • docs/plans/2026-09-28-maven-remote-checksum-observation.md — the Approach bullet "One MR" is restated as "Two stacked MRs", naming the split and the reason (review size): part 1 ships the probe arm package-internal and inert; part 2 wires the seam on and carries the spec restatements. The Status table keeps its one step; part 2 records the row.
  • The same file's Approach paragraph is corrected to match the code: path classification runs on the fill's stack before the acquire, while the credential read and the request build run inside the spawned goroutine.
  • The same file's dispatch bullet is corrected: a full semaphore logs the Debug shed_at_capacity reason line rather than shedding silently.
  • The same file's Files bullet for remote_upstream.go is corrected to the composition at head: target() plus the Path and RawPath append, with the test expectations the branch carries.
  • The same file's Files list gains parse.go for the shared matchesUniqueSnapshotFile extraction the probe's eligibility check uses.

Spec coverage

Spec: docs/specs/S14-maven-remote.md, the follow-up this stack delivers; the amended clauses land in !3323 (merged). This MR carries the parser and the dispatch decision table; the fill-contract acceptance criteria are covered by !3323 (merged)'s integration suites.

Behavior (this MR's scope) Tests
Declared-.sha1 body parser: bare hex, shasum-style, *binary, CRLF, uppercase, garbage, short token TestParseDeclaredSHA1, FuzzParseDeclaredSHA1
Path eligibility: release and timestamped-snapshot files probe; metadata, non-timestamped snapshots, and sidecar names never TestChecksumProbeEligiblePath, TestFillChecksumProbe_Dispatch_EligiblePathsProbe, TestFillChecksumProbe_Dispatch_IneligiblePathDispatchesNothing
Mismatch emits the Warn record with every field TestFillChecksumProbe_Dispatch_MismatchEmitsWithAllFields, TestEmitChecksumMismatch_LogsWarnWithEveryField
Agreement and every no-comparison exit stay silent and log one distinct Debug reason TestFillChecksumProbe_Dispatch_AgreementStaysSilent, TestFillChecksumProbe_Dispatch_NoComparisonExitsLogDebugReason
Every non-200 and unparseable body drains and closes the response; a cap breach drains at most one cap more TestFillChecksumProbe_Dispatch_BodyDrainedOnSmallNonSuccessAndUnparseable, TestFillChecksumProbe_Dispatch_CapBreachDrainIsBounded
Shed at a full semaphore drops the probe, never queues it TestFillChecksumProbe_Dispatch_BoundsInFlightProbes
Nil seam is inert; the semaphore is per flight; a panicking seam or logging handler is contained and meters nothing TestFillChecksumProbe_NilSeamIsInert, TestNewFillChecksumProbe_SemaphoreIsPerFlight, TestFillChecksumProbe_PanickingSeamIsContained, TestRecoverChecksumProbe_ContainsAPanickingHandler, TestFillChecksumProbe_ShedAndPanicMeterNothing
The probe runs detached and bounded; the fill never waits on it TestFillChecksumProbe_Dispatch_RunsOnADetachedBoundedContext, TestFillChecksumProbe_Dispatch_ReturnsWithoutWaitingOnTheBuild
Probe .sha1 URL composition appends to the file element and keeps Path and RawPath consistent; unsafe coordinates refused TestUpstreamRequestBuilder_BuildChecksumProbeRequest_AppendsSHA1ToTheFile, TestUpstreamRequestBuilder_BuildChecksumProbeRequest_Refusals
Builder attaches the same headers, aims at the file's .sha1, and refuses unsafe bases and paths; the per-call credential read and its TestFlightRequestBuilder_* tests ride !3323 (merged) TestUpstreamRequestBuilder_BuildChecksumProbeRequest, TestUpstreamRequestBuilder_BuildChecksumProbeRequest_Refusals

Security considerations: credentials never appear on any record or error — pinned by the builder tests' credential-leak assertions; the probe's panic line logs the panic's type, never its value, so a future seam cannot put credential material on the record (Duo Security Review, CWE-200); the upstream body is untrusted input, so the parser carries FuzzParseDeclaredSHA1.

Testing

  • go test ./internal/format/maven/... green; golangci-lint run clean (0 issues). This MR adds no integration-tagged file; the integration lint pass is owed by !3323 (merged), which owns those files.
  • FuzzParseDeclaredSHA1 joins the fuzz:maven CI job.

No e2e scenario is added or affected: this MR changes no observable behavior — no production caller constructs the probe, so every fill's client-visible contract is unchanged. The catalog qualifications for the probe's one .sha1 GET ride !3323 (merged) with the activation.

Related to #376 (closed)

Edited by Moaz Khalifa

Merge request reports

Loading
Loading