Skip to content

Commit 33e9200

Browse files
Merge the landed u4 head: main's write protocol plus our path-safety graft
This merges fws/u4-read-scope-recording at b86511f into the u5 lane. The first merge step (e77ef44) took f739a5f at merge base 70eba96 - non-zero, so this is convergence and not an accepted-and- dropped fast-forward - and named every one of the 11 resolved blobs. This refresh step moves one file, because that is all that changed on the incoming side since: src/utils/__tests__/safeWriteJson.test.ts, blob 50feb7d, byte-identical to the incoming head's copy; the change is one-sided because e77ef44 had already taken the incoming copy of that file, and the incoming change repairs a windows-only failure in a row this unit added. The seam, stated so it can be checked: - src/utils/safeWriteJson.ts is 1e4031a - main's protocol. Its staging path is createTempFilePath(resolvedTargetPath, "new") at line 377 and its four `await fs.rename(` sites (413, 427, 429, 507) all name values derived from that same resolved target, so no rename site and the staging path can disagree about spelling. - src/utils/fileLock.ts is 2ab8179: the incoming FileLockOptions and json-lock-wait trace, with canonicalization kept inside acquireFileLock through canonicalLockPath, because safeWriteJson hands it a key already produced by resolveLockKey (lines 315, 325, 355) while jsonFileRecovery and the fileLock specs hand it raw paths. withFileLock resolves the operation path once and lets that one call derive the key, so the walk happens once. - src/services/file-safety/safeWriteText.ts stays 2713562 (this branch's copy) with its spec. That is a reviewability choice, not a claim about canonical text: Zoo-Code-Org#2350 and the declared merge order stay the arbiter, and a u4-first landing means a content union rather than these exports vanishing. The same conflict re-creates at this PR's own merge with main and the row anchoring moves again; that cost is real and is being paid on purpose. Gates, all on pinned node v22.23.4, all against this tree (this message amend does not change the tree, and the tree was checked before and after): - behavioural proof of the seam claim, vitest.misc.config.ts over safeWriteJson.test.ts, safeWriteJson.lockKey.spec.ts, safeWriteJson.interruption.test.ts, fileLock.spec.ts, fileLock.test.ts, fileLock.canonicalKey.spec.ts and jsonFileRecovery.test.ts: 7 test files passed (7), 90 tests passed / 4 skipped (94). - whole misc shard: 120 test files passed / 1 skipped (121), 2125 tests passed / 17 skipped (2142). - services config over safeWriteText.ts and its spec: 1 test file passed, 71 passed. - core config over ReadFileTool.ts, readFileTool.spec.ts, observationRegistry.ts, observationRegistry.spec.ts, guardedWrite.ts, guardedWrite.spec.ts and indentation-reader.spec.ts: 3 test files passed, 191 passed. - tsc -p src/tsconfig.json exit 0; eslint --max-warnings=0 over the eleven merged files exit 0 with src/eslint-suppressions.json unmodified; prettier --check over the same eleven exit 0. - knip: `pnpm knip` and `pnpm knip:production` exit 1 in the lane this merge was made in, reporting the whole src workspace unreferenced - 501 unused files, 56 unused src/package.json dependencies, 4 unused exported enum members in packages/types. The same two commands in the Zoo-Code-Org#1913 lane exit 0, and reverting knip.json to the incoming blob 1f4956f does not change this lane's number (502), so the added guardedWrite entry line is not the cause. A throwaway worktree at this exact commit with its own fresh `pnpm install --frozen-lockfile` (pnpm 10.8.1, 1762 packages, 38.1s) runs both knip commands to exit 0. This lane's install is the suspect, and its visible sign is webview-ui/node_modules holding 59 entries where the other lane holds 60. The hosted knip leg succeeded at both 0f786ce and f739a5f, and the fresh-install control at this tree is the read being reported; a red in this lane is evidence about this lane.
2 parents e77ef44 + b86511f commit 33e9200

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,20 @@ describe("safeWriteJson", () => {
10691069
await safeWriteJson(currentTestFilePath, { after: true })
10701070

10711071
expect(await readFileContent(currentTestFilePath)).toEqual({ after: true })
1072-
expect(consoleErrorSpy).toHaveBeenCalledWith(expect.stringContaining(currentTestFilePath), expect.anything())
1072+
// The log must name the target it could not read; it must not be compared against
1073+
// the caller's spelling. The writer resolves the target before logging, and on
1074+
// Windows a path whose components carry 8.3 aliases resolves to a different
1075+
// spelling than the one the caller handed it - measured on this row: a temp under
1076+
// C:\work\ZOO-CO~1\TMP-AL~2 logged its target as ...\Zoo-Code-fork\.tmp-alias-vps2f\
1077+
// on the same run. The mkdtemp directory name and the file's own name are the parts
1078+
// that survive resolution, so the log is pinned to those.
1079+
const loggedTargets = consoleErrorSpy.mock.calls.map((call: unknown[]) => String(call[0])).join("\n")
1080+
expect(loggedTargets).toContain(path.basename(path.dirname(currentTestFilePath)))
1081+
expect(loggedTargets).toContain(path.basename(currentTestFilePath))
1082+
expect(consoleErrorSpy).toHaveBeenCalledWith(
1083+
expect.stringContaining(path.basename(currentTestFilePath)),
1084+
expect.anything(),
1085+
)
10731086
consoleErrorSpy.mockRestore()
10741087
}, 20_000)
10751088

0 commit comments

Comments
 (0)