mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 21:23:45 +00:00
fix(entropy)!: own selected Windows path spelling at admission (#9393)
* fix(evidence)!: keep one Evidence identity across Windows path case On Windows, an existing caller path now takes its filesystem spelling when that spelling differs from the resolved path by letter case alone. One file spelled `C:\Temp\x.bin`, `c:\temp\x.bin` or `C:\TEMP\X.BIN` produces one `parameters.path`, `normalized_result` path and `evidence_id`, matching the existing separator and `.` folding. `caller_input_path` keeps the input. Links, junctions, `subst` drives, 8.3 short names and paths that do not exist yet keep the caller spelling, so no link is followed and requested output names keep their case. BREAKING CHANGE: Windows Evidence produced from a path spelled in a case other than its filesystem spelling now gets a different `evidence_id`. Fixes #9373 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(entropy): keep Windows casing lookup optional * ci(entropy): select Windows identity verification --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
8 files changed
+168
-19
No files matched your search
@@ -623,3 +623,31 @@ it.each([false, true])(
|
||||
expect(result.error.cleanupIncomplete).toBe(false);
|
||||
},
|
||||
);
|
||||
|
||||
it("reads an admitted file even when Windows casing lookup is unavailable", async () => {
|
||||
const root = await createTestTempDirectory("rea-entropy-casing-unavailable-");
|
||||
const path = join(root, "readable.bin");
|
||||
await writeFile(path, Buffer.from([1, 2, 3, 4]));
|
||||
// The injected descriptor represents a readable share while the optional
|
||||
// host spelling lookup has no path on this filesystem.
|
||||
const selected = join(root, "share-selection.bin");
|
||||
const platform = vi
|
||||
.spyOn(process, "platform", "get")
|
||||
.mockReturnValue("win32");
|
||||
const service = new ByteEntropyService({
|
||||
stat: ((...args: Parameters<typeof stat>) =>
|
||||
stat(path, args[1])) as typeof stat,
|
||||
open: async () => open(path, "r"),
|
||||
});
|
||||
try {
|
||||
const result = await service.inspect({ path: selected });
|
||||
if (!result.ok) throw result.error;
|
||||
expect(result.value.normalized_result).toMatchObject({
|
||||
artifact: { bytes: 4 },
|
||||
});
|
||||
expect(result.value.caller_input_path).toBe(selected);
|
||||
} finally {
|
||||
await service.close();
|
||||
platform.mockRestore();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user