Visitar URL original
AB#3752410: Improve platform brokering observability by lalimasharda · Pull Request #8824 · AzureAD/microsoft-authentication-library-for-js · GitHub
Skip to content

AB#3752410: Improve platform brokering observability - #8824

Merged
Lalima Sharda (lalimasharda) merged 49 commits into
devfrom
js-wam/platform-broker-observability
Oct 1, 2026
Merged

Lalima Sharda (lalimasharda) merged 49 commits into
devfrom
js-wam/platform-broker-observability

Conversation

@lalimasharda

@lalimasharda Lalima Sharda (lalimasharda) commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add performance measurements across the MSAL.js platform-broker lifecycle for both browser-extension and DOM API flows. The measurements identify the provider used and correlate extension handshake telemetry with the originating request without recording tokens, account identifiers, URLs, or response payloads.

Implements

  • AB#3752410 - Improve platform brokering observability

How to validate

  • Both extension and DOM API flows expose measurements for important provider, transport, validation, response-processing, and cache operations.
  • Events include platformAuthProviderType to distinguish DOM and extension providers.
  • Extension handshake events include platformAuthRequestCorrelationId to join them to the originating request.
  • Automated tests validate diagnostic emission for representative success and failure paths.
  • Performance documentation describes the two platform-broker context fields.

Targeted validation:

npm test -- --runInBand test/app/PublicClientApplication.spec.ts test/broker/PlatformAuthDOMHandler.spec.ts test/broker/PlatformAuthExtensionHandler.spec.ts test/broker/PlatformAuthProvider.spec.ts test/interaction_client/PlatformAuthInteractionClient.spec.ts

Test Suites: 5 passed, 5 total
Tests:       3 skipped, 374 passed, 377 total

npm run lint and npm run format:check pass for the changed packages. Existing lint warnings remain unchanged.

Notes

Created by Forge create-pr skill. The [forge-iterating] title prefix signals that this PR is not ready for human review; it will be stripped once validation and CI pass.

assistance: agentic-cli
type: telemetry
agent-tool: copilot-cli
agent-model: gpt-5.6-sol
work-item: AB#3752410

Instrument provider discovery, routing decisions, broker transports, response processing, and cache stages for extension and DOM platform broker flows.

Co-authored-by: Forge <forge-bot@entra.github.io>
Forge-Agent: Developer
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
Copilot AI lite review requested due to automatic review settings September 11, 2026 15:49
Link the msal-browser and msal-common package changefiles to PR #8824.

Co-authored-by: Forge <forge-bot@entra.github.io>
Forge-Agent: Developer
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Address unresolved API metadata, extension correlation and timeout handling, documentation, and required changefile updates.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds structured performance telemetry across browser-extension and DOM platform-broker flows.

Changes:

  • Adds platform-broker lifecycle fields and event names.
  • Instruments discovery, routing, transport, validation, response, redirect, and cache stages.
  • Expands telemetry coverage in unit tests.
File summaries
File Description
lib/msal-common/src/telemetry/performance/PerformanceEvent.ts Adds platform-auth telemetry fields.
lib/msal-browser/test/interaction_client/PlatformAuthInteractionClient.spec.ts Tests interaction-client telemetry.
lib/msal-browser/test/broker/PlatformAuthProvider.spec.ts Tests provider discovery telemetry.
lib/msal-browser/test/broker/PlatformAuthExtensionHandler.spec.ts Tests extension lifecycle telemetry.
lib/msal-browser/test/broker/PlatformAuthDOMHandler.spec.ts Tests DOM lifecycle telemetry.
lib/msal-browser/test/app/PublicClientApplication.spec.ts Tests routing telemetry.
lib/msal-browser/src/telemetry/BrowserPerformanceEvents.ts Defines performance event names.
lib/msal-browser/src/interaction_client/PlatformAuthInteractionClient.ts Instruments request, response, redirect, and cache stages.
lib/msal-browser/src/controllers/StandardController.ts Adds routing eligibility telemetry.
lib/msal-browser/src/broker/nativeBroker/PlatformAuthProvider.ts Instruments provider discovery and eligibility.
lib/msal-browser/src/broker/nativeBroker/PlatformAuthExtensionHandler.ts Instruments extension handshake, messaging, and validation.
lib/msal-browser/src/broker/nativeBroker/PlatformAuthDOMHandler.ts Instruments DOM discovery, messaging, and validation.
Review details

Suppressed comments (4)

