Skip to content

Commit 402e25d

Browse files
#1912 review rows: the JSON fixture now speaks the spelling the writer resolves to
platform-unit-test (windows-latest) failed on d3dd922 in zoo-code:test:misc with six failing rows in utils/__tests__/safeWriteJson.test.ts - 'Test Files 1 failed | 118 passed | 1 skipped', 'Tests 6 failed | 2117 passed | 13 skipped'. One is mine and old-format, three are mine, two are pre-existing rows that were green at the parent: should preserve backups when another backup stat fails with EACCES - promise resolved, not rejected should preserve backups when another backup stat fails with EIO - promise resolved, not rejected propagates a transient ancestor lookup failure instead of reporting a replaced ancestor - same reports what the target resolves to now when it no longer resolves to the pinned target - expected 'C:\Users\RUNNER~1\AppData\Local\Temp\...' and received 'C:\Users\runneradmin\...' aborts the publish when the target's mode cannot be read - the injected stat failure never fired keeps the published target with its new content when the post-commit directory fsync fails - 'expected 0 to be greater than 0' for the directory handles the row collected from openSync One cause for all six. This runner reports the profile directory in its 8.3 form through os.tmpdir() (C:\Users\RUNNER~1\...) and in its long form through fs.realpath (C:\Users\runneradmin\...), and the two spellings name the same directory - the fourth row's assertion above is that measurement, one value captured with fs.realpathSync and the other returned by the writer. The writer works on the realpath spelling, and this unit moved the recovery scan onto the lock key, which is a realpath result. Every path-keyed double in the file compares against strings derived from the fixture's mkdtemp path, so on that runner the injections landed on paths the writer never named and the fsync row's handle filter matched nothing. The same six rows pass on ubuntu (no 8.3 mapping) and on this box (the profile name is 'eason', whose 8.3 form is identical), which is why the failure was invisible locally - a green local run was evidence about this machine, not about the pull request. The fixture root is canonicalised once in beforeEach with the same call the writer uses, so the fixture's paths and the writer's paths are one string, instead of loosening the six rows or teaching each double to fold spellings. Re-run here (cwd src, node 22.23.4 win32): vitest run --config vitest.misc.config.ts: exit 0, Test Files 118 passed 1 skipped, Tests 2119 passed 13 skipped. vitest run --config vitest.misc.config.ts --coverage (the ubuntu arm's command): exit 0, same counts. prettier --check and eslint --max-warnings=0 --no-warn-ignored --no-cache on the changed file: exit 0. tsc --noEmit -p tsconfig.json: exit 2, one line - activate/registerCommands.ts(88,102): error TS2739, unchanged. One test file changed; no production file changed in this commit.
1 parent d3dd922 commit 402e25d

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎src/utils/__tests__/safeWriteJson.test.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,17 @@ describe("safeWriteJson", () => {
8383
let currentTestFilePath: string
8484

8585
beforeEach(async () => {
86-
// Create a temporary directory for each test
87-
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "safeWriteJson-test-"))
86+
// Create a temporary directory for each test, in the spelling the writer itself uses.
87+
// safeWriteJson works on a path that fs.realpath returned (the lock key, and now the
88+
// recovery scan keyed to it, are realpath results), and every path-keyed double in this
89+
// file compares against strings derived from tempDir. On the windows CI runner os.tmpdir()
90+
// reports the profile directory in its 8.3 form - C:\Users\RUNNER~1\AppData\Local\Temp -
91+
// while fs.realpath reports C:\Users\runneradmin\AppData\Local\Temp for the same
92+
// directory, and six rows here (three of them pre-existing) failed on that runner for
93+
// nothing but the spelling: the doubles that inject a failure at a named path never saw
94+
// that path, and the fsync row never saw the directory handle it opened. Canonicalising
95+
// the fixture root makes the fixture's paths and the product's paths one string.
96+
tempDir = await fs.realpath(await fs.mkdtemp(path.join(os.tmpdir(), "safeWriteJson-test-")))
8897

8998
// Create a unique file path for each test
9099
currentTestFilePath = path.join(tempDir, "test-file.json")

0 commit comments

Comments
 (0)