Merged
Conversation
Adds build/lib/policies/mergeExtensionPolicies.ts which fetches the distro's product.json (at the commit pinned in package.json) and merges extensionConfigurationPolicy entries into policyData.jsonc. The --export-policy-data step only captures policies from the OSS configuration registry. Extension policies (e.g., Copilot settings) are defined in vscode-distro's product.json and are not available in the OSS dev build. This merge script bridges that gap. Workflow: ./scripts/code.sh --export-policy-data && node build/lib/policies/mergeExtensionPolicies.ts Also updates: - policyExport integration test to run the merge step - add-policy skill documentation with extension policy lifecycle
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a post-processing step to the policy export workflow so that extension-provided extensionConfigurationPolicy entries (which only exist in vscode-distro’s product.json) are merged into the exported build/lib/policies/policyData.jsonc, ensuring downstream policy artifacts include extension settings.
Changes:
- Introduces
build/lib/policies/mergeExtensionPolicies.tsto fetch distroproduct.json(local.build/distroor GitHub API) and mergeextensionConfigurationPolicyintopolicyData.jsonc. - Updates the policy export integration test to run the merge step after
--export-policy-data. - Updates policy export messaging/docs to reflect the new two-step generation workflow.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
build/lib/policies/mergeExtensionPolicies.ts |
New merge script that pulls extensionConfigurationPolicy from distro product.json and appends missing policies to exported policy data. |
src/vs/workbench/contrib/policyExport/electron-browser/policyExport.contribution.ts |
Updates the generated-file disclaimer string shown in exported policyData.jsonc. |
src/vs/workbench/contrib/policyExport/test/node/policyExport.integrationTest.ts |
Runs the merge script after export so the comparison includes extension policies. |
.github/skills/add-policy/SKILL.md |
Documents extension policy lifecycle and the new regeneration workflow including the merge step. |
src/vs/workbench/contrib/policyExport/electron-browser/policyExport.contribution.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/policyExport/test/node/policyExport.integrationTest.ts
Outdated
Show resolved
Hide resolved
- mergeExtensionPolicies.ts now reads only description/category from the distro and synthesizes localization key/value pairs internally - Integration test gracefully skips merge step when distro is unavailable - Updated SKILL.md to document the simplified distro format
Member
Author
…log from test Extension policies should only be added after the distro PR merges. Test runner disallows console output in tests.
…port test - mergeExtensionPolicies.ts: add DISTRO_PRODUCT_JSON env var to override the distro path (for testing without private repo access) - New test: creates a mock product.json, runs the merge script, verifies policies are added correctly and idempotently - Export test: no longer runs the merge step (avoids needing distro access or GITHUB_TOKEN in CI)
472daa2 to
905a12d
Compare
The export test now runs mergeExtensionPolicies using a checked-in fixture file instead of requiring distro access or GITHUB_TOKEN. When extension policies change in the distro, regenerate both policyData.jsonc and the fixture file.
pwang347
reviewed
Mar 31, 2026
- Removed mergeExtensionPolicies.ts — no separate CLI tool needed - --export-policy-data now reads build/lib/policies/extensionPolicies.json and merges extension policies into the output automatically - Single command workflow: ./scripts/code.sh --export-policy-data - Simplified test — no merge step, no GITHUB_TOKEN, no distro access - Updated SKILL.md to document the simplified workflow
…ctly - policyExport.contribution.ts reads distro product.json dynamically: 1. DISTRO_PRODUCT_JSON env var (for testing) 2. .build/distro/mixin/stable/product.json (local checkout) 3. GitHub API with GITHUB_TOKEN (remote fetch) - New scripts/export-policy-data.sh wrapper: sets up GITHUB_TOKEN via gh CLI and runs the export - Deleted build/lib/policies/extensionPolicies.json (no static copy) - Test uses DISTRO_PRODUCT_JSON with a fixture file - Uses sandbox process.env and VSBuffer (renderer-safe)
- New build/lib/policies/exportPolicyData.ts: handles transpilation, GITHUB_TOKEN setup via gh CLI, and runs --export-policy-data - Added 'npm run export-policy-data' script to package.json - Removed scripts/export-policy-data.sh - Updated SKILL.md and test error message
exportPolicyData.ts now acquires tokens via: 1. GITHUB_TOKEN env var (if set) 2. gh CLI (fast, non-interactive) 3. GitHub OAuth device flow (interactive, no dependencies) Based on vscode-copilot-chat's getToken.mts pattern.
joshspicer
commented
Mar 31, 2026
src/vs/workbench/contrib/policyExport/test/node/extensionPolicyFixture.json
Show resolved
Hide resolved
pwang347
reviewed
Mar 31, 2026
src/vs/workbench/contrib/policyExport/electron-browser/policyExport.contribution.ts
Outdated
Show resolved
Hide resolved
pwang347
reviewed
Mar 31, 2026
src/vs/workbench/contrib/policyExport/electron-browser/policyExport.contribution.ts
Show resolved
Hide resolved
pwang347
previously approved these changes
Mar 31, 2026
Member
pwang347
left a comment
There was a problem hiding this comment.
Looks great, thank you for making this change!
Yoyokrazy
approved these changes
Mar 31, 2026
pwang347
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tracking https://github.com/microsoft/vscode-internalbacklog/issues/7245
Summary
Adds a merge script that fetches
extensionConfigurationPolicyentries from the distro'sproduct.jsonand merges them intopolicyData.jsoncduring the policy export workflow.fyi @pwang347
Problem
The
--export-policy-datacommand runs in the OSS dev build, which has no access toextensionConfigurationPolicydata — that lives only invscode-distro'sproduct.json. Extension policies for settings likegithub.copilot.nextEditSuggestions.enabledtherefore never appear in the exportedpolicyData.jsonc, which means they're missing from:.mobileconfigprofilespolicy.jsonSolution
New build script
build/lib/policies/mergeExtensionPolicies.tsthat:package.jsonto get the pinned distro commit ("distro": "3de67a...")mixin/stable/product.jsonat that exact commit (via local.build/distro/or GitHub API withGITHUB_TOKEN)extensionConfigurationPolicyentriespolicyData.jsonc, skipping any already presentNew workflow
Changes
build/lib/policies/mergeExtensionPolicies.tssrc/.../policyExport.contribution.tssrc/.../policyExport.integrationTest.ts.github/skills/add-policy/SKILL.mdDependencies
Companion PR: https://github.com/microsoft/vscode-distro/pull/1376 (adds
localizationformat toextensionConfigurationPolicyentries in all three quality product.json files)