Repository navigation
Commit ad18ac4
committed
file-safety: give the identity guard a row where the target changes mid-write
The review on safeWriteText.identity.spec.ts asked for a row where the target is replaced between
staging and the commit rename rather than before the call. The seams it needs are already in the
writer: options.platform picks which step runs, and options.execFileRunner is the icacls call that
step makes. platform: "win32" plus an injected runner now swaps the target for a second live file
when icacls is asked to dump its DACL, which is after the temp is staged and before the commit-time
identity check, so the guard fires from a change inside the call and the stranger keeps the pathname
it was swapped in for. The swap renames the target aside instead of unlinking it so the authorized
inode stays allocated - the unlink-and-rewrite shape is the one that agreed with itself on Windows
and disagreed on the ubuntu runner, and a comment in this file records that trap.
The second row reads the same gate from the other side: with the override saying linux the injected
runner is never called. On a Windows host that path ends in PostCommitDurabilityError - fsync on a
read-only handle is EPERM on win32, the same reason the backup fsync above opens its handle r+ - so
the row asserts the seam and the committed content and admits no other error class. The third row
asserts the clean publish and is skipped on win32 for that measured reason: the ubuntu CI arm is the
instrument for it, and that arm's negative control is this same file with the override omitted,
where process.platform is the platform under test rather than a value handed to the writer.
Verification, pinned node v22.23.4 with stdio on file descriptors, run from wt-u2-1911/src through
its src/node_modules (vitest 4.1.12, realpath Zoo-Code/node_modules/.pnpm/[email protected]_@opentelemetr_
041b5b095ecf5a50bc5f59b473dbb794): services/file-safety identity, main and alias specs give 88
passed and 1 skipped in 3 files; tsc --noEmit -p tsconfig.json in src reports 0 errors; eslint
--prune-suppressions --max-warnings=0 exits 0 on the touched file and its suppressions rewrite was
reverted, so src/eslint-suppressions.json is byte-identical with HEAD; prettier --check is clean and
formatting ran before measuring. Gate: 496 of 500 counted executable lines against 73931fe both
before and after this commit - the delta is 103 lines in one spec file and specs charge nothing, and
no production line changed.1 parent 2e79e37 commit ad18ac4
1 file changed
Lines changed: 103 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
6 | 41 | | |
7 | 42 | | |
8 | 43 | | |
| |||
52 | 87 | | |
53 | 88 | | |
54 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
55 | 157 | | |
56 | 158 | | |
57 | 159 | | |
| |||
0 commit comments