Repository navigation
feat(file-safety): guarded text publish module + specs (A4, #1375) #1395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
easonLiangWorldedtech
wants to merge
63
commits into
Zoo-Code-Org:main
Choose a base branch
from
easonLiangWorldedtech:feat/atomic-publish-s3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
79b9fcc
feat(file-safety): atomic text publish primitive + safeWriteJson refa…
easonliang28 7daa106
chore(ci): empty commit — re-trigger CI and the CodeRabbit current-he…
easonliang28 0e988ab
fix(file-safety): keep the target in place and track the DACL dump on…
99dc0ee
fix(file-safety): narrow the DACL dump path before the restore call
8809832
fix(file-safety): give each write its own DACL dump and assert the sa…
60bfb09
fix(file-safety): keep the unique DACL dump in the target directory
fa27f2b
test(file-safety): put the failure-path cases inside the describe tha…
f8e4043
fix(file-safety): close the staging symlink hole, surface unconfirmed…
4fcbe80
test(file-safety): assert the icacls arguments and the staged file cl…
899eafe
fix(file-safety): re-create the staging directory if a concurrent wri…
d64bb98
fix(utils): stage the JSON temp with the target mode instead of the p…
a24393c
fix(utils): keep the staged JSON file owner-writable and surface non-…
c9d9518
fix(utils): key the safeWriteJson lock on the canonical publish target
7076e81
test(file-safety): cover the staging-directory ownership rejection
8c00000
chore: trigger a fresh review pass at this head
28deb82
fix(file-safety): never discard a committed file, and cover the retry…
890f282
fix(file-safety): keep the write-permission contract and follow dangl…
8eb4da8
fix(file-safety): apply the target mode with fchmodSync on the staged…
b215bda
test+fix(file-safety): pin the symlink-cycle guard and stop abandonin…
0bf2ce3
test(editor): assert the write-permission guard is handed the absolut…
f14e646
fix(file-safety): keep the backup when the DACL restore failed, and c…
cbc3f21
fix(file-safety): remove a partially copied backup, and cover the fai…
41d2e54
fix(file-safety): fail closed when a Windows target's DACL cannot be …
82c2db9
fix(file-safety): propagate a failed lstat in resolvePublishTarget, a…
80ab628
fix(file-safety): judge the DACL capture by its artifact on both call…
6971b17
test(file-safety): make the target-probe propagation tests load-bearing
dd78434
fix(file-safety): release a staging directory this call created, and …
fb050ec
test(file-safety): cover the parent-directory create/verify failures …
8eb1da5
fix(file-safety): remove a partial backup after a successful publish,…
f33330c
test(file-safety): cover the zero-byte icacls dump in the win32 DACL …
f795ebd
fix(file-safety): classify staging-directory release errors instead o…
dea3db2
fix(file-safety): do not strand a staging directory when the post-cre…
d8db31a
test(file-safety): exercise safeWriteText against a real filesystem
3263a6a
test(file-safety): cover the win32 DACL restore retry that succeeds o…
2a7f4a7
test(file-safety): cover the non-regular DACL dump branch
3b7fa86
fix(file-safety): retry the staging temp unlink instead of swallowing…
ea61075
style: bring the branch's own files to the repo's prettier output
c1e8a1b
fix(file-safety): stop the icacls tree walk and the restore that cann…
easonLiangWorldedtech 58745b2
fix(file-safety): keep the target's group when publishing over it
easonLiangWorldedtech 8191ac4
test(file-safety,editor): name the retained path, catch the dump, ass…
easonLiangWorldedtech 808629d
test(file-safety): assert the exact icacls count in the privilege-mem…
easonLiangWorldedtech 4308b86
feat(file-safety): report a lost DACL restore as DaclRestoreError aft…
6ceeec7
test(file-safety): make the DACL backup and leftover-temp assertions …
92d60eb
fix(file-safety): report a publish that ran with DACL restoration dis…
fbbbd71
fix(file-safety): name the staging directory per write
79029a8
fix(file-safety): refuse publishes whose target escapes the authorize…
easonLiangWorldedtech 7db5216
fix(file-safety): close two authorized-root classification gaps found…
easonLiangWorldedtech 6d55775
style(file-safety): drop SafeWriteTextOptions type import unused afte…
easonLiangWorldedtech 459cf89
fix(file-safety): close three review-found gaps in the authorized-roo…
easonLiangWorldedtech 9301d1c
fix(editor): check the authorized root before creating directories in…
easonLiangWorldedtech 7957828
fix(file-safety): treat post-commit DACL loss as a host limitation an…
easonLiangWorldedtech 611b79c
perf(file-safety): run the fsync barriers on the libuv thread pool
easonLiangWorldedtech 4b9b80a
refactor(file-safety): drop the unused backup option
easonLiangWorldedtech 6416fe6
test(file-safety): compare lock paths with the canonical temp root
easonLiangWorldedtech cdb1572
fix(file-safety): treat post-commit publish errors as committed write…
easonLiangWorldedtech 0a29a31
test(file-safety): pin lock contention and the post-commit cache warning
easonLiangWorldedtech 1a39f51
fix(utils): hand the file-lock operation the caller's own path spelling
easonLiangWorldedtech cd731a6
test(file-safety, utils, editor): answer 1395's eleven test-only revi…
easonLiangWorldedtech 6237d4d
restore 1395's own cache-manager import of isPublishCommittedError fr…
easonLiangWorldedtech ab791a3
test(file-safety): pin publish-failure rethrow, restore retry count, …
easonLiangWorldedtech 925f8b7
test(file-safety): make the DACL privilege memo describe the degrade …
easonLiangWorldedtech 5a8cbd3
fix(editor): report an editor failure after a committed publish witho…
easonLiangWorldedtech 3fe325b
Merge organisation main d76dffa8 into feat/atomic-publish-s3 for the …
easonLiangWorldedtech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: Zoo-Code-Org/Zoo-Code
Length of output: 21041
Script executed:
Repository: Zoo-Code-Org/Zoo-Code
Length of output: 48922
Web query:
Node.js v22 fs.access Windows W_OK ACL does not check access control list documentationResult:
Web query:
Microsoft Windows rename replace file permissions DELETE FILE_DELETE_CHILD directory deny FILE_WRITE_DATA fileResult:
Web query:
Node.js v22.23.4 bundled libuv Windows fs rename MoveFileExW MOVEFILE_REPLACE_EXISTING sourceResult:
Web query:
Microsoft icacls save DACL READ_CONTROL permission security descriptor required fileResult:
Script executed:
Repository: Zoo-Code-Org/Zoo-Code
Length of output: 20220
Web query:
site:raw.githubusercontent.com/nodejs/node/v22.23.4/deps/uv/src/win/fs.c "fs__rename" "MoveFileExW"Result:
Script executed:
Repository: Zoo-Code-Org/Zoo-Code
Length of output: 6512
Script executed:
Repository: Zoo-Code-Org/Zoo-Code
Length of output: 9667
Check the target’s Windows write authorization before publishing.
When the target’s DACL denies file writes but permits replacement,
fs.access(..., W_OK)can succeed and the rename can overwrite the file. The previousfs.writeFilerejected that write. Check write authorization without truncating the target before publishing, and add a Windows DACL regression test.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changed in this push - this row needs a decision I should not make alone, so I am asking rather than editing production code on a guess.
What I verified: the probe at
DiffViewProvider.ts:1179-1187isfs.access(absolutePath, fsConstants.W_OK), carried over from the oldfs.writeFilepath, andDiffViewProvider.spec.ts:842-868already pins that it is handed the absolute target with the write bit and that it runs beforesafeWriteText. Your point is a different one and it stands: for a rename-based publish, a DACL that denies file writes but permits directory replacement can letaccess(..., W_OK)pass and the rename then overwrite, which the truncate-and-write path rejected.Why it is not in this commit: the fix is production code in
src/integrations/editor/DiffViewProvider.ts(blobf5ef407514f9at 39d4b95, this PR), and the candidate shapes do not promise the same thing - queryicaclsfor the write ACE, or stage-and-verify, or drop the pre-publish shortcut and let the publish report the failure. Budget is not the reason: Measured here: the gate's ownselectFromGitagainst base 73931fe returns 359 counted executable lines of the 500 cap and the same 128 selectors (selectorsHash bd67c22397aded1e) as the previous head, so the mutation-diff inputs are identical. There are 141 counted lines of headroom.Named deferral: @edelauna (whose CHANGES_REQUESTED review 5646298552 has stood on this file family since 2026-10-26) to say which check
saveDirectlyshould own. With that answer the change is that blob plus arunIf(process.platform === "win32")regression case; I have not quoted a counted-line cost for it because none of that code exists yet.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answer by decision, read off 39d4b95 at 2026-11-11T00:28:37.574Z. The ask was not to treat an access check with the write bit as Windows DACL write authorization, and to add a Windows regression case where the DACL denies file writes but permits replacement.
What exists at this head: the probe at 1179 to 1187 falls through only on a missing-file code, and the comment at 1175 to 1178 states the deliberate contract, that publishing by rename needs write permission on the directory while the write path it replaces needed it on the file, so the probe exists to preserve the read-only contract rather than to rename over a read-only target silently. The spec covers the probe with a case at 818 that rejects a save over a read-only target under a mocked permission error and a case at 850 that asserts at 861 to 869 that the write bit is the bit handed to the check. Only two lines in the whole 1,923-line spec mention a DACL and both belong to a different case about post-commit warnings, so the real-filesystem Windows case this finding asks for does not exist.
The decision, which this lane declined to make alone and which is now made: the real-filesystem Windows case is to be added in the unit that owns the write path, which under the merge order declared below is 2385, gated on the platform with an explicit guard rather than a blanket skip, because a DACL outcome is the class of fact that this repository's own test-placement guidance puts at the layer that touches the real filesystem and that a mock cannot prove. No ACL outcome is asserted here from the machine that wrote this reply, and none should be read into it.
This thread stays open until that case lands.
Check facts at this read time. This head carries three mutation-diff rows: 129284510370 completed and success from 2026-11-09T16:16:51Z to 16:20:21Z, 129318606292 completed and success from 17:15:31Z to 17:19:01Z, and 129318302860 completed and cancelled from 17:15:00Z to 17:15:29Z, whose log contains no gate sentence and whose only error annotation is that the operation was canceled during checkout. So across the 74 rows on this head the only row that is not completed and success belongs to a superseded run, and the mutation-diff state at this head is success: the success log measures the extension package at 359 lines against a cap of 500 and raises one advisory, 428 mutants against a limit of 400, which the script treats as advisory rather than blocking. The copy of the script inside this pull's tree is 30,108 bytes at sha256 16 c332971815aecfaf, and CI runs the copy inside each pull's tree.
Line numbers quoted here are as of the head named above. This file has grown since the thread was filed, so a pinned line number can land a reader somewhere other than the code under discussion. At this head line 1180 is inside the probe at 1179 to 1187, so the pinned line lands on the code the finding is about.
This campaign states no position on which instrument governs where REST and GraphQL report different review fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analysis chain
Script executed:
Length of output: 12547
@easonLiangWorldedtech, the PR head is still39d4b95128. I confirmed thatsaveDirectlyusesfs.access(..., W_OK)and that the cited tests mock the access check and publisher. I did not run a Windows DACL test.The test is planned for
#2385, which is open. The test should establish that file writes are denied while replacement is permitted, then verify that the save rejects and leaves the content unchanged. The production authorization fix also remains unverified. This thread stays open.The API now lists 80 check runs for the head: 78 successful, one skipped, and one cancelled. That includes the three mutation-diff runs you identified. I did not inspect their logs or rerun CI. Separately, the last saved CodeRabbit gate was blocking on security and persistence findings; I did not refresh it.
Would you like a follow-up issue for the production authorization fix?
Learnings used
You are interacting with an AI system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restated at the current head 1395 daee64d rather than corrected: the answer above was written against 39d4b95 and every file it quotes is the identical blob at both heads, DiffViewProvider.ts f5ef407514f9, its spec c35387b5f997, fileLock.ts d8bdbf910b30, its spec c8f08732fd9f, safeWriteText.ts 571d345098c3, cache-manager.ts b1062de55688 and WorkspacePathResolver.ts 10e425c8ec52, measured with git rev-parse on the two revisions, and the 107 files where the two heads differ are main-carried content with none of those seven among them. So the coordinates quoted above still land on the same code and nothing in this thread needs a coordinate correction.
The remedy is an edit this campaign has not made, so the thread stays open under the standing rule that a thread whose remedy is an edit this campaign still owes stays open until that edit lands. Under the declared merge order that edit is owed by 2385, the unit that owns the write path: a Windows regression case on a real filesystem where the DACL denies file writes but permits directory replacement, showing that the access check with the write bit passes and that the publish decision which follows it is the behaviour under discussion, gated on the platform with an explicit guard rather than a blanket skip. Which check saveDirectly should own is recorded as a maintainer decision for edelauna on this pull rather than a call this campaign makes alone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Measured on my own chain head before spending it, then priced both asks as edits.
Headroom before spending, at the chain-top footing (my unit merged with the sibling unit that lands ahead of it, p1066/u6b-tool-stream-teardown at a1d9d24, base efc22ed = upstream main): the extension packageEntry priced 476 counted executable lines over 173 selector ranges, so 24 lines under the 500-line cap. At my pull head alone (main to my head) it was 210 lines over 71 ranges.
This row priced as an edit rather than as a wish: +11 counted executable lines, +3 selector ranges. On my pull head: 221 lines over 74 ranges. On the chain top: 487 over 176, 13 lines under the cap.
The other ask (PRRT_kwDOSK-bwM61L9wj) priced the same way: +18 counted lines, +8 selector ranges. With the owed spec rows on my pull head: 228 over 79. On the chain top: 494 over 181, 6 lines under the cap.
Asked together on the chain top: 505 counted executable lines over 184 selector ranges, against a line cap of 500.
505 against 500 are the two numbers, and the line cap is the reason this row is not landed on this unit. It is the pair that crosses the cap; neither row crosses it alone; nothing was suppressed, absorbed, or trimmed to make the pair fit. The suppression file stayed where it stood across every stage I ran: 265 file-rule entries, total count 2868 before and 2868 after, changed 0, added 0, removed 0, with --prune-suppressions run each time and the file restored afterwards so no count moved and no entry was added for new code.
What landed on this push (s3-1395/u139-j-teardown to origin refs/heads/p1066/u6-execute-error-path-cleanup, this pull at head 7af6cbe):
Instrumented mutant figure before and after, measured locally against the chain top with the unit selectors the tool itself derives (173 ranges, sha256-16 a5b7aa01c49d08f3 before; 181 ranges, sha256-16 ce42b4d712a46ca7 after): the run printed "Instrumented 4 source file(s) with 433 mutant(s)" before and "Instrumented 4 source file(s) with 444 mutant(s)" after. Both are outside the 400-mutant cap and the overage predates this change; the mutant width is a decision for a person, the line cap is the one this unit had to obey. For this row I measured the line and range counts above and did not run a mutant figure for it.
Why this row has no target in this tree, and what I think answers it better: at my head saveDirectly() publishes with a plain fs.writeFile, there is no rename-based publication and no src/services/file-safety/safeWriteText.ts here, so the failure mode the row names - a probe that succeeds and a rename that overwrites anyway - belongs to the tree this row is pinned to (upstream #1395 at 925f8b7) and not to mine. My answer to the same question against the plain publish (open the destination r+ and close it, refuse only EPERM and EACCES, rethrow anything else, leave ENOENT to the write) is the shape priced above; it fits under the cap on its own. Since the Windows regression test for it is already planned for #2385 and the choice of authorization check for saveDirectly is recorded as a maintainer call, I think a follow-up issue carrying its own price answers this row better than a row on this unit does. The other ask is live at my head and landed here, so it does not need its own issue.
This row stays named and priced rather than dropped: the shape is commit 43e7d85ba63712abde83b8396aaa8d45220fab53, held at refs/tmp/u139t-ask1-notlanded with its patch kept beside it, ready for whoever takes the follow-up.
This is the threaded reply to this ask. The copy of the same numbers posted earlier on the pull conversation (comment 6839571409) is being removed as part of the same change so the two numbers appear in one place and a reader cannot be left to guess which copy is current.
The shape stays available, not dropped: commit 43e7d85ba63712abde83b8396aaa8d45220fab53, held at refs/tmp/u139t-ask1-notlanded with its patch kept beside it, ready for whoever takes the follow-up. The gate advisory row for this head prints job 131583388313 under check-suite 117345758697; at my last read it printed "This job is in progress", and I am not waiting on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analysis chain
Script executed:
Length of output: 20681
Script executed:
Length of output: 20615
Script executed:
Length of output: 634
Script executed:
Length of output: 2638
Script executed:
Length of output: 1313
@easonLiangWorldedtechI created follow-up issue#2441with the reported sizing and its scope. GitHub rejected the assignment, so the issue is unassigned. Please assign it or retry the assignment.I confirmed that
7af6cbeusesfs.writeFile. At925f8b7,#1395still uses the rename-based path. The cited#2385test exercisessafeWriteText, not thesaveDirectlyauthorization decision.I am not marking this finding as addressed. The maintainer decision and Windows regression test remain outstanding. Separately, the last saved persistence-integrity gate was blocking; please refresh it before merge.
You are interacting with an AI system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Objects, not adjectives.
What exists for what this thread asks. The shape you asked for is kept and not landed: "fix(diff-view): ask the destination for write authorization before publishing" at 43e7d85ba63712abde83b8396aaa8d45220fab53, tree 3fb28c74bcc83cff3d35fc6a2ea28c22ad97cafc, held at refs/tmp/u139t-ask1-notlanded with its patch. The line-cap measurement that decided that is already in this thread at comment 4558022780 and is not repeated here.
What landed as objects, on the unit pull this chain splits to (#1932): 571f040 "fix(diff-view): keep the committed result when the document open fails", which is the ask pinned at src/integrations/editor/DiffViewProvider.ts line 1197, plus the two spec rows a249a29 and 7af6cbe that pin the settings slots the rollback decision reads.
What remains. The authorization question this thread asks is unlanded, and that is not a cap problem alone. At the head I pushed there is no rename-based publication and no src/services/file-safety/safeWriteText.ts, so the failure mode you describe, a probe that succeeds and a rename that overwrites anyway, belongs to this pull tree and not to the split head. The kept object asks the same question of the plain fs.writeFile publish instead: fs.open(absolutePath, "r+") then close, refuse only EPERM and EACCES, rethrow anything else, leave ENOENT to the write. Whether saveDirectly should ask for write authorization at all is a maintainer call, recorded earlier in this thread.
What nothing touched, named rather than skipped. Two threads on this pull are still open and neither is answered by an object. PRRT_kwDOSK-bwM61L9wj, root PRRC_kwDOSK-bwM8AAAABDN_3dQ at src/integrations/editor/DiffViewProvider.ts line 1197 by coderabbitai, created 2026-11-09T08:56:49Z: its ask landed as the commit named above on the split pull, and nothing inside its own thread says so. PRRT_kwDOSK-bwM61L9xl, root PRRC_kwDOSK-bwM8AAAABDN_34Q at src/utils/fileLock.ts line 45 by coderabbitai, created 2026-11-09T08:56:50Z: open on this pull diff, ten replies, and this unit has answered it with no object; I did not read its body on this leg, so I name it open and untouched by this unit rather than classify it. The census that found three open roots out of 88 threads, with hasNextPage false and the cost read from the door own rateLimit node, is in the campaign ledger in the same leg as this reply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answering this root and its sibling 4510971765 from the same reading pass, because they are the same publish path. Everything below was read off 925f8b7, whose committer stamp the transport printed as Thu Nov 12 12:09:50 2026 +0800 (2026-11-12T04:09:50Z); the runs were made in a detached worktree standing on that commit and nothing was committed, pushed, resolved, suppressed or labelled by this reply.
This root (4510971756, src/integrations/editor/DiffViewProvider.ts:1180) - verdict I am asking for: resolve.
What the code does now at that head:
assertPublishWithinAuthorizedRoot(this.cwd, absolutePath, absolutePath)before any filesystem mutation, and the row "rejects a publish whose target escaped the authorized root before any directory is created" pins that ordering (spec lines 800-816: it assertscreateDirectoriesForFileandsafeWriteTextwere not called and pins the arguments, so the guard cannot be handed the workspace root instead of the target).fs.access(absolutePath, fsConstants.W_OK)block you are pointing at. It is a read-only-target contract, not the authorization mechanism: the comment at 1175-1178 says so, and the row "checks write permission on the absolute target before publishing" (spec lines 850-876) pins that the guard is handed the absolute target, that it is handed the write bit (constants.W_OK, line 869) and that it runs before the publish (invocation-order assertion at lines 873-875).fs.access:src/services/file-safety/safeWriteText.ts:613-625runs the win32 DACL step -await _saveDaclWindows(targetPath, daclDumpPath, options?.execFileRunner)- before the commit rename, restores it after the rename (line 341 documents the order), and a failure to restore raisesDaclRestoreError(lines 106-124) which is one of the two committed-write warnings inisPublishCommittedError(lines 123-124). The publish is a rename (line 340: "Atomic rename temp -> target"), so the existing file is never truncated before replacement.src/services/file-safety/__tests__/safeWriteText.spec.tsrows at 462, 546, 598, 627, 654, 726, 754, 782, 802, 837, 906, 991, 1013, 1041 and 1947 (capture args and ordering, capture failure aborts before publish, non-zero icacls exit that still wrote a dump counts as a capture, privilege-unavailable degrade, concurrent writes using different dumps, failed restore is a DaclRestoreError and the dump is still unlinked, both restores failed reports the lost DACL, non-regular dump fails closed, target missing means no save/restore/dump, dump removed when the save fails after creating it).Controls run at that head (each mutation made a pinned row red, then was reverted and the row was re-run green; exit codes are vitest's own):
fs.accessblock at 1179-1187: exit 1. "rejects a save over a read-only target instead of renaming onto it" -AssertionError: promise resolved "{ newProblemsMessage: '', ...2 }" instead of rejecting. "checks write permission on the absolute target before publishing" -AssertionError: expected -1 to be greater than or equal to 0(no access call is found at all). So the write-bit contract is pinned, and it is pinned as a contract of this call site rather than as the authorization story.platform === "win32" && false && ...at safeWriteText.ts:617): exit 1. "win32 DACL save args are [targetPath, /save, dumpPath] before the commit rename" -AssertionError: expected "vi.fn()" to be called 2 times, but got 0 times. "win32 DACL capture failure aborts before publishing" -AssertionError: promise resolved "undefined" instead of rejecting. So the authorization/retention that your row asks for is running, it is not carried byfs.access, and switching it off is visible in the suite.Why I am asking for resolve here rather than landing something: the two things the row names - DACL verification rather than an
fs.accessW_OK guess, and a replacement that does not truncate the existing file - are both in the code at this head and both are pinned by rows that go red when the mechanism is switched off. Asking for resolve is a request, not an action: I have not resolved this thread or any other.Sibling root 4510971765 (src/integrations/editor/DiffViewProvider.ts:1197) - verdict I am asking for: keep open.
What the code does now at that head:
DaclRestoreErrororPublishNotDurableErrorraised after the commit rename is reported byconsole.warn("saveDirectly: content committed with a warning: ...")at 1197 and the save still returns, so the bookkeeping matches the disk. Rows 878 and 899 of the same spec pin that (finalContent plus the warning text plus exactly one publish call).await vscode.window.showTextDocument(...)sits outside any catch, so if the open fails after the rename committed, the rejection travels out ofsaveDirectlyand the caller is told the save failed although the content is already on disk.vscode.window.showTextDocumentrejecting,saveDirectly("test.ts", "new content", true, true, 200)rejects with that error andsafeWriteTexthad already been called once for the target - exit 0, so the committed write is being reported as a failure today. Wrapping the open in a warn-only catch (lines 1205-1210) flips the same row to exit 1 withAssertionError: promise resolved "{ newProblemsMessage: '', ...2 }" instead of rejecting, which is the shape your row wants. Restoring the file made the row exit 0 again.Left open and classified: root 4510971873 (src/utils/fileLock.ts:45) - class: maintainer-decision. The file and line that put it in that class is line 45 itself,
const absoluteFilePath = await resolveFileLockPath(filePath), which is where the lock key is fixed to the resolved path beforelockfile.lock(absoluteFilePath, ...)at 48 withrealpath: falseat 51 (the file may not exist yet). Whether the lock must promise to follow the target across an ancestor symlink that changes after resolution is a decision about what the lock means, and it is the decision I put to a named owner in comment 4515214741 rather than making it here. No control settles it at this head: proving it needs an ancestor symlink swapped between the resolution and the write while a second writer holds the lock for a different referent, and on this box a deterministic version of that race needs symlink privileges plus a window I cannot hold open. I ran no control for it, so its answer is unspent rather than answered, and nothing was done to that thread.One comment carries both answers because this leg was capped at four metered core points and this was the fourth; the other two answers would have been a fifth and sixth. Nothing in this reply is a claim that a door label is a clearance, and no thread was resolved by it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analysis chain
Script executed:
Length of output: 46571
web_search executed:
For Node.js 22.23.4 on Windows, does fs.access(path, fs.constants.W_OK) account for file ACLs? For Windows icacls /save, does successful DACL capture establish that the current process has FILE_WRITE_DATA access to the target? Consult official Node.js and Microsoft documentation, and distinguish DACL capture or restoration from an access check.Length of output: 18496
web_search executed:
In the official Node.js v22.23.4 fs documentation, what exact limitation does fs.access have on Windows access-control lists? Find the versioned documentation and quote the relevant passage.Length of output: 7318
Script executed:
Length of output: 905
@easonLiangWorldedtechI checked PR#1395at925f8b7. I am not marking this finding as addressed._saveDaclWindowscaptures the target’s DACL for restoration; it does not check whether the caller has write access. Restoration happens after the rename. ADaclRestoreErrortherefore reports a condition after the content has already been replaced.The reported controls establish that the calls and capture-failure handling are tested. They do not establish the denied-write scenario on Windows: the editor tests mock
fs.accessandsafeWriteText, and the real-filesystem tests do not set a DACL. Node.js 22.23.4 documents thatfs.accessdoes not check Windows ACLs.After the maintainer chooses the authorization check, please verify it with a Windows test that establishes denied file writes and permitted replacement, then checks that
saveDirectlyrejects and leaves the original content unchanged. I did not run a Windows test or rerun the reported controls. Follow-up issue#2441records this work.For the sibling finding, the inspected code supports your reading:
showTextDocumentcan reject after publication. I took no action on that separate thread. The last saved persistence-integrity gate also reported a distinct leaf-symlink lock-key issue and was blocking; please refresh that check before merge.Learnings used
You are interacting with an AI system.