Skip to content

feat: add device permission diagnostics metrics 2 - #5169

Open
gabrielchl wants to merge 7 commits into
webex:nextfrom
gabrielchl:gabrilee/device-permission-diagnostics-metrics-2
Open

feat: add device permission diagnostics metrics 2#5169
gabrielchl wants to merge 7 commits into
webex:nextfrom
gabrielchl:gabrilee/device-permission-diagnostics-metrics-2

Conversation

@gabrielchl

Copy link
Copy Markdown
Contributor

COMPLETES https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-842561

This pull request addresses

the event definitions were added here: https://sqbu-github.cisco.com/WebExSquared/event-dictionary/pull/2520

by making the following changes

adding metrics to applicable events as defined in https://confluence-eng-gpk2.cisco.com/conf/spaces/CAL/pages/866309853/Daily+Meeting+Issue+Report+Initiative

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

@gabrielchl
gabrielchl requested review from a team as code owners August 13, 2026 09:49
@gabrielchl gabrielchl changed the title Gabrilee/device permission diagnostics metrics 2 feat: add device permission diagnostics metrics 2 Aug 13, 2026
@gabrielchl
gabrielchl marked this pull request as draft August 13, 2026 09:49
@gabrielchl gabrielchl added the validated If the pull request is validated for automation. label Aug 14, 2026
@gabrielchl
gabrielchl marked this pull request as ready for review August 14, 2026 10:20

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0008b3694

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +396 to +400
const enrichedPayload = this.privacyAndSecurityPermissionEnricher.enrich({
name,
payload,
scope: this.getPermissionScope(options),
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enrich the fetch-based client-event path

When permission state has been set and callers use the documented buildClientEventFetchRequestOptions flow for tab-close/beforeUnload client events, this new enrichment never runs because it is only applied in submitClientEvent; the helper at lines 468-503 still forwards the original payload directly. That path exists specifically for cases where submitClientEvent cannot be used, so terminal events such as client.call.leave sent during page close will omit privacyAndSecurityPermission while normal submissions include it. Apply the same enrichment before building the fetch request options.

Useful? React with 👍 / 👎.

@chrisadubois

Copy link
Copy Markdown
Collaborator

original PR comments can be found here: #5155 creating link for historical purposes

});

return this.callDiagnosticMetrics.submitClientEvent({
const enrichedPayload = this.privacyAndSecurityPermissionEnricher.enrich({

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$

@@ -0,0 +1,235 @@
import {isEqual} from 'lodash';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Feels like this file deserves it's own folder with

index
utils
constants
types

previous?: PrivacyAndSecurityPermissionState
): boolean => isEqual(current, previous);

const resolveMediaResources = (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

},
{
events: MEDIA_TX_PERMISSION_EVENTS,
resolve: (payload) => ({resources: resolveMediaResources(payload), terminal: false}),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

{
events: CONTENT_SHARE_PERMISSION_EVENTS,
resolve: (payload) => ({
resources: payload?.mediaType === 'share' ? ['contentShare'] : [],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be better as a func


const projectPrivacyAndSecurityPermission = (
permission: PrivacyAndSecurityPermission,
resources: readonly PrivacyAndSecurityPermissionResource[]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

current: PrivacyAndSecurityPermission,
previous: PrivacyAndSecurityPermission
): PrivacyAndSecurityPermission | undefined => {
const changedPermission: PrivacyAndSecurityPermission = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: the layered ternaries are a bit tough with the object spread too


import {PERMISSION_ENRICHMENT_RULES} from '../../../src/privacy-and-security-permission-enricher';

describe('PrivacyAndSecurityPermissionEnricher', () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test feels highly incomplete, there should be a full suite of tests

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modularization of tests should apply here

@github-actions github-actions Bot removed the validated If the pull request is validated for automation. label Aug 17, 2026
@gabrielchl gabrielchl added the validated If the pull request is validated for automation. label Aug 18, 2026
@gabrielchl
gabrielchl enabled auto-merge (squash) August 19, 2026 13:02
@github-actions github-actions Bot removed the validated If the pull request is validated for automation. label Aug 19, 2026
@gabrielchl gabrielchl added the validated If the pull request is validated for automation. label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated If the pull request is validated for automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants