Skip to content

feat(relay): inventory unreachable Git objects (relay-only reland) - #2339

Open
thomaspblock wants to merge 1 commit into
mainfrom
git-gc-inventory-reland
Open

feat(relay): inventory unreachable Git objects (relay-only reland)#2339
thomaspblock wants to merge 1 commit into
mainfrom
git-gc-inventory-reland

Conversation

@thomaspblock

Copy link
Copy Markdown
Contributor

Summary

Relay-only reland of #2264 (reverted in #2275). Per review feedback from Tyler and Wes, this version removes everything outside crates/buzz-relay:

  • No Helm chart changes. The worker is configured entirely via BUZZ_GIT_GC_* env vars with safe defaults (disabled). Operators can enable bounded dry-run scans in staging through the chart's existing relay.extraEnv — no deployment.yaml / values.yaml / values.schema.json edits. Dedicated chart knobs can land later as a separate deploy-only PR.
  • No Hermit helm pin. bin/helm existed only to lint the removed chart changes.
  • No buzz-db changes. The previous PR renamed UsageMetricsLeaderAdvisoryLockLeader cosmetically; this version reuses the existing try_lock_usage_metrics(lock_key) API unchanged with a distinct GC advisory lock key (a code comment marks the deferred rename).

Functionality is unchanged from #2264: an opt-in worker elects one relay replica, marks objects reachable from every current repository pointer, and inventories the shared manifests/, packs/, and idx/ namespaces. It exports observed candidate counts, bytes, scan freshness, and completeness while bounding pointer count, listed objects, manifest transfer, and wall-clock duration.

This PR deliberately does not delete anything. Candidate status is not yet deletion proof: a later phase must persist continuous unreachability for a grace period and coordinate with concurrent publishers before any sweep can be safe. Disabled by default (BUZZ_GIT_GC_ENABLED=false) — dead code at runtime until an operator opts in.

Test plan

  • cargo test -p buzz-relay — 723 passed, 27 ignored (the one failure, api::mesh_demo::demo_join_forwarded_arm_round_trips_echo, fails identically on origin/main in this environment and is unrelated)
  • cargo clippy -p buzz-relay --all-targets -- -D warnings — clean
  • cargo fmt — clean
  • Diff audited: touches only crates/buzz-relay, .env.example, and docs/ — no db, helm, or hermit changes

…2264)

Reland of #2264 (reverted in #2275), trimmed to buzz-relay only per review:

- Dropped all Helm chart changes (deployment.yaml, values.yaml,
  values.schema.json). The worker is configured entirely via
  BUZZ_GIT_GC_* env vars with safe defaults (disabled); operators can
  opt in through the chart's existing relay.extraEnv. Dedicated chart
  knobs can land later as a deploy-only change.
- Dropped the Hermit helm 3.16.4 pin (bin/helm) — it existed only to
  lint the removed chart changes.
- Dropped the buzz-db rename (UsageMetricsLeader -> AdvisoryLockLeader).
  The GC worker reuses the existing try_lock_usage_metrics(lock_key)
  API with its own advisory lock key; the rename is deferred.

The opt-in worker elects one relay replica via a Postgres advisory
lock, marks objects reachable from every current repository pointer,
and inventories the shared manifests/, packs/, and idx/ namespaces,
exporting candidate counts, bytes, scan freshness, and completeness
metrics. Bounded pointer count, listed objects, manifest transfer, and
wall-clock duration. Dry-run only: nothing is ever deleted, and the
worker does not start unless BUZZ_GIT_GC_ENABLED=true.

Co-authored-by: Thomas Petersen <thomasp@squareup.com>
Signed-off-by: Thomas Petersen <thomasp@squareup.com>
@thomaspblock
thomaspblock requested a review from a team as a code owner July 22, 2026 06:32
@cameronhotchkies cameronhotchkies added the triage-ready Appropriate for agentic review label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-ready Appropriate for agentic review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants