test(permissions): budget the Windows ACL tests for the no-native path - #88
test(permissions): budget the Windows ACL tests for the no-native path#88Yigtwxx wants to merge 1 commit into
Conversation
The check job never runs pnpm native:build, so these two tests exercise the command fallback rather than readOwnerAndDacl(). In that configuration every inspectPathPermissions() spawns powershell.exe for the owner query plus icacls.exe for the ACL, measured at two spawns per call. Each test pays six process spawns: two icacls in the fixture, then two calls that inspect. That costs 561ms on a developer machine and repeatedly exceeds the 15s budget on Windows runners, where cold process starts dominate. The same run that failed showed the runner five to ten times slower across unrelated suites, and a spawn-bound test scales worse than that. Raise both budgets to 60s. This is a timing budget for a spawn-heavy fallback, not a slow assertion — the library still prefers the native path, which performs no spawns at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GGksu4AaxVTcTHZntKTyAs
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 5:04 PM ET / 21:04 UTC. ClawSweeper reviewWhat this changesThe PR raises the timeout for two Windows-only secure-read ACL tests from 15 seconds to 60 seconds when the command-based permissions fallback is exercised. Merge readinessThis is a focused, correct test-only mitigation for repeated Windows command-fallback timeout failures. Keep it open: the linked broader replacement changes public fallback behavior and has not yet supplied the Windows proof needed to make it a safe superseding landing path. Priority: P3 Review scores
Verification
How this fits togetherSecure file reads verify ownership and access controls before returning secret-like file contents. On Windows, verification prefers a native binding when available and otherwise uses system ACL commands; these tests cover the resulting secure-read behavior. flowchart LR
A[Windows secure-read test] --> B[ACL-protected test file]
B --> C[Permission inspection]
C --> D{Native binding available?}
D -->|No| E[PowerShell and icacls fallback]
D -->|Yes| F[Native ACL reader]
E --> G[Verified secure read]
F --> G
Decision needed
Why: The two paths overlap on Windows fallback test cost, but the replacement also changes production command-failure behavior and is not yet proven on the affected platform. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Either land this narrow timeout adjustment as an immediate CI-stability mitigation, or obtain real Windows proof for the broader replacement and close this PR only after that replacement demonstrably preserves the same test reliability benefit. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR changes existing Windows test budgets rather than an end-user behavior. The supplied terminal output reports the affected test file passes after the adjustment. Is this the best way to solve the issue? Unclear: the timeout increase is the narrowest mitigation for the stated CI symptom, but the broader replacement could be preferable if it gains Windows proof and safely removes the repeated command work. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2477f5681f68. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
This PR changes two numbers, What failed: That is Caveats on how far I can take that claim:
Flagging rather than diagnosing, since a genuine intermittent containment escape in the non-native fallback would matter well beyond this PR. Anyone with Linux CI can hit it far more cheaply than I can from here. |
defaultPermissionExec spawned icacls.exe and powershell.exe with no timeout, so a wedged helper hung inspectPathPermissions() indefinitely for any consumer, not just in tests. Built-in Windows permission commands are now bounded to 10s with hard termination. The bound fails closed: an owner query that cannot complete yields source "unknown", the ACL query is skipped, and readSecureFile() refuses the read with permission-unverified rather than returning a permissive answer. Also removes a redundant permission inspection in the tests, dropping the affected Windows tests from six spawns to four. Ordinary Windows CI keeps exercising the real command fallback; native coverage stays in the native job. Supersedes #88. Diagnosis by @Yigtwxx. Co-authored-by: Yigtwxx <yigiterdogan023@gmail.com>
|
Superseded by #89, merged as 64f7742 — thank you, your diagnosis was the whole basis for it. I didn't take the timeout increase, but only because your own analysis pointed at something better. You correctly identified that the The more important part is the finding you flagged and deliberately left out of a test-only PR: The affected test went from 15-second timeouts to about four seconds on the merged branch. Thanks for chasing the cause instead of just the symptom, and for scoping the PR honestly rather than smuggling the API change in with it. |
What Problem This Solves
new-primitives.test.ts > secure file reads > reads from a validated Windows ACL and ownertimes out at 15s on Windows CI. It has failed that way on #82, #85 and #87, always on one Node version while the other passes on the identical commit. The affected surface is test reliability for the Windows permissions fallback — nothing ships differently.The cause is that the
Node N checkjob never runspnpm native:build, so these tests run the command fallback rather than the nativereadOwnerAndDacl(). InstrumentingdefaultPermissionExecshows the cost:Each
inspectPathPermissions()spawnspowershell.exefor the owner query (inspectWindowsOwner) plusicacls.exefor the ACL. Each test pays six process spawns: twoicaclsinsecureWindowsTestFile, then two inspecting calls at two spawns each.Why This Change Was Made
This is a timing budget for a spawn-bound test, not a slow assertion, so the budget is the thing that is wrong. Both Windows ACL tests do identical work and both move from 15s to 60s.
Cold process starts dominate on a Windows runner. The same failing run showed the machine five to ten times slower than local across unrelated suites —
api-coverageat 6833ms andarchiveat 5306ms — and a test whose cost is almost entirelyCreateProcessscales worse than wall-clock I/O does. Locally these tests take 561ms.Non-goals: this does not change the library.
permissions.tsstill prefersinspectWindowsPermissionsNative(), which performs no spawns, and only falls back to the commands when no binding is loaded. Jobs that do build the binding never pay this cost.User Impact
None for package consumers. Test-only change.
Evidence
Local run of the affected file, all green:
Full local verification:
vitest run487 passed / 183 skipped,tsc --noEmitclean,scripts/check-file-size.mjsandscripts/check-fs-boundary-primitives.mjsboth exit 0.The spawn counts above come from temporarily instrumenting
defaultPermissionExecto record each command; that instrumentation is not part of this diff.Separate finding, not fixed here
defaultPermissionExecinsrc/permissions.tscallsexecFileAsyncwith notimeout, and so doessecureWindowsTestFile. A wedgedicacls.exeorpowershell.exewould hanginspectPathPermissions()indefinitely for a consumer, not just in tests. That is a real robustness gap but it is a behaviour change to public API, so I have left it out of a test-only PR. Happy to open it separately if you want it bounded.CHANGELOG.mdupdated when release-relevant — test-only, nothing ships