Skip to content

Conversation

pwang347
Copy link
Member

@pwang347 pwang347 commented Oct 7, 2025

Overview

  • Added new PR workflow to validate the policy export flow: https://github.com/microsoft/vscode/actions/workflows/policy-check.yml
  • Refactored existing policy export script into VS Code as a service and added unit tests. This is triggered by a Workbench contribution that will wait for all contributions to be registered first.
  • Since we now no longer have access to localization keys (which tree-sitter was able to conveniently parse for us), updated IPolicy interface to have a localizations property which allows us to reuse existing keys or provide a new key value pair for localized strings.

Validation

  • Compared generated files with previous results from running npx tsx build/lib/policies.ts

Output Differences

General

  • App name: Code - OSS -> Code - OSS Dev since now retrieving name from productService instead of product.json directly
  • All policies are now sorted alphabetically by category, and then policy name.
  • Some string enums were not being parsed because the query for it did not support enum values. They are now picked up properly as enums, and the default value is using the existing logic which retrieves the first element in the list. The following configurations are affected:
    • ChatMCP -> defaults to none
    • TelemetryLevel -> defaults to all
  • ChatAgentExtensionTools now reuses chat.extensionToolsEnabled instead of defining a duplicate string

Platform: darwin

  • Nothing to call out.

Platform: win32

  • Categories are now sorted alphabetically by ID.

ref: #257569

Copy link

vs-code-engineering bot commented Oct 7, 2025

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/code/electron-main/app.ts
  • src/vs/code/electron-main/main.ts
  • src/vs/platform/environment/common/argv.ts
  • src/vs/platform/environment/common/environment.ts
  • src/vs/platform/environment/common/environmentService.ts
  • src/vs/platform/environment/node/argv.ts
  • src/vs/workbench/electron-browser/desktop.main.ts

@deepak1556

Matched files:

  • src/vs/code/electron-main/app.ts
  • src/vs/code/electron-main/main.ts

@pwang347 pwang347 changed the title Move policy generator to developer command [DRAFT DO NOT REVIEW] Move policy generator to developer command Oct 7, 2025
@pwang347 pwang347 changed the title [DRAFT DO NOT REVIEW] Move policy generator to developer command [DRAFT DO NOT REVIEW] Use actual configuration for policy export Oct 8, 2025
@pwang347 pwang347 changed the title [DRAFT DO NOT REVIEW] Use actual configuration for policy export Use actual configuration for policy export Oct 8, 2025
@pwang347 pwang347 requested a review from joshspicer October 10, 2025 00:21
@pwang347 pwang347 marked this pull request as ready for review October 10, 2025 00:21
@Copilot Copilot AI review requested due to automatic review settings October 10, 2025 00:21
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the policy export system from a build-time tree-sitter based approach to a runtime VS Code service with proper localization support. The refactoring enables more accurate policy generation by using actual configuration data rather than static code parsing.

Key changes:

  • Replaces build-time tree-sitter policy parsing with runtime VS Code service
  • Updates IPolicy interface to include category and localization properties
  • Adds comprehensive unit tests for the new policy writer system

Reviewed Changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/vs/workbench/contrib/policyExport/electron-browser/policyExport.contribution.ts New workbench contribution that triggers policy export on startup when --export-policy-type flag is present
src/vs/platform/policy/node/writer/policyWriterService.ts Core service implementing policy export logic with translation support and file writing
src/vs/platform/policy/node/writer/policies/*.ts Policy type implementations (Boolean, Number, String, StringEnum, Object) extending BasePolicy
src/vs/base/common/policy.ts Updated IPolicy interface with category enum and localization properties
build/lib/policies.ts Removed old tree-sitter based policy extraction system
.github/workflows/policy-check.yml New CI workflow to validate policy export functionality

@vs-code-engineering vs-code-engineering bot added this to the October 2025 milestone Oct 10, 2025
@pwang347 pwang347 marked this pull request as draft October 10, 2025 00:57
@pwang347 pwang347 marked this pull request as ready for review October 10, 2025 20:16
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.

1 participant