search for standard sites pub-search.waow.tech
search zig blog atproto
11
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: log my-publications handler steps

debugging why the toggle list shows empty even after the devlog account
created a site.standard.graph.subscription on its PDS. logs:
- entry (did + resolved pds url)
- PDS response size + first 120 bytes
- record count on success path
- explicit logs for the "no records key" / "not an array" early returns
- json parse failure includes a body preview

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

+11 -1
+11 -1
backend/src/server/subscriptions.zig
··· 17 17 const store = @import("../state.zig"); 18 18 const notifications = @import("../notifications.zig"); 19 19 const db = @import("../db.zig"); 20 + const logfire = @import("logfire"); 20 21 21 22 const SUBSCRIPTION_COLLECTION = notifications.SUBSCRIPTION_COLLECTION; 22 23 ··· 199 200 const url = try std.fmt.allocPrint(alloc, "{s}/xrpc/com.atproto.repo.listRecords?repo={s}&collection=site.standard.graph.subscription&limit=100", .{ 200 201 session.pds_url, session.did, 201 202 }); 203 + logfire.info("handleMyPublications: did={s} pds={s}", .{ session.did, session.pds_url }); 202 204 203 205 const body = oauth.httpGet(alloc, url) catch |err| { 204 - std.log.warn("handleMyPublications: listRecords failed: {}", .{err}); 206 + logfire.warn("handleMyPublications: listRecords failed: {}", .{err}); 205 207 try sendJsonStatus(request, .bad_gateway, "{\"error\":\"failed to fetch subscriptions from PDS\"}"); 206 208 return; 207 209 }; 210 + logfire.info("handleMyPublications: body_bytes={d} preview={s}", .{ 211 + body.len, 212 + body[0..@min(body.len, 120)], 213 + }); 208 214 209 215 const parsed = json.parseFromSlice(json.Value, alloc, body, .{}) catch { 216 + logfire.warn("handleMyPublications: json parse failed, body_preview={s}", .{body[0..@min(body.len, 200)]}); 210 217 try sendJsonStatus(request, .bad_gateway, "{\"error\":\"PDS returned invalid json\"}"); 211 218 return; 212 219 }; 213 220 defer parsed.deinit(); 214 221 215 222 const records = parsed.value.object.get("records") orelse { 223 + logfire.info("handleMyPublications: no 'records' key in response", .{}); 216 224 try sendJson(request, "[]"); 217 225 return; 218 226 }; 219 227 if (records != .array) { 228 + logfire.info("handleMyPublications: 'records' is not an array (kind={t})", .{records}); 220 229 try sendJson(request, "[]"); 221 230 return; 222 231 } 232 + logfire.info("handleMyPublications: returning {d} records", .{records.array.items.len}); 223 233 224 234 const local = db.getLocalDbRaw(); 225 235