Skip to content

fix: resolve win32 product.json path in native policy smoke fixture (build fix for vscode-engineering#3813) - #335152

Merged
Ross Wollman (rwoll) merged 2 commits into
microsoft:mainfrom
vscodebot-pr:fix/native-policy-product-path-3813-aw-34275687712
Sep 8, 2026
Merged

Ross Wollman (rwoll) merged 2 commits into
microsoft:mainfrom
vscodebot-pr:fix/native-policy-product-path-3813-aw-34275687712

Conversation

@vscodebot-pr

Copy link
Copy Markdown
Contributor

Build failure

The "Native Policy Plumbing" smoke tests (Electron, Windows) fail in their before all hook with ENOENT: no such file or directory, open '...\VSCode-win32-x64\resources\app\product.json'. Both Policy Plumbing tests throw before any assertion runs, failing the Windows Electron smoke stage on main.

Root cause

test/smoke/src/areas/policy/nativePolicy.ts resolved the built product manifest on Windows by joining resources/app/product.json onto path.dirname(getBuildElectronPath(options.codePath)) — effectively the root of the build output. However, the Windows built app nests its payload inside a subdirectory (e.g. VSCode-win32-x64). getBuildElectronPath itself accounts for this: for win32 it uses the findFilePath helper in test/automation/src/electron.ts, which searches one level of subdirectories for resources/app/product.json. The fixture bypassed that logic and assumed the file lived directly under the root, so fs.readFileSync hit a non-existent path and threw.

How the fix works

Added an exported getBuildProductPath(root) helper in test/automation/src/electron.ts that resolves product.json per-platform, reusing the existing findFilePath subdirectory search on win32 (the same mechanism getBuildElectronPath/getBuildVersion already use). nativePolicy.ts now calls getBuildProductPath(options.codePath) instead of hand-rolling the path, so the Windows nested layout is handled correctly and darwin/linux behavior is preserved. This corrects the invalid path producer rather than guarding the consumer or swallowing the error.

Rollback evaluation

Recommendation: Do not roll back. Public culprit: PR #335107 (commit 644fe2ac), which introduced the fixture. The regression is isolated to new test-fixture path resolution with no product/runtime/schema impact, and this fix-forward is a small, bounded correction that reuses existing, proven path-resolution logic. Reverting would only remove the new smoke coverage. Owners to consult: @rwoll

Validation

Source inspection only. getBuildElectronPath (win32) and getBuildVersion (win32) already rely on findFilePath to locate resources/app/product.json within a subdirectory of the build root, confirming the nested layout; the new helper reuses the identical resolution. TypeScript type checking / smoke test execution could not be run in this environment (the tsc and build tooling were unavailable to the agent).

Risk

Low. The change is confined to test automation/smoke code, adds a helper that mirrors existing behavior, and leaves the non-Windows paths functionally unchanged.

Recommended reviewer

Recommended owner: @rwoll

Fixes microsoft/vscode-engineering#3813

Generated by build-fix · opus48 · 168.9 AIC · ⌖ 19.1 AIC · ⊞ 11.7K · ◷

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.

🟢 Approval recommended

The focused change reuses established Windows build-path discovery while preserving existing macOS and Linux behavior.

Pull request overview

Fixes Windows native-policy smoke tests by resolving the packaged product manifest from nested build layouts.

Changes:

  • Adds and exports a platform-aware getBuildProductPath helper.
  • Uses the helper in the native policy fixture.
File summaries
File Description
test/automation/src/electron.ts Adds platform-specific product path resolution.
test/automation/src/index.ts Exports the new helper.
test/smoke/src/areas/policy/nativePolicy.ts Uses the helper for packaged builds.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

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

@rwoll
Ross Wollman (rwoll) marked this pull request as ready for review September 8, 2026 20:58

@rwoll Ross Wollman (rwoll) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good. We missed the packaged-build layout in our test matrix: GitHub PR checks run from source, while the failing Azure DevOps job uses --build.


🤖 Posted via Copilot.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: cea11743-4d3d-48b7-9b6d-8028b722593d
@rwoll
Ross Wollman (rwoll) merged commit de00888 into microsoft:main Sep 8, 2026
33 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.138.0 milestone Sep 8, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Oct 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

vscode-build VS Code build process issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants