buzz icon indicating copy to clipboard operation
buzz copied to clipboard

feat(media): add sharded media object-key paths

Open bradseiler opened this issue 3 months ago • 0 comments

Why

Media payload keys are currently flat, so high-volume traffic lacks hash-leading S3 prefix entropy. Existing deployments also need a safe, explicit rollout that preserves old reads and rollback behavior without changing storage behavior merely by upgrading.

What

  • moves media payloads to media/<sha[0:2]>/<sha[2:4]>/<community>/<filename> while leaving Git/CAS namespaces unchanged
  • adds BUZZ_MEDIA_MIGRATION_PHASE with three complete media object-key path policies:
    • legacy-only (default): read and write only legacy paths, preserving existing deployment behavior
    • dual-read-and-write: prefer sharded reads with legacy fallback and write both paths
    • sharded-only: read and write only sharded paths
  • defines the existing-deployment rollout as legacy-only → dual-read-and-write → backfill → sharded-only
  • recommends that new deployments start with sharded-only before their first upload, avoiding any future backfill or legacy cleanup
  • adds sharded-first/legacy-fallback read telemetry, strict bucket classification, logical billing deduplication, duplicate-layout gauges, and authoritative payload keys in upload records
  • includes buzz-media-layout-backfill and buzz-media-layout-delete-legacy in both relay image targets, with bounded paging, checkpoints, request-rate limiting, idempotency, destination verification, dry-run, and destructive confirmation
  • documents new-install and existing-deployment flows and provides Kubernetes Job examples

Validation

  • cargo test -p buzz-media --all-targets: 119 passed; live-MinIO test ignored
  • cargo test -p buzz-relay --lib config::tests::: 32 passed
  • cargo test -p buzz-relay --lib storage_sweep: 15 passed
  • cargo clippy -p buzz-media -p buzz-relay --all-targets -- -D warnings: clean
  • cargo fmt --all -- --check, desktop Tauri fmt, and git diff --check: clean
  • pre-push hooks after merging current origin/main: Rust, desktop, Tauri, mobile, and typecheck suites passed
  • Helm values/test YAML and values schema JSON parse cleanly; Helm CLI is unavailable locally

Generated with Goose

bradseiler avatar Aug 03 '26 14:08 bradseiler