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(notifications): log each step of test fire + delivery

every path (enqueue, session resolve, getConvoForMembers, sendMessage)
gets an info or warn so we can see exactly where a DM fails silently.

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

+22 -4
+22 -4
backend/src/notifications.zig
··· 279 279 , .{ owner_did, rkey }); 280 280 defer rows.deinit(); 281 281 282 - const row = rows.next() orelse return error.NotFound; 282 + const row = rows.next() orelse { 283 + logfire.warn("testFire: sub not found owner={s} rkey={s}", .{ owner_did, rkey }); 284 + return error.NotFound; 285 + }; 283 286 const dest_kind = row.text(0); 284 287 const dest_value = row.text(1); 285 288 const trigger_kind = row.text(2); 286 289 const trigger_value = row.text(3); 287 290 288 291 if (!std.mem.eql(u8, dest_kind, "bsky")) return error.UnsupportedDestination; 292 + 293 + logfire.info("testFire: enqueuing sub rkey={s} owner={s} recipient={s}", .{ rkey, owner_did, dest_value }); 289 294 290 295 try enqueue(.{ 291 296 .owner_did = owner_did, ··· 378 383 defer arena.deinit(); 379 384 const a = arena.allocator(); 380 385 381 - const session = (try store.getSession(a, job.owner_did)) orelse return error.NoSession; 386 + logfire.info("deliver: starting sub={s} owner={s} recipient={s}", .{ job.sub_rkey, job.owner_did, job.recipient_did }); 382 387 383 - const convo_id = try oauth.chatGetConvoForMembers(a, session, &.{job.recipient_did}); 388 + const session = (try store.getSession(a, job.owner_did)) orelse { 389 + logfire.warn("deliver: NO session in memory for owner={s}", .{job.owner_did}); 390 + return error.NoSession; 391 + }; 392 + 393 + const convo_id = oauth.chatGetConvoForMembers(a, session, &.{job.recipient_did}) catch |err| { 394 + logfire.warn("deliver: getConvoForMembers failed sub={s} err={}", .{ job.sub_rkey, err }); 395 + return err; 396 + }; 397 + logfire.info("deliver: convo_id={s} sub={s}", .{ convo_id, job.sub_rkey }); 384 398 385 399 const text = try std.fmt.allocPrint(a, 386 400 \\new on pub-search — matched your {s}="{s}" subscription ··· 389 403 \\{s} 390 404 , .{ job.trigger_kind, job.trigger_value, job.doc_title, job.doc_url }); 391 405 392 - try oauth.chatSendMessage(a, session, convo_id, text); 406 + oauth.chatSendMessage(a, session, convo_id, text) catch |err| { 407 + logfire.warn("deliver: sendMessage failed sub={s} err={}", .{ job.sub_rkey, err }); 408 + return err; 409 + }; 410 + logfire.info("deliver: DM sent sub={s} recipient={s}", .{ job.sub_rkey, job.recipient_did }); 393 411 _ = delivered_count.fetchAdd(1, .monotonic); 394 412 } 395 413