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): correct the create-pool and bounty-tombstone remediations (#…
…196)

A re-run adversarial panel caught three issues in the prior round's own
fixes:

- create_repo took its serialization lock from the app pool and then did
  its DB work on the same pool, so at MAX_CONNECTIONS=1 it self-deadlocked
  (a config finding E requires to work). Reverted to locking on the write
  lock_pool: lock and create-work use separate pools, and the DB-global
  advisory lock still serializes against a purge. The extreme-burst
  lock_pool wait is an accepted retryable-503 residual. Db::pool() is
  test-only again.

- The bounty tombstone matched only one owner form and ran
  unconditionally. It now normalizes BOTH sides (covering did:key-row +
  short-bounty AND bare-row + full-bounty) and is gated on the same
  no-surviving-sibling check as the slug cascade, so it never tombstones
  a bounty a surviving mirror row still serves.

Tests: create-at-1-app-connection (no self-deadlock), bare-row full-form
tombstone, and sibling-survives-keeps-bounty-open, each RED before / GREEN
after.
  • Loading branch information
beardthelion committed Jul 20, 2026
commit d2ba14edfef652683173385458f6ffcec5de64cf
103 changes: 43 additions & 60 deletions crates/gitlawb-node/src/api/repos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,18 @@ pub async fn create_repo(
// error path below. Bounded-wait (no object-store I/O), so the uncontended hot
// path returns on the first attempt. (KTD6, R6.)
//
// Take this transient lock on the APP pool, not the write lock_pool. lock_pool
// is sized for long-held receive-pack write guards; a push burst that pins it
// would otherwise starve create's acquire (-> 500). The advisory lock is
// DB-global, so locking from the app pool still serializes against a same-key
// purge holding the lock from lock_pool. (INV-15 sibling: don't couple a cheap
// path to the expensive path's capacity.)
// Lock on the write lock_pool (via `lock_repo_blocking`), NOT the app pool. The
// create's own work (get_repo, proof.consume, db.create_repo) runs on the app
// pool via state.db, so drawing the lock guard from a SEPARATE pool keeps it from
// pinning an app connection that work then needs. At GITLAWB_DB_MAX_CONNECTIONS=1
// an app-pool lock self-deadlocks (get_repo waits for the one connection the
// guard holds -> PoolTimedOut -> 500). The advisory lock is DB-global, so it
// still serializes against a same-key purge holding it from lock_pool. Accepted
// residual: a sustained 32-writer burst that pins lock_pool can make this acquire
// wait -> a retryable 503, far less bad than breaking create at MAX_CONNECTIONS=1.
let repo_lock = state
.repo_store
.lock_repo_blocking_on(state.db.pool(), &owner_did, &req.name)
.lock_repo_blocking(&owner_did, &req.name)
.await
.map_err(|e| AppError::Git(e.to_string()))?
.ok_or_else(|| {
Expand Down Expand Up @@ -3900,41 +3903,48 @@ mod tests {
);
}

// create_repo's transient serialization lock must NOT draw from the write
// lock_pool. lock_pool is sized for LONG-HELD receive-pack write guards; a
// concurrent-push burst that pins every lock_pool connection would otherwise
// starve legitimate repo creation (create's acquire times out -> 500). The fix
// takes create's transient lock on the APP pool instead, which the write burst
// never touches. RED on base (create locks on lock_pool): with the lock_pool
// saturated by held write guards, create errors. GREEN after (create locks on
// the app pool): create still succeeds.
// create_repo must NOT take its serialization lock from the APP pool. Doing so
// pins an app-pool connection in the lock guard while the create's own work
// (get_repo / proof.consume / db.create_repo, all on state.db = the app pool)
// still needs an app connection. At GITLAWB_DB_MAX_CONNECTIONS=1 (a supported
// config) the guard holds the only app connection and get_repo self-deadlocks
// (PoolTimedOut -> 500). Locking on the separate write lock_pool instead keeps
// the lock and the work on different pools, so a size-1 app pool never wedges.
// RED on the app-pool-lock code: create times out -> Err. GREEN after reverting
// create to lock on lock_pool.
#[sqlx::test]
async fn create_repo_survives_a_saturated_lock_pool(
async fn create_repo_does_not_self_deadlock_at_one_app_connection(
pool_opts: sqlx::postgres::PgPoolOptions,
connect_opts: sqlx::postgres::PgConnectOptions,
) {
use axum::extract::State;
use axum::Extension;
use std::time::Duration;

// App pool: serves state.db AND (after the fix) create's transient lock.
let app_pool = pool_opts
.max_connections(5)
// Migrate the per-test DB on a normal pool: `migrate()` pins one connection for
// its cross-process advisory lock while applying statements on a second, so it
// needs >1 connection and cannot itself run on the size-1 pool under test.
let migrate_pool = pool_opts.connect_with(connect_opts.clone()).await.unwrap();
let mut state = crate::test_support::test_state(migrate_pool).await;

// Now point state.db at an APP pool of MAX size 1 on the SAME database, the
// minimal supported config (GITLAWB_DB_MAX_CONNECTIONS=1). The schema is
// already applied, so this pool only serves create's work (get_repo -> insert).
// A short acquire timeout makes the RED case (the lock guard pinning this one
// connection while get_repo waits for another) fail fast instead of hanging.
let app_pool = sqlx::postgres::PgPoolOptions::new()
.max_connections(1)
.acquire_timeout(Duration::from_secs(2))
.connect_with(connect_opts.clone())
.await
.unwrap();
let mut state = crate::test_support::test_state(app_pool.clone()).await;
state.db = std::sync::Arc::new(crate::db::Db::for_testing(app_pool.clone()));

// A SEPARATE, small write lock pool that fails fast on exhaustion, so a
// create wired to it errors quickly rather than blocking the whole test.
const N: u32 = 2;
// A SEPARATE write lock pool (where create's serialization lock belongs). Its
// being separate is the whole point: the lock guard must not draw from the app
// pool the create work runs on.
let lock_pool = sqlx::postgres::PgPoolOptions::new()
.max_connections(N)
.acquire_timeout(Duration::from_secs(2))
.min_connections(0)
.idle_timeout(None)
.max_lifetime(None)
.test_before_acquire(false)
.max_connections(5)
.connect_with(connect_opts.clone())
.await
.unwrap();
Expand All @@ -3944,31 +3954,8 @@ mod tests {
lock_pool.clone(),
);

// Saturate the lock pool with N held write guards on distinct repos — the
// 32-writer burst, scaled down. Each guard pins one lock_pool connection.
let mut guards = Vec::new();
for i in 0..N {
let owner = format!("did:key:z6MkSaturateLock{i}AAAAAAAAAAAAAAAAAAAAAA");
guards.push(
state
.repo_store
.acquire_write(&owner, "held")
.await
.unwrap(),
);
}
// The lock pool is exhausted, so the create assertion below is load-bearing
// (not vacuously green because the pool happened to be idle).
assert!(
lock_pool.acquire().await.is_err(),
"the lock pool must be exhausted by N held write guards"
);

// create for an UNCONTENDED key. Its advisory lock is free (the write
// guards hold different keys), so the only thing that can stop it is the
// saturated lock_pool — which it must not touch.
let owner = "did:key:z6MkCreateAppPoolCCCCCCCCCCCCCCCCCCCCCCCC";
let name = "created";
let owner = "did:key:z6MkOneAppConnNoDeadlockDDDDDDDDDDDDDDDDDDDD";
let name = "solo";
let created = super::create_repo(
State(state.clone()),
Extension(crate::auth::AuthenticatedDid(owner.to_string())),
Expand All @@ -3981,15 +3968,11 @@ mod tests {
}),
)
.await
.expect("create must survive a saturated lock pool by locking on the app pool");
.expect("create must not self-deadlock at app-pool size 1 (lock on lock_pool)");
assert_eq!(created.0, StatusCode::CREATED);
assert!(
state.db.get_repo(owner, name).await.unwrap().is_some(),
"row present after a create under a saturated lock pool"
"row present after a create with a size-1 app pool"
);

for g in guards {
g.release(true).await;
}
}
}
145 changes: 122 additions & 23 deletions crates/gitlawb-node/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,12 @@ pub struct Db {
}

impl Db {
/// Access the underlying Postgres connection pool. Most DB access goes through
/// `Db`'s methods; the write advisory-lock subsystem uses its own pool
/// (`connect_lock_pool`). `create_repo` is the one production caller: its
/// transient serialization lock is taken on THIS app pool rather than the
/// write lock pool, so a write burst that pins the lock pool cannot starve
/// repo creation.
pub(crate) fn pool(&self) -> &PgPool {
/// Access the underlying Postgres connection pool. Test-only: all production DB
/// access goes through `Db`'s methods, and the write advisory-lock subsystem uses
/// its own pool (`connect_lock_pool`). Tests reach for the raw pool to seed and
/// assert directly.
#[cfg(test)]
pub fn pool(&self) -> &PgPool {
&self.pool
}

Expand Down Expand Up @@ -917,6 +916,18 @@ pub(crate) fn normalize_owner_key(did: &str) -> &str {
/// drift apart. If you change `normalize_owner_key`, update this const too.
const OWNER_KEY_CASE_SQL: &str = "CASE WHEN owner_did LIKE 'did:key:%' AND position(':' in substr(owner_did, 9)) = 0 THEN substr(owner_did, 9) ELSE owner_did END";

/// `OWNER_KEY_CASE_SQL` over an arbitrary owner column. The const above hardcodes
/// `owner_did` (the `repos` column the `idx_repos_owner_key_name` index is built
/// on); the bounty tombstone needs the same normalizer over `bounties.repo_owner`,
/// which is not index-backed. Byte-identical to `normalize_owner_key`; update this
/// alongside the const and the fn if the rule changes.
fn owner_key_case_sql(col: &str) -> String {
format!(
"CASE WHEN {col} LIKE 'did:key:%' AND position(':' in substr({col}, 9)) = 0 \
THEN substr({col}, 9) ELSE {col} END"
)
}

#[cfg(test)]
mod normalize_owner_key_tests {
use super::normalize_owner_key;
Expand Down Expand Up @@ -1412,22 +1423,34 @@ impl Db {
// tombstoned bounty stays readable/listable under the same owner/name after
// recreation — a view, not a claim/payout re-attach; see the plan's KTD8.)
//
// Match BOTH owner representations. `create_bounty` stores `repo_owner`
// verbatim from the URL Path param, which is commonly the bare SHORT form
// (`z6Mk...`), while `repos.owner_did` here is the full `did:key:z6Mk...`.
// Binding only the full form leaves the common short-form bounty `open`, so it
// re-attaches to the recreated repo — the exact hole the tombstone closes.
// `normalize_owner_key` gives the bare short form the URL uses.
sqlx::query(
"UPDATE bounties SET status = 'purged'
WHERE repo_owner IN ($1, $2) AND repo_name = $3
AND status IN ('open', 'claimed', 'submitted')",
)
.bind(&owner_did)
.bind(normalize_owner_key(&owner_did))
.bind(&name)
.execute(&mut *tx)
.await?;
// Gate the tombstone on the SAME sibling check as the cascade: only when no
// other repos row resolves to this slug. If a mirror row survives, the logical
// repo still exists (and still serves via the mirror), so its bounty is still
// valid — tombstoning it would kill a live repo's bounty. Only when the last
// row for the slug is gone can a recreate re-attach an open bounty.
//
// When it does fire, match EVERY owner representation by normalizing BOTH sides.
// `create_bounty` stores `repo_owner` verbatim from the URL Path param, commonly
// the bare SHORT form (`z6Mk...`), but a full-DID URL that resolves to a bare
// mirror row yields the FULL `did:key:z6Mk...` form. The repo row here is likewise
// either form (`delete_repo_by_id` is reachable on bare mirror rows). Comparing the
// SQL-normalized stored `repo_owner` against the normalized target covers all four
// combinations (did:key-row + short-bounty AND bare-row + full-bounty); binding
// only one side left the mirror form `open`, so it re-attached to the recreated
// repo. It's a rare purge, so a seq scan on `bounties` (the normalizer is not
// index-backed) is fine.
if !sibling_exists {
sqlx::query(&format!(
"UPDATE bounties SET status = 'purged'
WHERE {key} = $1 AND repo_name = $2
AND status IN ('open', 'claimed', 'submitted')",
Comment thread
beardthelion marked this conversation as resolved.
Resolved
key = owner_key_case_sql("repo_owner")
))
.bind(normalize_owner_key(&owner_did))
.bind(&name)
.execute(&mut *tx)
.await?;
}

let result = sqlx::query("DELETE FROM repos WHERE id = $1")
Comment thread
beardthelion marked this conversation as resolved.
Resolved
.bind(id)
Expand Down Expand Up @@ -3854,6 +3877,30 @@ mod dedup_db_tests {
.await
.unwrap();

// An OPEN bounty on the shared owner/name — it belongs to the logical repo the
// surviving mirror still serves, so purging the empty sibling must NOT tombstone it.
db.create_bounty(&BountyRecord {
id: "bnt-collision".to_string(),
repo_owner: "z6MkSiblingCollisionFixture".to_string(),
repo_name: "victim".to_string(),
issue_id: None,
title: "sibling bounty".to_string(),
amount: 5_000,
creator_did: "did:key:z6MkCreator".to_string(),
claimant_did: None,
claimant_wallet: None,
pr_id: None,
status: "open".to_string(),
created_at: "2026-02-01T00:00:00Z".to_string(),
claimed_at: None,
submitted_at: None,
completed_at: None,
deadline_secs: 604_800,
tx_hash: None,
})
.await
.unwrap();

// Purge the empty canonical row.
let removed = db.delete_repo_by_id("rid-canonical-empty").await.unwrap();
assert_eq!(removed, 1, "the empty canonical row is deleted");
Expand Down Expand Up @@ -3891,6 +3938,17 @@ mod dedup_db_tests {
1,
"the surviving mirror repos row is untouched"
);
// The bounty is NOT tombstoned: the mirror still serves the logical repo, so
// the tombstone is gated on no sibling surviving.
assert_eq!(
db.get_bounty("bnt-collision")
.await
.unwrap()
.unwrap()
.status,
"open",
"a bounty on a repo whose mirror survives the purge must stay open, not be tombstoned"
);
}

/// U8 (F): bounties key on (repo_owner, repo_name), not an immutable repo id,
Expand Down Expand Up @@ -4088,6 +4146,47 @@ mod dedup_db_tests {
survivor_bounty.status, "open",
"an unrelated repo's bounty must stay open"
);

// Symmetric owner-form case (the mirror of `bnt-victim-short`). Here the repo
// row is the BARE short-owner mirror (`owner_did = z6X`), while the bounty was
// stored in the FULL `did:key:z6X` form, the shape a full-DID URL that
// resolves to the bare mirror produces. The tombstone must normalize BOTH the
// stored `repo_owner` and the target, or this full-form bounty stays `open`
// when the bare row is purged and re-attaches to a recreated repo, the same
// re-attach hole in the opposite direction. `delete_repo_by_id` is reachable on
// bare mirror rows (`list_repos_by_owner_did` matches under normalization).
// RED before the symmetric fix (only the target side was normalized): stays
// `open`. GREEN after: `purged`.
let bare_owner = "z6MkBareOwnerFixtureForSymmetricTombstone";
let bare = rec(
"rid-bounty-bare-victim",
bare_owner,
"victim",
"bare spam repo",
"2026-01-01T00:00:00Z",
"2026-01-01T00:00:00Z",
);
db.create_repo(&bare).await.unwrap();
db.create_bounty(&bounty(
"bnt-bare-full",
&format!("did:key:{bare_owner}"),
"victim",
"open",
))
.await
.unwrap();
let removed_bare = db
.delete_repo_by_id("rid-bounty-bare-victim")
.await
.unwrap();
assert_eq!(removed_bare, 1, "the bare-owner repo row is deleted");
let bare_full_bounty = db.get_bounty("bnt-bare-full").await.unwrap().unwrap();
assert_eq!(
bare_full_bounty.status, "purged",
"a FULL-form bounty on a BARE-owner repo row must be tombstoned too \
(symmetric normalization); RED before: only the target side was \
normalized, so the full-form bounty stayed open"
);
}

/// The canonical `did:key:` row and the short-owner mirror row of one logical
Expand Down
12 changes: 4 additions & 8 deletions crates/gitlawb-node/src/git/repo_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,7 @@ impl RepoStore {
/// [`try_lock_repo`](Self::try_lock_repo) against a caller-chosen pool. The
/// Postgres advisory lock is DATABASE-global, so the lock still mutually
/// excludes holders of the same key from any other pool — only the connection
/// the guard pins comes from `pool`. `create_repo` uses this with the app pool
/// so its transient lock never draws from the write `lock_pool`.
/// the guard pins comes from `pool`. Backs the `lock_pool`-based delegators.
async fn try_lock_repo_on(
&self,
pool: &PgPool,
Expand Down Expand Up @@ -448,12 +447,9 @@ impl RepoStore {
}

/// [`lock_repo_blocking`](Self::lock_repo_blocking) against a caller-chosen
/// pool. `create_repo` passes the app pool so its transient serialization lock
/// (check-exists -> init -> insert) does not draw a connection from the write
/// `lock_pool` — a receive-pack burst that pins every lock-pool connection
/// must not starve repo creation. The advisory lock is DB-global, so this
/// still serializes create against a same-key purge that holds the lock from
/// the lock pool.
/// pool. The advisory lock is DB-global, so the guard mutually excludes the same
/// key across pools; only the pinned connection comes from `pool`. Backs the
/// `lock_pool`-based [`lock_repo_blocking`](Self::lock_repo_blocking) delegator.
pub async fn lock_repo_blocking_on(
&self,
pool: &PgPool,
Expand Down