Keep the substituted-authority cleanup test portable and leak-free on macOS - #454
Open
vishaltandale00 wants to merge 1 commit into
Open
Keep the substituted-authority cleanup test portable and leak-free on macOS#454vishaltandale00 wants to merge 1 commit into
vishaltandale00 wants to merge 1 commit into
Conversation
… macOS macOS rename(2) refuses to move a directory the caller cannot write (EACCES on APFS, even within one parent), while Linux allows it. The test already renamed while writable; this moves the whole setup inside the try so a setup failure still reaches the finally, guards the restoring chmods on existence, and states the actual platform reason in the comment. Assertions unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
test/evidence-capture-integrity.test.mjs> "does not chmod a directory substituted for captured read-only authority" captured a 0o500 directory's dev/ino, renamed it, and substituted a new directory at the same path. On macOS 15.6 (APFS, internal disk and external SSD alike)rename(2)of a directory the caller cannot write fails withEACCESeven within one parent (mkdir d; chmod 500 d; mv d ereproduces from the shell); Linux allows it. Runs from Sep 2 to 4 failed here and leaked 13relayer-cleanup-substitution-*directories inos.tmpdir(), each holding only an empty read-onlysource, because the rename ran before thetry/finally.The rename-while-writable step already landed in #404. This change:
try, so any setup failure reaches thefinallyand removes the temp dir instead of leaking it;rmSync;rename(2)needs write permission on the directory being renamed, Linux does not, and dev/ino survive the rename.Assertions are unchanged:
restoreDirectoryWritesSyncreturnsfalsefor the substitute, and the substitute keeps its mode without the write bit.Verification
Required plan: the changed seam is the test itself, mapped to running its file directly, plus the repository-required
npm run checkandnpm run buildpre-commit gates.What ran on macOS 15.6 (Darwin 24.6.0, APFS, fresh worktree on an external SSD), against this exact commit:
npx vitest run test/evidence-capture-integrity.test.mjsfind os.tmpdir() -name 'relayer-cleanup-substitution-*'after each runnpm run checknpm run buildThe one skip in the file is
accepts a multiply-linked Homebrew Node only as a non-executed copy source, gated on a Homebrew node binary with more than one hard link; this host's has one. A firstnpm run checkattempt failed only because two vitest workers raced to download the Electron binary in the fresh worktree (File existsundernode_modules/electron/dist); reinstalling Electron and rerunning gave the clean pass above. No product behavior changed, so no PRD update.Adversarial subagent review: not run; this handoff is non-certifying on that dimension.
🤖 Generated with Claude Code