Phase 469: extend notification and inbox platform span metadata

Add kind/read/inboxCount/messageId/threadRead/isDm span fields and normalize
notification/inbox error logs to the error: key.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-24 02:44:29 -04:00
co-authored by Cursor
parent a330dd32ae
commit ba20e2161d
2 changed files with 19 additions and 9 deletions
+2
View File
@@ -186,6 +186,8 @@ Primary consumer: `apps/pearcord/index.js` sidecar reading pear-pipe JSON.
**v0.8.403:** `stageAttachment`/`readAttachmentPreview` log `attachment.*` spans and errors; `_queueLinkEmbed` logs `embed.resolve` span and `embed.resolve error` on failure. **v0.8.403:** `stageAttachment`/`readAttachmentPreview` log `attachment.*` spans and errors; `_queueLinkEmbed` logs `embed.resolve` span and `embed.resolve error` on failure.
**v0.8.432:** `notification.markRead` span `end` adds `kind` + `read`; `notification.markAll` adds `inboxCount`; `notification.open` adds `messageId`; `inbox.mark-read`/`thread.read` span `end` adds `threadRead` + `isDm`. Error logs use `error:` key. UI `syncNotificationPanelsDuringGuildLoading` + composer notif hint + thread-read live region. Smokes: `test:platform-notification-span-metadata-extend`, `test:dev-log-notification-errors-tighten`, `test:dev-log-inbox-errors-tighten`. Bundle: `test:phase469-notifications-inbox`.
**v0.8.416:** `openNotificationTarget` span `end` includes `guildId`; `markAllNotificationsRead` / `markNotificationRead` / `markChannelRead` (`inbox.mark-read` or `thread.read`) span `end` includes `guildId` + `channelId`. Smoke: `test:platform-notification-span-guild-id`. Bundle: `test:phase453-notifications-inbox`. **v0.8.416:** `openNotificationTarget` span `end` includes `guildId`; `markAllNotificationsRead` / `markNotificationRead` / `markChannelRead` (`inbox.mark-read` or `thread.read`) span `end` includes `guildId` + `channelId`. Smoke: `test:platform-notification-span-guild-id`. Bundle: `test:phase453-notifications-inbox`.
**v0.8.407:** `markNotificationRead(notificationId)` wraps inbox `markRead` with `notification.markRead` span + `notification.markRead error`. `markAllNotificationsRead` span ends with `count` + `guildId`. `markChannelRead` logs `inbox.mark-read` span + error for non-thread channels (thread channels use `thread.read`). Smokes: `test:notification-platform-errors`, `test:inbox-platform-errors`. Bundle: `test:phase444-notifications-inbox`. **v0.8.407:** `markNotificationRead(notificationId)` wraps inbox `markRead` with `notification.markRead` span + `notification.markRead error`. `markAllNotificationsRead` span ends with `count` + `guildId`. `markChannelRead` logs `inbox.mark-read` span + error for non-thread channels (thread channels use `thread.read`). Smokes: `test:notification-platform-errors`, `test:inbox-platform-errors`. Bundle: `test:phase444-notifications-inbox`.
+17 -9
View File
@@ -3670,11 +3670,16 @@ class PearcordPlatform extends EventEmitter {
const span = this.log.time('notification.markAll') const span = this.log.time('notification.markAll')
try { try {
const count = await this.notifications.markAllRead() const count = await this.notifications.markAllRead()
span.end({ count, guildId: this.guild?.guild?.id || null }) const inboxRows = await this.notifications.listRecent(500)
span.end({
count,
guildId: this.guild?.guild?.id || null,
inboxCount: inboxRows?.length ?? 0
})
return count return count
} catch (err) { } catch (err) {
this.log.error('notification.markAll error', { this.log.error('notification.markAll error', {
err: err?.message || String(err) error: err?.message || String(err)
}) })
span.fail(err) span.fail(err)
throw err throw err
@@ -3690,13 +3695,15 @@ class PearcordPlatform extends EventEmitter {
const row = await this.notifications.markRead(notificationId) const row = await this.notifications.markRead(notificationId)
span.end({ span.end({
channelId: row?.channelId || null, channelId: row?.channelId || null,
guildId: row?.guildId || null guildId: row?.guildId || null,
kind: row?.kind || null,
read: true
}) })
return row return row
} catch (err) { } catch (err) {
this.log.error('notification.markRead error', { this.log.error('notification.markRead error', {
notificationId: notificationId || null, notificationId: notificationId || null,
err: err?.message || String(err) error: err?.message || String(err)
}) })
span.fail(err) span.fail(err)
throw err throw err
@@ -6909,7 +6916,8 @@ class PearcordPlatform extends EventEmitter {
span.end({ span.end({
found: !!result?.found, found: !!result?.found,
guildId: guildId || this.guild?.guild?.id || null, guildId: guildId || this.guild?.guild?.id || null,
channelId: result?.channelId || channelId || this.activeChannelId channelId: result?.channelId || channelId || this.activeChannelId,
messageId: messageId || null
}) })
return result return result
} catch (err) { } catch (err) {
@@ -6917,7 +6925,7 @@ class PearcordPlatform extends EventEmitter {
guildId: guildId || null, guildId: guildId || null,
channelId: channelId || null, channelId: channelId || null,
messageId: messageId || null, messageId: messageId || null,
err: err?.message || String(err) error: err?.message || String(err)
}) })
span.fail(err) span.fail(err)
throw err throw err
@@ -7524,19 +7532,19 @@ class PearcordPlatform extends EventEmitter {
if (threadRead) { if (threadRead) {
this._invalidateSearchCache() this._invalidateSearchCache()
} }
span.end({ channelId, guildId }) span.end({ channelId, guildId, threadRead, isDm: guildId === DM_GUILD_ID })
} catch (err) { } catch (err) {
if (threadRead) { if (threadRead) {
this.log.error('thread.read error', { this.log.error('thread.read error', {
channelId, channelId,
guildId, guildId,
err: err?.message || String(err) error: err?.message || String(err)
}) })
} else { } else {
this.log.error('inbox.mark-read error', { this.log.error('inbox.mark-read error', {
channelId, channelId,
guildId, guildId,
err: err?.message || String(err) error: err?.message || String(err)
}) })
} }
throw err throw err