Skip to content

Split policy telemetry by delivery source - #328140

Open
Harald Kirschner (digitarald) wants to merge 7 commits into
mainfrom
digitarald-policy-count-admin-vs-gates
Open

Split policy telemetry by delivery source#328140
Harald Kirschner (digitarald) wants to merge 7 commits into
mainfrom
digitarald-policy-count-admin-vs-gates

Conversation

@digitarald

@digitarald Harald Kirschner (digitarald) commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Fixes microsoft/vscode-internalbacklog#8655

Summary

  • Replaces the ambiguous policyCount aggregate in policy.applied with seven mutually exclusive source counts: devicePolicyCount, nativeMdmPolicyCount, serverManagedSettingsPolicyCount, fileManagedSettingsPolicyCount, mixedManagedSettingsPolicyCount, accountPolicyCount, and accountGatePolicyCount.
  • Adds effective-source tracking to the policy service contract and carries the winning source through AccountPolicyService and MultiplexPolicyService, including source-only transitions where the effective value does not change.
  • Centralizes value/source transition bookkeeping in AbstractPolicyService, while leaving account-gate and managed-settings attribution in AccountPolicyService.
  • Attributes managed-settings values by reevaluating each policy callback without its applied managed keys. This keeps account attribution when a present managed setting did not affect the effective value, and reports a specific or mixed managed-settings channel when it did.

Rationale

The aggregate count conflated device policy, managed-settings delivery channels, GitHub account policy, and approved-account gate restrictions. The replacement fields make each effective source independently measurable without logging policy names, values, organizations, URLs, or other high-cardinality data.

devicePolicyCount represents direct VS Code policy. Native MDM, GitHub server-delivered managed settings, and file-based managed settings each have their own count; policies jointly caused by multiple managed-settings channels use mixedManagedSettingsPolicyCount. accountPolicyCount covers GitHub account policy and entitlement data, while accountGatePolicyCount covers effective values forced by an unsatisfied approved-account gate.

Validation

  • npm run typecheck-client
  • npm run transpile-client
  • ./scripts/test.sh --run src/vs/platform/policy/test/common/policy.test.ts --run src/vs/workbench/services/policies/test/browser/accountPolicyService.test.ts --run src/vs/workbench/services/policies/test/browser/multiplexPolicyService.test.ts --run src/vs/workbench/services/policies/test/browser/policyTelemetryContribution.test.ts (45 passing)
  • Focused hygiene checks from the pre-commit hook
  • git diff --check

Preserve policyCount as the legacy effective total while adding administrator, account, and account-gate family counts. Track the winning source through account and multiplex policy services, including source-only transitions.

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

Copilot-Session: 2773b969-fe4a-4671-a0a1-1fc69b1968f3
Copilot AI review requested due to automatic review settings July 30, 2026 00:27

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.

Pull request overview

Adds privacy-safe telemetry counts that distinguish administrator, account, and account-gate policy sources while preserving the existing total.

Changes:

  • Introduces policy source tracking through account and multiplex services.
  • Adds source-partitioned telemetry fields.
  • Expands policy source tests.
Show a summary per file
File Description
policy.ts Defines the policy source API.
multiplexPolicyService.ts Propagates winning policy sources.
accountPolicyService.ts Resolves and tracks account policy sources.
policyTelemetry.contribution.ts Reports partitioned policy counts.
accountPolicyService.test.ts Tests account, managed, and gate attribution.
multiplexPolicyService.test.ts Tests multiplexed source selection.
policyTelemetryContribution.test.ts Tests source-family telemetry counts.

Review details

  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread src/vs/workbench/services/policies/common/accountPolicyService.ts Outdated
Make administrator, account, and account-gate counts the canonical policy.applied schema. Values without explicit provenance are excluded instead of being attributed to administrators.

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

Copilot-Session: 2773b969-fe4a-4671-a0a1-1fc69b1968f3
@digitarald Harald Kirschner (digitarald) changed the title Distinguish administrator and account policy counts Replace aggregate policy count with source-specific counts Jul 30, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2773b969-fe4a-4671-a0a1-1fc69b1968f3
@digitarald Harald Kirschner (digitarald) changed the title Replace aggregate policy count with source-specific counts Split policy telemetry by delivery source Jul 30, 2026
Centralize policy value and source transitions in AbstractPolicyService and isolate account-specific source resolution.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1ced0d45-0ef0-4c69-843f-9951452d9b92

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.

Review details

  • Files reviewed: 8/8 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@joshspicer
Josh Spicer (joshspicer) enabled auto-merge (squash) August 5, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants