Skip to content

Commit 7218052

Browse files
docs(file-safety): state the DACL restore contract the integration case relies on
The comment cited DaclRestoreError and a test name that exist nowhere at this head. Windows DACL restoration is best-effort after the commit rename: step 5 restores only once fs.rename has published, _restoreDaclWindows swallows a failing restore, and the publish resolves - the contract asserted by "win32 DACL: dump is unlinked even when restore fails" at safeWriteText.spec.ts:829. That is a different contract from the save side, where a failed icacls /save throws DaclInspectionError phase "save" before any rename, asserted at safeWriteText.spec.ts:741. Comment only, no behaviour change and no new test.
1 parent 99e4625 commit 7218052

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎src/services/file-safety/__tests__/safeWriteText.integration.spec.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,17 @@ describe("safeWriteText against a real filesystem", () => {
2323
await fs.writeFile(targetPath, "old bytes")
2424

2525
// No platform override: the real platform's own durability and ACL steps run, and this
26-
// case is the successful restore. A failed restore now throws DaclRestoreError after
27-
// the commit rename has already happened (the focused unit test "win32 DACL: a failed
28-
// restore is an error and the dump is still unlinked" covers that path), so on a
29-
// machine where icacls cannot put a saved ACL back into a throwaway temp directory
30-
// this publish reports that error instead of resolving, and the residue assertions
31-
// below are reached only where the restore worked.
26+
// case is the successful restore. Windows DACL restoration is best-effort after the
27+
// commit rename: step 5 runs icacls /restore only once fs.rename has already put the
28+
// staged file in the target's place, and _restoreDaclWindows swallows a failing
29+
// restore, so the publish still resolves and only the .acl dump is unlinked. That is
30+
// the contract asserted by "win32 DACL: dump is unlinked even when restore fails" at
31+
// src/services/file-safety/__tests__/safeWriteText.spec.ts:829. The save side is a
32+
// different contract: a failed icacls /save throws DaclInspectionError with phase
33+
// "save" before any rename, which is what "win32 DACL: a partial dump left by a failed
34+
// save is removed and the publish is refused" at safeWriteText.spec.ts:741 asserts. So
35+
// on a machine where icacls cannot put a saved ACL back into a throwaway temp
36+
// directory this publish still resolves and the residue assertions below are reached.
3237
await safeWriteText(targetPath, "new bytes", { backup: true })
3338

3439
expect(await fs.readFile(targetPath, "utf8")).toBe("new bytes")

0 commit comments

Comments
 (0)