fix(datastore): add tombstone scans for the remote parent tables (S20-A lifecycle purger plan: 20b/24, stack: 4/5)

What this MR does

This MR adds three tombstone discovery scans in internal/datastore/lifecycle_scan_packages.go:

  • ScanTombstonedMavenRemotePackages
  • ScanTombstonedNpmRemotePackages
  • ScanTombstonedContainerRemoteImages

Each scan has the shape of ScanTombstonedNpmPackages. Each scan is namespace-scoped, reads the oldest tombstone first, and is bounded by its limit. Each scan refuses a limit outside (0, MaxLifecycleScanPageSize] before it runs a statement.

The TombstoneCursor doc now names the two discovery indexes that key id. The ScanTombstonedContainerRemoteManifests doc is shorter and points at the image scan.

No purge level runs these scans in this MR. !3380 (merged) registers the levels.

Stack

This MR is part 4 of 5. The parts split !3380 (merged), and they merge in this order:

  1. !3399 (merged): the Danger exemption for comment-only Go changes.
  2. !3401 (merged): the resolve routes and the npm remote size family.
  3. !3402 (merged): the three reapers report freed bytes.
  4. This MR: the three tombstone discovery scans.
  5. !3380 (merged): the three purge levels and the documentation.

This MR does not need !3401 (merged) or !3402 (merged). It is in the stack because !3380 (merged) needs all three.

Tests

Test What it holds
TestLifecycleScanStore_PackageLevelTombstoneScans Ten cases for each new scan: window split, zero window, live row excluded, live parent, tombstoned parent, oldest first, bounded page, tenant isolation, empty probe, wrapped query failure.
TestLifecycleScanStore_PackageLevelTombstoneScans_Guards Six guard cases for each new scan.
TestLifecycleScanStore_PackageLevelScansStmt_OrderAndBinding Ascending soft_deleted_at, no ROW( keyset, namespace and limit bound.

Database review

This MR adds three statements and no migration. The plans are in the ## Database Review Evidence section of !3380 (merged): datastore.ScanTombstonedContainerRemoteImages, datastore.ScanTombstonedMavenRemotePackages and datastore.ScanTombstonedNpmRemotePackages. Each plan prunes to one of 64 partitions on the discovery index of its table.

E2e scenario catalogs and user documentation

No scenario row and no docs/user/ page changes. No code path calls these scans yet.

Related to #728 (closed)

🤖 Generated with Claude Code

Edited by Pawel Rozlach

Merge request reports

Loading
Loading