Repository navigation
Conversation
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — This focused fix changes a shared production atomic-write path used for settings, state, caches, ledgers, and potentially secret-bearing files by altering filesystem permissions. Because the change affects confidentiality and permission semantics across multiple callers, it warrants human review despite its small size and targeted tests. You can add or adjust custom eligibility rules. Learn more. |
c9269e1 to
a2f6260
Compare
71efd5c to
0912a9c
Compare
|
Taking over this one. I’ll reduce the tests to the useful coverage, update the implementation against current main, and verify it before publishing the changes. |
Takeover of pingdotgg#14981. The production change is kept as-is (stat the resolved target, keep mode & 0o777, 0600 when it does not exist, chmod the temp file before the rename). The PR's eight added test cases restated the same three facts, so they are folded into the existing symlink and missing-file tests: a 0600 referent stays 0600, a 0664 referent stays 0664 (rejects a blanket 0600 and a write-mode option under umask 022), and a new file is 0600. The chmod comment now states the Windows behavior outright. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Preserve atomic write permissions and main's reduced test suite. Move the new-file 0600 assertion into the surviving dangling-symlink case; production atomicWrite.ts is unchanged from the PR head.
|
Thank you, @Mnigos, for the earlier work on preserving atomic-write permissions. This PR has had no author push or reply for over a week, and main has changed the same files since its base. #24310 by @juliusmarminge covers the same permission issue and includes broader regression and runtime evidence, so we are keeping it as the duplicate. |
Atomic replacement previously discarded the destination file’s permissions. Saving a private state file could make it readable according to the process umask, and an explicitly group-writable file could lose that setting.
Read the resolved destination’s permission bits and apply them to the temporary file before renaming it. New files use
0600. The temporary directory stays private while the replacement is prepared, and existing symlink behavior is preserved.Validation after resolving conflicts with current main: all seven current filesystem tests pass on Linux under umasks
022,002, and077; the three permission assertions remain folded into existing cases. Main’s removal of redundant tests is preserved, with the new-file0600assertion moved to the surviving dangling-symlink case. Shared-package typecheck, scoped lint, and format pass. Lint reports main’s existing polling-helper warning; no suppression was added. Native Windows and macOS execution was not performed.The merge preserves the PR’s production
atomicWrite.tsbyte for byte, including resolved-target stat, chmod before rename, and0600for missing targets; main’s Windows rename retry behavior is retained. This conflict resolution adds no production behavior, and the earlier independent reviews are historical, not fresh reviews of this merge.The shared permission change remains subject to the configured human-review gate. No merge or auto-merge is requested by this takeover.
Original contribution by @Mnigos. Maintainer takeover: Claude Opus 5.5 for tests/review, Claude Fable 5.1 for implementation, GPT-6.1 for independent review; Claude Code and Codex harnesses.
Conflict resolution: GPT-6.1 Sol through the Codex harness.