fix: listRefs returns only vcs store refs (not git mirror OIDs)

Author: Aaron Steven White
Commit ea7e3c343096d04e41ea046de2f8dede13574d56
Parent: 1c0f672df2
Structural diff unavailable

These commits were pushed via plain git push, so no pre-parsed schemas are available. Install git-remote-cospan and re-push via panproto:// to see scope-level changes, breaking change detection, and semantic diffs.

brew install panproto/tap/git-remote-cospan
1 file changed +14 -39
@@ -19,43 +19,18 @@ pub async fn list_refs(
1919 ) -> Result<Json<serde_json::Value>, NodeError> {
2020     let store = state.store.lock().await;
2121 
22-    // Try panproto-vcs store first (has refs from git-remote-cospan push).
23-    if let Ok(refs) = store.list_refs(&params.did, &params.repo) {
24-        if !refs.is_empty() {
25-            let refs_json: Vec<serde_json::Value> = refs
26-                .into_iter()
27-                .map(|(name, id)| {
28-                    serde_json::json!({ "name": name, "target": id.to_string() })
29-                })
30-                .collect();
31-            return Ok(Json(serde_json::json!({ "refs": refs_json })));
32-        }
33-    }
34-
35-    // Fall back to git mirror refs (from raw git push).
36-    if store.has_git_mirror(&params.did, &params.repo) {
37-        let mirror = store
38-            .open_or_init_git_mirror(&params.did, &params.repo)
39-            .map_err(|e| NodeError::Internal(format!("open mirror: {e}")))?;
40-        drop(store);
41-
42-        let mut refs_json: Vec<serde_json::Value> = Vec::new();
43-        let references = mirror
44-            .references()
45-            .map_err(|e| NodeError::Internal(format!("list refs: {e}")))?;
46-
47-        for r in references.flatten() {
48-            let Some(name) = r.name() else { continue };
49-            let Some(oid) = r.target() else { continue };
50-            refs_json.push(serde_json::json!({
51-                "name": name,
52-                "target": oid.to_string(),
53-            }));
54-        }
55-
56-        return Ok(Json(serde_json::json!({ "refs": refs_json })));
57-    }
58-
59-    drop(store);
60-    Ok(Json(serde_json::json!({ "refs": [] })))
22+    // Return refs from the panproto-vcs store. We do NOT fall back to
23+    // git mirror refs: those are git OIDs (20 bytes) while panproto-xrpc
24+    // clients expect panproto ObjectIds (32 bytes). Empty response is the
25+    // correct behavior for repos without vcs data.
26+    let refs = store
27+        .list_refs(&params.did, &params.repo)
28+        .unwrap_or_default();
29+    let refs_json: Vec<serde_json::Value> = refs
30+        .into_iter()
31+        .map(|(name, id)| {
32+            serde_json::json!({ "name": name, "target": id.to_string() })
33+        })
34+        .collect();
35+    Ok(Json(serde_json::json!({ "refs": refs_json })))
6136 }
cospan · schematic version control on atproto built on AT Protocol