feat(maven): add artifact-level version-size reconciliation

Summary

Step 4 of the Maven artifact-level size_accounting plan: the artifact-level reconciliation walk. MavenVersionStore.RecomputeVersionSize (landed in Step 2, !1551 (merged)) already implements ADR-007's artifact-level walk; no new store method is added here. This MR declares the method's out-of-band reconciliation role in its doc comment and pins the reconciliation invariants with datastore integration tests.

The shared method serves three callers from the one walk: upload maintenance, out-of-band drift correction, and (once a delete path lands) the Maven deleter's footprint drop. The new tests pin:

  • a seeded version's out-of-band recompute equals the upload-maintained counter, with soft-deleted files counted and package-level rows excluded in one place;
  • a reconcile racing a post-commit recompute converges last-writer-wins under the version-keyed advisory lock.

The diff also refactors seedRecomputeFile into an error-returning seedRecomputeFileRow (for goroutine callers, where require's FailNow is illegal) plus a require-wrapping seedRecomputeFile.

Governing ADRs

  • ADR-007 (Artifact-level storage accounting and reconciliation): walk semantics honored — distinct blob_sha256, soft-deleted rows included, package-level rows excluded, drift correction. The walk reads blob_storage_blobs directly rather than the blob_storage_blobs_by_namespace shadow ADR-007's reconciliation text describes (a deliberate per-version bounded-array-seek deviation, now stated in the doc comment and recorded as an ADR-007 amendment in handbook !20824).
  • ADR-008 (content-addressable storage): blob immutability keeps walked sizes stable.
  • ADR-025 (garbage collection): cited for the future deleter's footprint drop; no Maven delete path exists to host the decrement yet (#472 (closed)).

Testing

Datastore integration tests (//go:build integration, SetupIsolatedTestDB) in internal/datastore/maven_versions_recompute_integration_test.go:

  • TestMavenVersionStore_RecomputeVersionSize_ReconcileEqualsMaintainedCounter
  • TestMavenVersionStore_RecomputeVersionSize_ReconcileRacingPostCommitRecomputeConverges

Related to #550 (closed)

Edited by Moaz Khalifa

Merge request reports

Loading
Loading