Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
34df1fd
feat(node): add per-IP write-surface rate brake and apply to write_ro…
beardthelion Jul 13, 2026
74e05be
feat(node): extend the per-IP write brake to the remaining write sinks
beardthelion Jul 13, 2026
6fded6e
test(node): adversarial TrustedProxy verification through the write b…
beardthelion Jul 13, 2026
e6324d2
feat(node): purge-spam admin subcommand for the empty-burst cleanup
beardthelion Jul 13, 2026
285d7c7
fix(review): make purge-spam empty-check reject git-discovery reads
beardthelion Jul 13, 2026
090019d
fix(review): normalization-consistent purge, brake helper, CLI + cove…
beardthelion Jul 13, 2026
dfd4f6c
test(review): close the reasoned-not-run gaps by execution
beardthelion Jul 13, 2026
0135419
fix(node): reject path-traversal repo names in purge-spam before remo…
beardthelion Jul 15, 2026
a0fcbb0
fix(node): delete child rows transactionally in delete_repo_by_id
beardthelion Jul 15, 2026
fde9cfe
fix(node): reap write_rate_limiter in the periodic cleanup loop
beardthelion Jul 15, 2026
15522d5
fix(node): hold the per-repo advisory lock across purge recheck+delete
beardthelion Jul 15, 2026
1fcca0d
fix(node): count purge-spam disk-removal failures separately from del…
beardthelion Jul 15, 2026
d9eebd2
fix(node): warn on unparseable rate-limit env vars instead of silentl…
beardthelion Jul 15, 2026
6325402
docs(node): document GITLAWB_IPFS_API/TIGRIS_BUCKET/METRICS_ADDR/SHUT…
beardthelion Jul 15, 2026
bfbe502
test(node): exercise the dry-run guard with a real on-disk candidate …
beardthelion Jul 15, 2026
cdb102e
style(node): cargo fmt for the #196 fix set
beardthelion Jul 15, 2026
4df79f2
fix(node): pin the writer's advisory-lock connection in RepoWriteGuard
beardthelion Jul 15, 2026
68c1f5c
refactor(node): introduce ObjectStore trait seam over TigrisClient
beardthelion Jul 15, 2026
3c1ceb8
fix(node): make purge-spam Tigris-authoritative and archive-deleting
beardthelion Jul 15, 2026
cf669bb
fix(review): don't hold/leak the pool connection in acquire_write
beardthelion Jul 15, 2026
dde5ea9
fix(node): make advisory-lock guards drop-safe and reorder acquire_write
beardthelion Jul 16, 2026
b94d440
fix(node): complete a fully-received push after client disconnect
beardthelion Jul 16, 2026
e4c4161
fix(node): serialize archive uploads under the per-repo advisory lock
beardthelion Jul 16, 2026
6ba698c
fix(node): let purge-spam reach repos that exist only as archives
beardthelion Jul 16, 2026
9f7757c
refactor(node): dedup limiter setup + write-brake test driver; fix .e…
beardthelion Jul 16, 2026
2a78524
docs(node): drop the .env.example shutdown-grace entry #196 added (#196)
beardthelion Jul 19, 2026
c4b337b
fix(node): give advisory-lock guards a dedicated pool and bound the r…
beardthelion Jul 19, 2026
4934646
fix(node): advertise a window-derived Retry-After on rate-limit 429s …
beardthelion Jul 19, 2026
0c279c9
fix(node): skip slug-scoped purge cascade when a mirror row shares th…
beardthelion Jul 19, 2026
86a8228
fix(node): fail closed classifying the purge target directory (#196)
beardthelion Jul 20, 2026
bf2a54e
fix(node): run the push completion tail in the disconnect-surviving t…
beardthelion Jul 20, 2026
c24b541
fix(node): tombstone bounties when their repo is purged (#196)
beardthelion Jul 20, 2026
3baa9ed
fix(node): serialize create_repo against the purge advisory lock (#196)
beardthelion Jul 20, 2026
9916bca
test(node): prove purge deletes at MAX_CONNECTIONS=1 with the split p…
beardthelion Jul 20, 2026
8f3d643
fix(node): fail the push when the durable upload times out, don't 200…
beardthelion Jul 20, 2026
d1e596e
fix(node): tombstone bounties under both owner forms on purge (#196)
beardthelion Jul 20, 2026
ce5dcc3
fix(node): fail closed on a symlink at the purge target (#196)
beardthelion Jul 20, 2026
7dc7be2
fix(node): retry-after on the push-advert 429, and create_repo locks …
beardthelion Jul 20, 2026
d2ba14e
fix(node): correct the create-pool and bounty-tombstone remediations …
beardthelion Jul 20, 2026
5a46ef6
fix(node): close the durable-upload data-loss class on every write pa…
beardthelion Jul 20, 2026
2fa9fa3
chore: merge main (iCaptcha PoW + gl retry tests) into feat/write-sin…
beardthelion Jul 21, 2026
16517f8
refactor(node): route the per-DID 429 through the shared too_many_req…
beardthelion Jul 21, 2026
ba572b3
fix(node): init's background upload waits out the creator's advisory …
beardthelion Jul 21, 2026
859240b
fix(node): roll back the local issue ref before unlock when the durab…
beardthelion Jul 21, 2026
c07435d
fix(node): fork publishes only after a durable upload, serialized on …
beardthelion Jul 21, 2026
2ad1c79
fix(node): read-path downloads publish under the purge lock, without …
beardthelion Jul 21, 2026
b2ca5a7
fix(node): bound every under-lock object-store call and dedup the upl…
beardthelion Jul 21, 2026
fa4322c
fix(node): harden the read-path download against cancellation, stale …
beardthelion Jul 21, 2026
c3d6e73
fix(node): keep the fork's unbounded work out of the target-lock span…
beardthelion Jul 21, 2026
03ef9b5
refactor(node): move read-path download coordination into a repo_stor…
beardthelion Jul 21, 2026
4408d27
fix(node): bound acquire_write's download and free the download-map e…
beardthelion Jul 21, 2026
a12f21a
fix(node): roll back the fork mirror and archive on late clone/insert…
beardthelion Jul 21, 2026
556aa31
fix(node): serialize repo purge cascade with mirror ingest via adviso…
beardthelion Jul 22, 2026
1d8c281
fix(node): roll back local ref on failed durable upload (close/merge/…
beardthelion Jul 22, 2026
1d0d3d2
fix(node): tie cancelled cold-download cleanup to blocking extraction
beardthelion Jul 22, 2026
03cd81e
chore(node): fmt + clippy cleanup for the #196 fixes
beardthelion Jul 22, 2026
9152178
fix(node): never let a failed ref snapshot become a delete-all rollba…
beardthelion Jul 22, 2026
296704f
fix(node): slug-lock every peer-ingest writer and drive the real inge…
beardthelion Jul 22, 2026
1e79ae5
fix(node): own cold-download cleanup in a spawned task so handler can…
beardthelion Jul 22, 2026
ce25bba
refactor(node): delegate issue ref helpers to the store ref primitives
beardthelion Jul 22, 2026
4329b2a
Merge origin/main into feat/write-sink-brake-coverage (reintegrate cu…
beardthelion Jul 22, 2026
d755180
fix(node): slug-lock arweave anchor writes; fail closed when the pre-…
beardthelion Jul 22, 2026
e6f4b2f
fix(node): close review residuals: coalesce cold downloads to one in-…
beardthelion Jul 22, 2026
1459cf2
Merge remote-tracking branch 'origin/main' into feat/write-sink-brake…
beardthelion Nov 11, 2026
da876e8
fix(node): re-apply create/fork purge serialization and restore brake…
beardthelion Nov 11, 2026
edfa6bb
fix(node): close review gaps in purge, locks, and fork cleanup
beardthelion Nov 11, 2026
96ed2b2
fix(node): subscriptions-only ws schema and unsettled-work purge guard
beardthelion Nov 11, 2026
082a37f
Merge remote-tracking branch 'origin/main' into feat/write-sink-brake…
beardthelion Nov 11, 2026
e9e86a1
fix(node): wire close_issue rollback, close purge symlink gap, correc…
beardthelion Nov 11, 2026
1187dca
fix(node): close purge/upload lifecycle gaps from review
beardthelion Nov 11, 2026
261f7ab
fix(node): merge rollback, honest create rollback, purge row recheck
beardthelion Nov 12, 2026
662b9a3
fix(node): probe purge slug liveness, gate issue write brake behind t…
beardthelion Nov 12, 2026
43d4f59
fix(node): close-issue rollback uses resolved ref, drop router brake …
beardthelion Nov 12, 2026
4b483a3
fix(node): close_issue spends neither bucket when either cap refuses,…
beardthelion Nov 12, 2026
11cadb9
fix(node): refund the write slot when the close cap refuses, send Ret…
beardthelion Nov 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(node): make purge-spam Tigris-authoritative and archive-deleting
purge-spam built its RepoStore with no object store, so on a Tigris
deployment it rechecked emptiness against possibly-stale local disk
(deleting a repo with live remote refs) and left the archive behind (to
be re-downloaded into a later same-owner/name repo). Give the admin
command the configured object store, refresh the local copy from the
authoritative archive under the per-repo lock before the recheck
(fail-closed on a store error via a new skipped_store_error), and delete
the archive on a successful purge (failures counted in a new
archive_failed, never folded into success). When no bucket is configured
the None path is byte-for-byte unchanged.

Three load-bearing guards verified RED->GREEN on the Tigris-blind purge:
remote-refs-not-deleted, archive-deleted, fail-closed-on-unreachable.
  • Loading branch information
beardthelion committed Jul 15, 2026
commit 3c1ceb8edcb49ad054b1ce5d3259c21e91dfb237
277 changes: 274 additions & 3 deletions crates/gitlawb-node/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,17 @@ pub struct PurgeSummary {
pub skipped_not_empty: usize,
/// Candidates skipped because a live writer held the per-repo lock.
pub skipped_locked: usize,
/// Candidates skipped because the object store could not be consulted for the
/// authoritative emptiness recheck (fail-closed: never delete on a store
/// error rather than risk deleting a repo with live remote refs).
pub skipped_store_error: usize,
/// Rows deleted whose on-disk dir removal FAILED (or was refused by the
/// containment guard) — DB/disk drift the operator must reconcile.
pub disk_failed: usize,
/// Rows+dirs deleted whose object-store archive removal FAILED — the archive
/// survives and could be re-downloaded into a later same-owner/name repo, so
/// this is tracked separately and never folded into a clean success.
pub archive_failed: usize,
}

/// A repo selected for purge, with the evidence that qualified it.
Expand Down Expand Up @@ -297,8 +305,21 @@ pub async fn run_purge_spam(
continue;
}
};
// Refresh the local copy from the authoritative object store (if any)
// before the recheck: on a Tigris deployment the admin node's local disk
// can be stale, so an emptiness check against local alone could delete a
// repo that has live remote refs. Fail closed on any store error — never
// delete on an unverified view.
if let Err(e) = repo_store.refresh_from_archive(&c.owner_did, &c.name).await {
warn!(repo = %c.id, err = %e,
"purge-spam: could not consult the object store — skipped (fail-closed)");
summary.skipped_store_error += 1;
guard.release().await;
continue;
}
// Authoritative recheck UNDER the lock: a ref that landed before we locked
// makes the repo non-empty, so it must not be deleted.
// (or that the object-store refresh surfaced) makes the repo non-empty, so
// it must not be deleted.
if ref_count_on_disk(&repos_dir, &c.owner_did, &c.name) != 0 {
warn!(repo = %c.id, "purge-spam: repo no longer empty under lock — skipped (TOCTOU)");
summary.skipped_not_empty += 1;
Expand Down Expand Up @@ -332,6 +353,15 @@ pub async fn run_purge_spam(
} else {
info!(repo = %c.id, rows = n, "purge-spam: deleted repo row + on-disk dir");
}
// Delete the object-store archive too (a no-op when no store is
// configured), else it survives and can be downloaded into a
// later repo created with the same owner/name. Counted separately
// so a surviving archive never reads as a clean success.
if let Err(e) = repo_store.delete_archive(&c.owner_did, &c.name).await {
warn!(repo = %c.id, err = %e,
"purge-spam: deleted row + dir but could not delete the object-store archive");
summary.archive_failed += 1;
}
}
Err(e) => {
warn!(repo = %c.id, err = %e, "purge-spam: failed to delete repo row — continuing");
Expand All @@ -340,8 +370,13 @@ pub async fn run_purge_spam(
guard.release().await;
}
println!(
"purge-spam: deleted {} repo row(s); skipped {} (no longer empty), {} (locked by a live writer); {} on-disk removal(s) failed.",
summary.deleted, summary.skipped_not_empty, summary.skipped_locked, summary.disk_failed
"purge-spam: deleted {} repo row(s); skipped {} (no longer empty), {} (locked by a live writer), {} (object store unreachable); {} on-disk removal(s) failed, {} archive removal(s) failed.",
summary.deleted,
summary.skipped_not_empty,
summary.skipped_locked,
summary.skipped_store_error,
summary.disk_failed,
summary.archive_failed
);
Ok(summary)
}
Expand Down Expand Up @@ -979,4 +1014,240 @@ mod db_tests {
"an empty repo owned by a short-form excluded DID must never be a candidate"
);
}

// ── Tigris-authoritative purge (P1b) ───────────────────────────────────

/// In-test object store. `download` materializes a bare repo with (or
/// without) a ref so the purge tool's authoritative recheck can be driven
/// without a live bucket; error flags exercise the fail-closed and
/// archive-delete-failure paths.
struct FakeStore {
has_archive: bool,
archive_has_refs: bool,
fail_recheck: bool,
fail_delete: bool,
deleted: std::sync::Arc<std::sync::atomic::AtomicBool>,
}

#[async_trait::async_trait]
impl crate::git::tigris::ObjectStore for FakeStore {
async fn exists(&self, _owner: &str, _repo: &str) -> Result<bool> {
if self.fail_recheck {
anyhow::bail!("fake object store unreachable");
}
Ok(self.has_archive)
}
async fn upload(&self, _owner: &str, _repo: &str, _path: &Path) -> Result<()> {
Ok(())
}
async fn download(&self, _owner: &str, _repo: &str, local_path: &Path) -> Result<()> {
if self.fail_recheck {
anyhow::bail!("fake object store unreachable");
}
// Materialize the authoritative archive on local disk so
// ref_count_on_disk reflects remote state.
let _ = std::fs::remove_dir_all(local_path);
store::init_bare(local_path).unwrap();
if self.archive_has_refs {
seed_one_ref(local_path);
}
Ok(())
}
async fn delete(&self, _owner: &str, _repo: &str) -> Result<()> {
self.deleted
.store(true, std::sync::atomic::Ordering::SeqCst);
if self.fail_delete {
anyhow::bail!("fake object store delete failed");
}
Ok(())
}
}

fn store_backed(
repos_dir: &Path,
pool: &PgPool,
fake: FakeStore,
) -> crate::git::repo_store::RepoStore {
crate::git::repo_store::RepoStore::new(
repos_dir.to_path_buf(),
Some(std::sync::Arc::new(fake)),
pool.clone(),
)
}

fn fake(
has_archive: bool,
archive_has_refs: bool,
fail_recheck: bool,
fail_delete: bool,
) -> (FakeStore, std::sync::Arc<std::sync::atomic::AtomicBool>) {
let deleted = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false));
(
FakeStore {
has_archive,
archive_has_refs,
fail_recheck,
fail_delete,
deleted: deleted.clone(),
},
deleted,
)
}

// A locally-empty repo whose authoritative archive HAS refs (pushed via
// another machine) must NOT be purged on the stale-local view. Load-bearing:
// RED on the Tigris-blind purge (deletes it), GREEN once the recheck
// consults the object store.
#[sqlx::test]
async fn purge_skips_repo_with_remote_refs_when_local_empty(pool: PgPool) {
let db = db(&pool).await;
let tmp = tempfile::TempDir::new().unwrap();
let target = rec("t-remote", SPAM_BURST_TARGET_DID, "spam1");
db.create_repo(&target).await.unwrap();
let path = store::repo_disk_path(tmp.path(), &target.owner_did, &target.name);
store::init_bare(&path).unwrap();
assert_eq!(
store::list_refs(&path).unwrap().len(),
0,
"local starts empty"
);

let (f, _deleted) = fake(true, true, false, false);
let repo_store = store_backed(tmp.path(), &pool, f);
let summary = run_purge_spam(&db, &repo_store, tmp.path(), true)
.await
.unwrap();

assert!(
db.get_repo(SPAM_BURST_TARGET_DID, "spam1")
.await
.unwrap()
.is_some(),
"a repo with live remote refs must not be purged on a stale-local view"
);
assert_eq!(summary.deleted, 0);
assert_eq!(summary.skipped_not_empty, 1);
}

// A genuinely-empty repo (empty archive) is deleted AND its archive removed,
// else the archive can be re-downloaded into a later same-name repo.
// Load-bearing: RED on the Tigris-blind purge (archive survives), GREEN once
// the delete wires the archive removal.
#[sqlx::test]
async fn purge_deletes_archive_on_successful_delete(pool: PgPool) {
let db = db(&pool).await;
let tmp = tempfile::TempDir::new().unwrap();
let target = rec("t-empty", SPAM_BURST_TARGET_DID, "spam1");
db.create_repo(&target).await.unwrap();
let path = store::repo_disk_path(tmp.path(), &target.owner_did, &target.name);
store::init_bare(&path).unwrap();

let (f, deleted) = fake(true, false, false, false);
let repo_store = store_backed(tmp.path(), &pool, f);
let summary = run_purge_spam(&db, &repo_store, tmp.path(), true)
.await
.unwrap();

assert!(
db.get_repo(SPAM_BURST_TARGET_DID, "spam1")
.await
.unwrap()
.is_none(),
"a genuinely-empty repo is deleted"
);
assert!(
deleted.load(std::sync::atomic::Ordering::SeqCst),
"the object-store archive must be deleted on a successful purge"
);
assert_eq!(summary.deleted, 1);
assert_eq!(summary.archive_failed, 0);
}

// An unreachable object store during the recheck must fail closed (skip),
// never delete on an unverified view. Load-bearing: RED on the Tigris-blind
// purge (deletes), GREEN once the recheck consults (and fails closed on) the
// store.
#[sqlx::test]
async fn purge_fails_closed_when_store_unreachable(pool: PgPool) {
let db = db(&pool).await;
let tmp = tempfile::TempDir::new().unwrap();
let target = rec("t-empty", SPAM_BURST_TARGET_DID, "spam1");
db.create_repo(&target).await.unwrap();
let path = store::repo_disk_path(tmp.path(), &target.owner_did, &target.name);
store::init_bare(&path).unwrap();

let (f, _deleted) = fake(true, false, true, false);
let repo_store = store_backed(tmp.path(), &pool, f);
let summary = run_purge_spam(&db, &repo_store, tmp.path(), true)
.await
.unwrap();

assert!(
db.get_repo(SPAM_BURST_TARGET_DID, "spam1")
.await
.unwrap()
.is_some(),
"must not delete when the object store is unreachable (fail-closed)"
);
assert_eq!(summary.deleted, 0);
assert_eq!(summary.skipped_store_error, 1);
}

// An archive-delete failure after the row+dir are removed is counted
// separately, never folded into a clean success.
#[sqlx::test]
async fn purge_archive_delete_failure_counted_separately(pool: PgPool) {
let db = db(&pool).await;
let tmp = tempfile::TempDir::new().unwrap();
let target = rec("t-empty", SPAM_BURST_TARGET_DID, "spam1");
db.create_repo(&target).await.unwrap();
let path = store::repo_disk_path(tmp.path(), &target.owner_did, &target.name);
store::init_bare(&path).unwrap();

let (f, deleted) = fake(true, false, false, true);
let repo_store = store_backed(tmp.path(), &pool, f);
let summary = run_purge_spam(&db, &repo_store, tmp.path(), true)
.await
.unwrap();

assert!(
db.get_repo(SPAM_BURST_TARGET_DID, "spam1")
.await
.unwrap()
.is_none(),
"the row+dir are still deleted"
);
assert!(deleted.load(std::sync::atomic::Ordering::SeqCst));
assert_eq!(summary.deleted, 1);
assert_eq!(
summary.archive_failed, 1,
"a surviving archive must be counted, not reported as clean success"
);
}

// R7: with no object store configured (single-machine), an empty repo is
// deleted exactly as before and nothing touches an archive.
#[sqlx::test]
async fn purge_tigris_disabled_deletes_empty_unchanged(pool: PgPool) {
let db = db(&pool).await;
let tmp = tempfile::TempDir::new().unwrap();
let target = rec("t-empty", SPAM_BURST_TARGET_DID, "spam1");
db.create_repo(&target).await.unwrap();
let path = store::repo_disk_path(tmp.path(), &target.owner_did, &target.name);
store::init_bare(&path).unwrap();

let repo_store = test_store(tmp.path(), &pool); // Tigris = None
let summary = run_purge_spam(&db, &repo_store, tmp.path(), true)
.await
.unwrap();

assert!(db
.get_repo(SPAM_BURST_TARGET_DID, "spam1")
.await
.unwrap()
.is_none());
assert_eq!(summary.deleted, 1);
assert_eq!(summary.skipped_store_error, 0);
assert_eq!(summary.archive_failed, 0);
}
}
28 changes: 28 additions & 0 deletions crates/gitlawb-node/src/git/repo_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,34 @@ impl RepoStore {

Ok((owner_slug, local_path))
}

/// Refresh the local copy from the authoritative object-store archive so an
/// emptiness recheck reflects remote state (used by purge-spam on a Tigris
/// deployment, where the admin node's local disk can be stale). Downloads
/// the archive over the local path when it exists; a no-op when no object
/// store is configured (single-machine). Errors propagate so the caller can
/// fail closed rather than delete on a stale-local view.
pub async fn refresh_from_archive(&self, owner_did: &str, repo_name: &str) -> Result<()> {
let Some(ref store) = self.object_store else {
return Ok(());
};
let (owner_slug, local_path) = self.local_path(owner_did, repo_name)?;
if store.exists(&owner_slug, repo_name).await? {
store.download(&owner_slug, repo_name, &local_path).await?;
}
Ok(())
}

/// Delete the object-store archive for a repo. A no-op when no object store
/// is configured. Used by purge-spam so a deleted repo's archive cannot be
/// downloaded into a later repo created with the same owner/name.
pub async fn delete_archive(&self, owner_did: &str, repo_name: &str) -> Result<()> {
let Some(ref store) = self.object_store else {
return Ok(());
};
let (owner_slug, _local_path) = self.local_path(owner_did, repo_name)?;
store.delete(&owner_slug, repo_name).await
}
}

/// Strict allowlist validator for `owner_did` and `repo_name`.
Expand Down
3 changes: 1 addition & 2 deletions crates/gitlawb-node/src/git/tigris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ pub trait ObjectStore: Send + Sync {
async fn upload(&self, owner_slug: &str, repo_name: &str, local_path: &Path) -> Result<()>;
/// Download and extract a repo archive to local disk.
async fn download(&self, owner_slug: &str, repo_name: &str, local_path: &Path) -> Result<()>;
/// Delete a repo archive. (Wired into purge-spam in U3.)
#[allow(dead_code)]
/// Delete a repo archive.
async fn delete(&self, owner_slug: &str, repo_name: &str) -> Result<()>;
}

Expand Down
33 changes: 29 additions & 4 deletions crates/gitlawb-node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,35 @@ async fn run_admin_command(command: config::Command, config: &Config) -> Result<
)
.await
.context("connecting to database for purge-spam")?;
// Lock-only RepoStore (no Tigris): purge takes the per-repo advisory
// lock to exclude a live push, but never downloads/uploads archives.
let repo_store =
git::repo_store::RepoStore::new(config.repos_dir.clone(), None, db.pool().clone());
// Build the object store so purge is authoritative against remote
// state: the emptiness recheck consults the archive (not just
// possibly-stale local disk) and a successful purge deletes the
// archive too. When no bucket is configured this stays None and purge
// is local-only, exactly as before.
let object_store: Option<std::sync::Arc<dyn git::tigris::ObjectStore>> = if config
.tigris_bucket
.is_empty()
{
None
} else {
match git::tigris::TigrisClient::new(&config.tigris_bucket).await {
Ok(client) => Some(std::sync::Arc::new(client)),
Err(e) => {
// Fail closed: without the configured store we cannot
// do the authoritative recheck, and a local-only purge
// on a Tigris deployment is the stale-view delete this
// guards against. Refuse to run rather than fall back.
anyhow::bail!(
"purge-spam: GITLAWB_TIGRIS_BUCKET is set but the object-store client failed to initialize ({e}); refusing to run a local-only purge on a Tigris deployment"
);
}
}
};
let repo_store = git::repo_store::RepoStore::new(
config.repos_dir.clone(),
object_store,
db.pool().clone(),
);
admin::run_purge_spam(&db, &repo_store, &config.repos_dir, execute)
.await
.map(|_| ())
Expand Down