feat(platform): extend voice/screen span metadata for Phase 480

Add wasInVoice, switchedChannel, hadMedia, hasLabel, and stopped fields to
voice.join, voice.leave, screen.start, and screen.stop spans.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-24 05:55:41 -04:00
co-authored by Cursor
parent 929517f860
commit 750cfaece5
2 changed files with 24 additions and 4 deletions
+2
View File
@@ -39,6 +39,8 @@ Expose a single `EventEmitter` API the UI drives over IPC (`apps/pearcord/index.
**v0.8.430 (Phase 467):** `voice.leave` span `end` includes `leavingIsStage`; `screen.start` span `end` includes `label`. Bundle: `npm run test:phase467-voice-stage`. See [VOICE.md](../../docs/VOICE.md), [STAGE_CHANNELS.md](../../docs/STAGE_CHANNELS.md).
**v0.8.443 (Phase 480):** `voice.join` `wasInVoice`/`switchedChannel`; `voice.leave` `hadMedia`; `screen.start` `hasLabel`; `screen.stop` `stopped`. UI voice compositor. Bundle: `npm run test:phase480-voice`. See [VOICE.md](../../docs/VOICE.md).
**v0.8.442 (Phase 479):** `discovery.list` `meshLive`/`filteredCount`; `discovery.join` on `joinPublicDiscovery`; `dm.open` `reusedChannel`; `contacts.accept` `accepted`. UI discovery compositor. Bundle: `npm run test:phase479-discovery`. See [DISCOVERY.md](../../docs/DISCOVERY.md).
**v0.8.441 (Phase 478):** `notification.markRead` `wasUnread`/`hadMessageId`; `notification.markAll` `unreadBefore`; `notification.open` `hasMessageId`; `inbox.mark-read` `clearedInboxCount`. UI `syncNotificationPanelsDuringGuildLoading` compositor. Bundle: `npm run test:phase478-notifications`. See [NOTIFICATIONS.md](../../docs/NOTIFICATIONS.md), [INBOX.md](../../docs/INBOX.md).
+22 -4
View File
@@ -6201,7 +6201,12 @@ class PearcordPlatform extends EventEmitter {
targetId: row.channelId
})
this.emit('screen-share', row)
span.end({ channelId: row?.channelId || null, guildId, label: label || null })
span.end({
channelId: row?.channelId || null,
guildId,
label: label || null,
hasLabel: !!(label && String(label).trim())
})
return row
} catch (err) {
this.log.error('screen.start error', {
@@ -6244,7 +6249,11 @@ class PearcordPlatform extends EventEmitter {
}
await this._audit('screen.stop', { guildId: row?.guildId, targetId: row?.channelId })
this.emit('screen-share', row)
span.end({ channelId: row?.channelId || null, guildId })
span.end({
channelId: row?.channelId || null,
guildId,
stopped: !!row
})
return row
} catch (err) {
this.log.error('screen.stop error', {
@@ -7093,6 +7102,7 @@ class PearcordPlatform extends EventEmitter {
async joinVoiceChannel (channelId, opts = {}) {
const guildId = this.guild?.guild?.id || null
const prevChannelId = this.voice?.myChannelId || null
const span = this.log.time('voice.join', { channelId: channelId || null, guildId })
try {
let listenOnly = !!opts.listenOnly
@@ -7135,7 +7145,13 @@ class PearcordPlatform extends EventEmitter {
})
this.emit('voice', row)
this.emit('voice-media')
span.end({ channelId, listenOnly, guildId })
span.end({
channelId,
listenOnly,
guildId,
wasInVoice: !!prevChannelId,
switchedChannel: !!(prevChannelId && prevChannelId !== channelId)
})
return row
} catch (err) {
this.log.error('voice.join error', {
@@ -7183,6 +7199,7 @@ class PearcordPlatform extends EventEmitter {
})
try {
const leavingId = this.voice?.myChannelId
const hadMedia = !!this.voiceMedia?.connected
let leavingIsStage = false
if (guild && leavingId) {
const ch = await this.db.get(COLLECTIONS.CHANNELS, {
@@ -7206,7 +7223,8 @@ class PearcordPlatform extends EventEmitter {
left: !!payload,
channelId: payload?.channelId || null,
guildId,
leavingIsStage
leavingIsStage,
hadMedia
})
return payload
} catch (err) {