Repository navigation
Commit 6147c93
committed
test(tools): compare the recovery record against the resolver that produced it, not against a drive-hardcoded constant
The head this branch pushed an hour ago (b7e3d81) cleared the ubuntu required job - the abandoned-stream spec now passes on Linux - and went red on the windows sibling instead, on my own control case:
FAIL core/tools/__tests__/writeToFileTool.spec.ts > writeToFileTool > error handling > lets a write to an unrelated path proceed while a recovery is outstanding on the refused path
AssertionError: expected 'D:\test\file.txt' to be 'C:\test\file.txt' // Object.is equality
at writeToFileTool.spec.ts:1356 - expect(refusal?.context?.absolutePath).toBe(absoluteFilePath)
Two different platform axes were being compared as if they were one. absoluteFilePath is the spec constant, platform-conditional with a hard-coded drive: "C:\test\file.txt" on win32, "/test/file.txt" elsewhere. The value it was compared against is the recovery record my capture double builds with the real resolver - realPathResolve("/", opened) - and on Windows path.resolve takes a bare root from the drive the process cwd sits on: C: on this workstation, D: on the hosted windows runner, whose checkout lives under D:. Same relative path, same shape, different drive, so the case was green on every Linux matrix and on any Windows box whose cwd is on C: - which is every box I have - and red only where the runner put the repo on another drive. This is a defect in the assertion I wrote, not in the gate: the scoping logic, the record, and the recovery path are all drive-consistent within a process because both sides of the real comparison go through the same resolver.
The assertion now compares the record against the same construction that produced it - realPathResolve("/", testFilePath) - and adds the negative half, that it is not the unrelated target under the same resolver, so the claim it makes (the record names the refused write target) is the claim that is checked, and it holds on both drives. The win32-conditional constant itself is left alone: 19 spec files use that idiom at 90 sites, and the fragility is not the idiom, it is comparing a constant written in it against a real-resolver value.
Gates on this tree: writeToFileTool.spec 61 passed / 5 skipped; the standing widened scope (core/assistant-message, core/tools, core/task, integrations/editor) 98 files, 2002 passed / 5 skipped; tsc --noEmit exit 0; the package lint script exit 0 with the eslint cache deleted first. No production file changed in this commit, so the mutation picture of the branch is unchanged by it.
No changeset, no CHANGELOG entry, no lint suppression added or increased.
Co-Authored-Changed-By: bseries-merge (review-row answers, controls and measurements for PR #1930).1 parent b7e3d81 commit 6147c93
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1353 | 1353 | | |
1354 | 1354 | | |
1355 | 1355 | | |
1356 | | - | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
1357 | 1364 | | |
1358 | 1365 | | |
1359 | 1366 | | |
| |||
0 commit comments