Repository navigation
fix(ci): cache the vendored addon where node-gyp actually writes it - #20445
Conversation
The workspace link means pnpm never creates a .pnpm/@orca+windows-registry@* entry, so all four native-cache blocks globbed a path that cannot exist and the addon was recompiled on every Windows job. Also hardens the addon itself: RegEnumValueW reports a byte count and the registry does not enforce whole WCHARs for string types, so an odd count let Napi's auto-length scan run past the value; and a value named __proto__ would reassign the result object's prototype instead of becoming an entry.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe Windows registry addon now rejects malformed UTF-16 value sizes and uses a null-prototype result object. Windows Node and Electron native-module cache steps now target Priority: ⬇️ Low Estimated code review effort: Merge Risk: ⚪ Minimal · up to The registry hardening and Windows cache updates are consistent with their consumers and workflow contracts. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the cache fix, addon hardening, test update, and verification results. However, it omits most required template sections, including ELI5, What Changed, Why, Linked Issue with a Fixes reference, Visual Proof or N/A, Testing checkboxes, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. Resolution Rewrite the description using all template headings. Add a linked issue in the required Full details: Docstring CoverageExplanation Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: follow-up to #20438 that repoints the native addon cache at the path node-gyp actually writes, plus two upstream-inherited hardening fixes and a test-oracle tweak.
- Native cache path corrected — with
@orca/windows-registrynow aworkspace:*link (pnpm-lock.yamlrecordsversion: link:native/windows-registry, no.pnpm/@orca+windows-registry@*entry), the four cache blocks at.github/actions/install-node-dependencies/action.yml:153,164and.github/workflows/pr.yml:838,907now cachenative/windows-registry/build.ensure-native-runtime.mjsresolves the package to its real dir and@electron/rebuildwrites in place, so the new path is the one actually populated; the existing key hash already coversaddon.cc,binding.gyp, andpackage.json. __proto__-safe value map —native/windows-registry/index.js:30buildsbyNamewithObject.create(null), so a value literally named__proto__becomes an own entry rather than reassigning the prototype. The consumers (windows-path-registry-reader.ts,windows-user-path-registry.ts) only useObject.entries(...), which is null-prototype safe.- Odd-length UTF-16 rejected —
native/windows-registry/src/addon.cc:72-77rejectsREG_SZ/REG_EXPAND_SZ/REG_MULTI_SZvalues whose byte length is not a whole number ofWCHARs before appending a terminator, keeping the terminator aligned for Napi'sNAPI_AUTO_LENGTHscan. - Test oracle made case-insensitive —
src/main/windows-registry-addon.test.ts:23-28compares thereg.exevalue name case-insensitively, since a machine storingPATHrather thanPathwould otherwise look absent.
Notes: the two hardening changes are untested (the __proto__ path has no injection seam in the wrapper), and the guard returns null for the whole key on a single malformed value — both defensible, neither blocking.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Follow-up to #20438, addressing review comments on that PR.
Native cache pointed at a path that cannot exist
Switching
@orca/windows-registryfromfile:to a workspace link means pnpm symlinksnode_modules/@orca/windows-registrystraight tonative/windows-registry— there is no.pnpm/@orca+windows-registry@*entry at all (pnpm-lock.yamlrecordsversion: link:native/windows-registrywith nopackages:entry). All four native-cache blocks globbed that nonexistent path, so the addon was recompiled on every Windows job and the cache-key hardening from #20438 was inert for it.Fixed in all four blocks —
install-node-dependencies/action.yml:153,164andpr.yml:832,901are separate configurations — plus the assertion inpr-workflow-parallelism.test.mjsthat pinned the stale path.Two addon hardening fixes
RegEnumValueWreports a byte count and the registry does not enforce wholeWCHARs for string types. On an odd count the appended terminator straddles a character boundary, so Napi'sNAPI_AUTO_LENGTHscan runs past the value data. Now rejected before both the direct andREG_MULTI_SZconversions.__proto__as a value name.getRegistryKeybuilt its result with{}, so a value named__proto__would reassign the prototype instead of becoming an entry, silently breaking the keyed-value contract. NowObject.create(null).Both were inherited from
windows-native-registry, so neither is a regression — but the source is ours now.Test robustness
reg.exeechoes the value name as stored, so a machine holdingPATHrather thanPathwould have missed the line and made the oracle look absent. Matched case-insensitively.Verification
awin): withbuild/deleted,ensure-native-runtime.mjsrecompiles the hardened addon (gyp info ok) and all 4 addon tests passpnpm test config/scripts/— 192 files, 1608 tests passedpnpm tcclean;check:code-quality:changed0 new findings