lib/msal-browser/src/broker/nativeBroker/PlatformAuthExtensionHandler.ts:90

  • This measurement does not cover a request timeout: after the handshake, the resolver promise registered below has no request-level timer, so an already-handshaken extension that stops responding leaves PlatformAuthExtensionSendMessage in progress forever and emits no timeout diagnostic. Add request-level timeout/cleanup and end the measurement with a stable timeout response category.
        const sendMessageMeasurement = this.performanceClient.startMeasurement(
            BrowserPerformanceEvents.PlatformAuthExtensionSendMessage,
            correlationId

lib/msal-browser/src/broker/nativeBroker/PlatformAuthExtensionHandler.ts:269

  • The handshake resolver now carries correlationId, but the timeout rejection below still constructs nativeHandshakeTimeout with an empty correlation ID. When both extension attempts time out, the surfaced error cannot be correlated with the provider-discovery/request telemetry; use the correlationId parameter here as well.
        return new Promise((resolve, reject) => {
            this.handshakeResolvers.set(req.responseId, {
                resolve,
                reject,
                correlationId,
            });

lib/msal-common/src/telemetry/performance/PerformanceEvent.ts:325

  • This PR changes core library source files, but no Beachball changefile is included. Add the required change/** patch/minor entry with a description and linked PR number before merging.
    platformAuthAllowed?: boolean;
    platformAuthEligibilityReason?: string;
    platformAuthProviderType?: string;
    platformAuthProviderAvailable?: boolean;
    platformAuthDomEnabled?: boolean;

lib/msal-common/src/telemetry/performance/PerformanceEvent.ts:333

  • The new public telemetry fields and broker lifecycle event names are not documented in lib/msal-browser/docs/performance.md or lib/msal-common/docs/performance.md. Document the field semantics and stable stage/outcome/response-category values, including the operational queries/troubleshooting guidance promised by the PR description.
    platformAuthStage?: string;
    platformAuthIsPopRequest?: boolean;
    platformAuthPromptCategory?: string;
    storeInCacheAccessToken?: boolean;
    storeInCacheIdToken?: boolean;
  • Files reviewed: 14/14 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Resolve the extension-handler overlap with the platform broker DPoP contract changes while preserving transport telemetry.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
@lalimasharda Lalima Sharda (lalimasharda) added agentic-cli Copilot CLI / terminal agent drove the bulk of the edits telemetry Telemetry and observability changes labels Sep 16, 2026
Co-authored-by: Forge <forge-bot@entra.github.io>
Forge-Agent: Coder
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
Correlate extension handshake telemetry safely, preserve timeout error correlation, document broker diagnostics, and refresh the public API baseline.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
@lalimasharda

Copy link
Copy Markdown
Contributor Author

Addressed the review recommendations in e236e2491:

  • Added a correlation-safe platformAuthRequestCorrelationId join field for independently emitted extension handshake telemetry.
  • Preserved the request correlation ID on nativeHandshakeTimeout errors.
  • Updated the PerformanceEvent API review baseline.
  • Added platform broker performance-signal, troubleshooting, and privacy documentation.
  • Confirmed both required PR-linked changefiles are present.

Deferred with linked tasks under AB#3752410:

  • AB#3757761 — configurable extension token-request timeout and resolver cleanup.
  • AB#3757762 — navigator.platformAuthentication browser compatibility documentation.

Validation: focused extension-handler tests pass (12/12), browser/common lint pass, API Extractor passes, and edited documentation links resolve.

Retain only provider type and handshake request correlation context while preserving operation measurements.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
…lity' into js-wam/platform-broker-observability
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Use GetToken event names for DOM and extension token operations and normalize handler correlation ID selection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
…lity' into js-wam/platform-broker-observability
Initialize handshake telemetry with a dedicated measurement correlation ID so it remains independently emitted while platformAuthRequestCorrelationId links it to the request.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Co-authored-by: Forge <forge-bot@entra.github.io>
Forge-Agent: Coder
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
Do not reject a resolver when a response is intended for a different resolver type.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The performance documentation inaccurately describes event emission and provider-field semantics.

Review effort: Balanced
Findings: 2 Low severity

Open (2)
Resolved since last review (2)

Comment thread lib/msal-browser/docs/performance.md Resolved
Comment thread lib/msal-browser/docs/performance.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Unresolved telemetry propagation and privacy-documentation issues remain.

Review effort: Lite
Findings: 2 Low severity

Open (2)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
Keep silent platform broker eligibility telemetry without broadening getNativeAccountId or canUsePlatformBroker request types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7155fa61-5730-4d8d-9553-a89e8768e478
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
@lalimasharda Lalima Sharda (lalimasharda) changed the title [forge-iterating] AB#3752410: Improve platform brokering observability AB#3752410: Improve platform brokering observability Oct 1, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0bced410-2a72-4ca0-ae17-b5eae8cb4d40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentic-cli Copilot CLI / terminal agent drove the bulk of the edits telemetry Telemetry and observability changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants