Phase 470: extend guild.search and pin platform span metadata

Add meshHitCount/localHitCount/mesh on search span end and messageId/pinCount
on pin.message and pin.unpin span end.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-24 02:50:20 -04:00
co-authored by Cursor
parent ba20e2161d
commit 1d6fc9d66c
2 changed files with 10 additions and 4 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.433 (Phase 470):** `guild.search` span `end` adds `meshHitCount`/`localHitCount`/`mesh` per scope; `pin.message`/`pin.unpin` span `end` adds `messageId` + `pinCount`. UI `syncSearchPanelsDuringGuildLoading` + composer search hint. Smokes: `test:platform-search-span-metadata-extend`, `test:dev-log-search-errors-tighten`, `test:dev-log-pin-errors-tighten`. Bundle: `test:phase470-search-pins`.
**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.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`.
+8 -4
View File
@@ -1744,7 +1744,7 @@ class PearcordPlatform extends EventEmitter {
this._searchFetchedAt = this._lastSearchMeshMeta.fetchedAt this._searchFetchedAt = this._lastSearchMeshMeta.fetchedAt
const searchMs = Date.now() - searchStarted const searchMs = Date.now() - searchStarted
this._lastSearchMeshMeta = { ...this._lastSearchMeshMeta, searchMs } this._lastSearchMeshMeta = { ...this._lastSearchMeshMeta, searchMs }
endSearchSpan({ count: out.hits?.length || 0, scope: 'forum', searchMs }) endSearchSpan({ count: out.hits?.length || 0, scope: 'forum', searchMs, mesh: !!out.mesh, meshHitCount: out.meshHitCount || 0, localHitCount: out.localHitCount || 0 })
this._commitSearchCache(cacheKey, out.hits) this._commitSearchCache(cacheKey, out.hits)
return out.hits return out.hits
} }
@@ -1811,7 +1811,7 @@ class PearcordPlatform extends EventEmitter {
searchMs searchMs
} }
this._searchFetchedAt = this._lastSearchMeshMeta.fetchedAt this._searchFetchedAt = this._lastSearchMeshMeta.fetchedAt
endSearchSpan({ count: hits.length, scope: 'channel', searchMs }) endSearchSpan({ count: hits.length, scope: 'channel', searchMs, localHitCount: hits.length })
this._commitSearchCache(cacheKey, hits) this._commitSearchCache(cacheKey, hits)
return hits return hits
} }
@@ -1836,6 +1836,8 @@ class PearcordPlatform extends EventEmitter {
count: filtered?.length || 0, count: filtered?.length || 0,
scope: 'guild', scope: 'guild',
mesh: !!out.mesh, mesh: !!out.mesh,
meshHitCount: out.meshHitCount || 0,
localHitCount: out.localHitCount || 0,
searchMs searchMs
}) })
this._commitSearchCache(cacheKey, filtered) this._commitSearchCache(cacheKey, filtered)
@@ -11245,7 +11247,8 @@ class PearcordPlatform extends EventEmitter {
await this.db.insert(COLLECTIONS.PINS, pin) await this.db.insert(COLLECTIONS.PINS, pin)
this.guild.gossipPin(pin) this.guild.gossipPin(pin)
this.emit('pin', pin) this.emit('pin', pin)
span.end({ channelId: pin.channelId, guildId }) const pinRows = await this.db.find(COLLECTIONS.PINS, { channelId: pin.channelId })
span.end({ channelId: pin.channelId, guildId, messageId, pinCount: pinRows.length })
return pin return pin
} catch (err) { } catch (err) {
this.log.error('pin.message error', { this.log.error('pin.message error', {
@@ -11270,8 +11273,9 @@ class PearcordPlatform extends EventEmitter {
channelId: this.activeChannelId, channelId: this.activeChannelId,
messageId messageId
}) })
const pinRows = await this.db.find(COLLECTIONS.PINS, { channelId: this.activeChannelId })
this.emit('pin', { channelId: this.activeChannelId, messageId, removed: true }) this.emit('pin', { channelId: this.activeChannelId, messageId, removed: true })
span.end({ channelId: this.activeChannelId, guildId }) span.end({ channelId: this.activeChannelId, guildId, messageId, pinCount: pinRows.length })
} catch (err) { } catch (err) {
this.log.error('pin.unpin error', { this.log.error('pin.unpin error', {
messageId, messageId,