feat(platform): Phase 550 role and overwrite span metadata extend

Add customRoleCount on role update/delete, channelOverwriteCount on overwrite
upsert, and remainingOverwriteCount on overwrite delete.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-24 13:44:30 -04:00
co-authored by Cursor
parent be2d463c86
commit 51f735b5e0
2 changed files with 22 additions and 5 deletions
+2
View File
@@ -185,6 +185,8 @@ Expose a single `EventEmitter` API the UI drives over IPC (`apps/pearcord/index.
**v0.8.498 (Phase 535):** Moderation/automod spans extend — `ban.member`/`kick.member`/`timeout.member`/`automod.*` end metadata (`spanKind`, `activeChannelId`). UI moderation panel compositor wrappers, ban/audit `aria-current=location`, clipboard moderation busy flags. Bundle: `npm run test:phase535-moderation`. See [MODERATION.md](../../docs/MODERATION.md). **v0.8.498 (Phase 535):** Moderation/automod spans extend — `ban.member`/`kick.member`/`timeout.member`/`automod.*` end metadata (`spanKind`, `activeChannelId`). UI moderation panel compositor wrappers, ban/audit `aria-current=location`, clipboard moderation busy flags. Bundle: `npm run test:phase535-moderation`. See [MODERATION.md](../../docs/MODERATION.md).
**v0.8.513 (Phase 550):** Role/permission spans extend — `customRoleCount` on update/delete, `channelOverwriteCount`/`remainingOverwriteCount`. UI split role list + channel perm panels; `.roles-panel-live`/`.roles-modal-live`; clipboard `rolesListChromeBusy`/`rolesChannelPermControlsBusy`. ui-flow composer focus after delete/reorder role. Bundle: `npm run test:phase550-roles`. See [ROLES.md](../../docs/ROLES.md).
**v0.8.497 (Phase 534):** Role/permission spans extend — `role.create`/`update`/`delete`/`reorder` and `permission.overwrite*` end metadata (`spanKind`, `activeChannelId`, `customRoleCount`). UI roles panel compositor wrappers, role/overwrite `aria-current=location`, clipboard roles busy flags. Bundle: `npm run test:phase534-roles`. See [ROLES.md](../../docs/ROLES.md). **v0.8.497 (Phase 534):** Role/permission spans extend — `role.create`/`update`/`delete`/`reorder` and `permission.overwrite*` end metadata (`spanKind`, `activeChannelId`, `customRoleCount`). UI roles panel compositor wrappers, role/overwrite `aria-current=location`, clipboard roles busy flags. Bundle: `npm run test:phase534-roles`. See [ROLES.md](../../docs/ROLES.md).
**v0.8.512 (Phase 549):** Guild-admin spans extend — `channel.create` `channelCount`, `channel.delete` `remainingChannelCount`, `channel.reorder` `requestedCount`/`reorderedAll`. UI split channel list chrome/rows + category panels; `.guild-admin-modal-live`; clipboard `guildAdminChannelModalBusy`. ui-flow composer focus after `rename-channel`/`create-category`. Bundle: `npm run test:phase549-guild-admin`. See [CHANNELS.md](../../docs/CHANNELS.md). **v0.8.512 (Phase 549):** Guild-admin spans extend — `channel.create` `channelCount`, `channel.delete` `remainingChannelCount`, `channel.reorder` `requestedCount`/`reorderedAll`. UI split channel list chrome/rows + category panels; `.guild-admin-modal-live`; clipboard `guildAdminChannelModalBusy`. ui-flow composer focus after `rename-channel`/`create-category`. Bundle: `npm run test:phase549-guild-admin`. See [CHANNELS.md](../../docs/CHANNELS.md).
+20 -5
View File
@@ -5403,6 +5403,7 @@ class PearcordPlatform extends EventEmitter {
this.guild.gossipRoleUpsert(row) this.guild.gossipRoleUpsert(row)
this.emit('guild-role', row) this.emit('guild-role', row)
const permissionMask = Number(row?.permissions ?? patch.permissions) || 0 const permissionMask = Number(row?.permissions ?? patch.permissions) || 0
const customRoles = await this.guildRoles.listRoles(this.guild.guild.id)
span.end({ span.end({
roleId: row?.id || roleId, roleId: row?.id || roleId,
guildId, guildId,
@@ -5416,7 +5417,8 @@ class PearcordPlatform extends EventEmitter {
permissionsChanged: patch.permissions !== undefined, permissionsChanged: patch.permissions !== undefined,
hoistChanged: patch.hoist !== undefined, hoistChanged: patch.hoist !== undefined,
spanKind: 'role.update', spanKind: 'role.update',
activeChannelId: this.activeChannelId activeChannelId: this.activeChannelId,
customRoleCount: customRoles.length
}) })
return row return row
} catch (err) { } catch (err) {
@@ -5444,12 +5446,14 @@ class PearcordPlatform extends EventEmitter {
this.guild.gossipRoleDelete({ guildId: this.guild.guild.id, id: roleId }) this.guild.gossipRoleDelete({ guildId: this.guild.guild.id, id: roleId })
this.emit('guild-role-delete', { guildId: this.guild.guild.id, id: roleId }) this.emit('guild-role-delete', { guildId: this.guild.guild.id, id: roleId })
} }
const customRoles = await this.guildRoles.listRoles(this.guild.guild.id)
span.end({ span.end({
roleId, roleId,
guildId, guildId,
existed: !!prev, existed: !!prev,
spanKind: 'role.delete', spanKind: 'role.delete',
activeChannelId: this.activeChannelId activeChannelId: this.activeChannelId,
customRoleCount: customRoles.length
}) })
return prev return prev
} catch (err) { } catch (err) {
@@ -5482,7 +5486,8 @@ class PearcordPlatform extends EventEmitter {
guildId, guildId,
requested: (roleIds || []).length, requested: (roleIds || []).length,
spanKind: 'role.reorder', spanKind: 'role.reorder',
activeChannelId: this.activeChannelId activeChannelId: this.activeChannelId,
reorderedAll: rows.length === (roleIds || []).length
}) })
return rows return rows
} catch (err) { } catch (err) {
@@ -5736,6 +5741,10 @@ class PearcordPlatform extends EventEmitter {
await this._fanoutAppEvent(APP_EVENTS.CHANNEL_PERMISSION_UPDATE, { overwrite: row }) await this._fanoutAppEvent(APP_EVENTS.CHANNEL_PERMISSION_UPDATE, { overwrite: row })
const previousAllowBits = Number(prevOw?.allow) || 0 const previousAllowBits = Number(prevOw?.allow) || 0
const previousDenyBits = Number(prevOw?.deny) || 0 const previousDenyBits = Number(prevOw?.deny) || 0
const overwrites = await this.channelPermissions.listForChannel(
this.guild.guild.id,
chId
)
span.end({ span.end({
channelId: chId, channelId: chId,
guildId, guildId,
@@ -5751,7 +5760,8 @@ class PearcordPlatform extends EventEmitter {
allowChanged: previousAllowBits !== allow, allowChanged: previousAllowBits !== allow,
denyChanged: previousDenyBits !== deny, denyChanged: previousDenyBits !== deny,
spanKind: 'permission.overwrite', spanKind: 'permission.overwrite',
activeChannelId: this.activeChannelId activeChannelId: this.activeChannelId,
channelOverwriteCount: overwrites.length
}) })
const evalSpan = this.log.time('permission.eval', { const evalSpan = this.log.time('permission.eval', {
channelId: chId, channelId: chId,
@@ -5821,6 +5831,10 @@ class PearcordPlatform extends EventEmitter {
await this._fanoutAppEvent(APP_EVENTS.CHANNEL_PERMISSION_DELETE, { await this._fanoutAppEvent(APP_EVENTS.CHANNEL_PERMISSION_DELETE, {
delete: { channelId: chId, targetType, targetId } delete: { channelId: chId, targetType, targetId }
}) })
const remaining = await this.channelPermissions.listForChannel(
this.guild.guild.id,
chId
)
span.end({ span.end({
channelId: chId, channelId: chId,
guildId, guildId,
@@ -5830,7 +5844,8 @@ class PearcordPlatform extends EventEmitter {
hadAllow: !!(Number(prev?.allow) || 0), hadAllow: !!(Number(prev?.allow) || 0),
hadDeny: !!(Number(prev?.deny) || 0), hadDeny: !!(Number(prev?.deny) || 0),
spanKind: 'permission.overwrite.delete', spanKind: 'permission.overwrite.delete',
activeChannelId: this.activeChannelId activeChannelId: this.activeChannelId,
remainingOverwriteCount: remaining.length
}) })
return prev return prev
} catch (err) { } catch (err) {