Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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: address review findings — restore iCaptcha PoW/origin matching, …
…fix feed owner_did projections
  • Loading branch information
Gravirei committed Jul 15, 2026
commit 830dc47af9c4109340d7b40e84c4e1e0df69dcfe
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions crates/gitlawb-node/src/api/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,14 @@ pub async fn list_ref_updates(
// record's trailing-segment match). Fall back to the local record's
// owner_did only for backward-compat rows (stored as None) that name a
// repo this node hosts, so legacy rows still display an owner.
let deduped = state.db.list_all_repos_deduped().await?;
// The deduped set is loaded only when a legacy None row is actually
// present, avoiding the scan on every global-feed read.
let needs_fallback = updates.iter().any(|u| u.owner_did.is_none());
let deduped: Vec<crate::db::RepoRecord> = if needs_fallback {
state.db.list_all_repos_deduped().await?
} else {
Vec::new()
};
let resolve_local = |slug: &str| -> Option<&str> {
for record in &deduped {
if crate::visibility::ref_update_row_names_repo(record, slug) {
Expand Down Expand Up @@ -281,7 +288,7 @@ pub async fn list_repo_events(
"cert_id": u.cert_id,
"received_at": u.received_at,
"from_peer": u.from_peer,
"owner_did": serde_json::json!(record.owner_did),
"owner_did": u.owner_did.as_ref().map(|s| serde_json::json!(s)).unwrap_or(serde_json::json!(record.owner_did)),
"source": "gossipsub",
})
})
Expand Down
14 changes: 10 additions & 4 deletions crates/gitlawb-node/src/graphql/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@ impl QueryRoot {
// Match the REST feed's owner_did projection: prefer the stored wire
// value (full DID), fall back to the local record's owner for
// backward-compat rows (stored as None) that name a local repo.
let deduped = db
.list_all_repos_deduped()
.await
.map_err(|e| async_graphql::Error::new(e.to_string()))?;
// The deduped set is loaded only when a legacy None row actually
// needs fallback, avoiding the scan on every query.
let needs_fallback = updates.iter().any(|u| u.owner_did.is_none());
let deduped: Vec<crate::db::RepoRecord> = if needs_fallback {
db.list_all_repos_deduped()
.await
.map_err(|e| async_graphql::Error::new(e.to_string()))?
} else {
Vec::new()
};
let resolve_local = |slug: &str| -> Option<String> {
for record in &deduped {
if crate::visibility::ref_update_row_names_repo(record, slug) {
Expand Down
1 change: 1 addition & 0 deletions crates/icaptcha-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ reqwest = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
anyhow = { workspace = true }
sha2 = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
sha2 = { workspace = true }