Repository navigation
Count JS bindings recursively in the electron sample test - #800
Merged
Jaylyn Barbee (Jaylyn-Barbee) merged 1 commit intoSep 1, 2026
Merged
Conversation
dynwinrt-codegen 0.1.0-preview.20 (published 2026-09-01) moved generated bindings from a flat layout into namespace subdirectories, so the non-recursive Get-ChildItem only saw the 3 root scaffolding files (index.js, index.proxy.js, lifetime.js) and failed the "> 50" assertion. The generated file set is unchanged, so counting recursively restores the assertion's original meaning and is layout-agnostic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 92cf7468-29cb-4aaa-b7f0-962f0c3c55e4
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused change correctly handles both flat and namespace-nested binding layouts.
Pull request overview
Updates the Electron sample test to support namespace-nested generated bindings.
Changes:
- Counts generated JavaScript files recursively.
- Documents why recursive enumeration is required.
File summaries
| File | Description |
|---|---|
samples/electron/test.Tests.ps1 |
Recursively validates generated JS bindings. |
Review details
- Files reviewed: 1/1 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.
Chiara Mooney (chiaramooney)
approved these changes
Sep 1, 2026
Zach Teutsch (zateutsch)
approved these changes
Sep 1, 2026
Jaylyn Barbee (Jaylyn-Barbee)
enabled auto-merge (squash)
September 1, 2026 19:55
Jaylyn Barbee (Jaylyn-Barbee)
deleted the
jay/fix-electron-bindings-recurse
branch
September 1, 2026 20:03
This was referenced Sep 24, 2026
This was referenced Oct 2, 2026
This was referenced Oct 16, 2026
This was referenced Oct 30, 2026
This was referenced Nov 7, 2026
This was referenced Nov 15, 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.
What is wrong
Every open PR started failing the
electronsample test today, regardless of its contents.@microsoft/dynwinrt-codegen@0.1.0-preview.20was published 2026-09-01T14:42:36Z and changed the generated-bindings layout from flat to namespace-nested (windows/foundation/...).The assertion in
samples/electron/test.Tests.ps1counted.jsfiles non-recursively, so it stopped seeing the generated bindings and only counted the 3 root scaffolding files.Show me
Reproduced locally by running both codegen builds against the same metadata (
C:\Windows\System32\WinMetadata,--namespace Windows.Foundation):.js.js0.1.0-preview.190.1.0-preview.20windows/foundation/)The 3 survivors are
index.js,index.proxy.js, andlifetime.js(index.mjsdoes not match the*.jsfilter). Those root files are emitted regardless of how much is generated, so the top-level count is now a constant — it no longer scales with output at all.Why it matters
Nothing is actually broken. The generated file set is unchanged (26 recursive in both versions), and every downstream test passed:
winmds.lock.json,#winapp/bindingsresolution via Node package imports,generate-bindingsregeneration, and cross-language drift detection. This is a stale test assertion, not a functional regression.But it blocked everyone: 7 runs across 5 branches and 4 authors. The cleanest evidence that no PR caused it —
azchohfi-uiautomation-nuget-packagewas green at06:38Zand red at17:46Zon the same branch, straddling the publish. Every run before 14:42Z passed, back to Aug 27; every run after it failed.The fix
Add
-Recurse. The generated file set did not change, only its location, so the recursive count today equals the old flat count and the> 50threshold keeps exactly the meaning it had. It is layout-agnostic, so it holds whether codegen nests further or reverts to flat, and it still catches the "0 files generated" regression the assertion was written for (scaffolding-only output is 3, far below 50).Follow-up, not addressed here
ensureCodegenInstalledForInit(src/winapp-npm/src/jsbindings/cli-hooks.ts:507) installs this package atlatest, unpinned by design:Two consequences worth discussing separately:
test-samples.ymlruns only onpull_requestandworkflow_dispatch, so the first signal is always a contributor's PR going red..github/dependabot.ymlsetscooldown: default-days: 7, but that only governs manifests dependabot tracks (/src/winapp-npm). This package is in no such manifest — our own init code installs it into the user's project — so the cooldown structurally cannot apply. CI consumed preview.20 roughly 4 hours after publish, and the same code path runs on a user's machine.I have not changed that behavior here, to keep this PR limited to unblocking CI.