fix(entropy): name offset when the byte window starts past EOF (#6495)

Fixes #6482

Co-authored-by: Abelo9996 <[email protected]>
This commit is contained in:
Abel YagubyanandAbelo9996 authored and GitHub committed 2026-10-23 23:42:07 +09:00
1 parent 8f91e60558
commit e8dad898da
3 files changed
+23 -2

No files matched your search

@@ -69,6 +69,22 @@ it("rejects missing files, non-files and windows beyond EOF, but accepts empty w
).toContainEqual(expect.stringContaining("reports a size of 0"));
});
it.each([
[{ offset: 2048 }, "offset"],
[{ offset: 2048, length: 0 }, "offset"],
[{ offset: 512, length: 1024 }, "length"],
])("names the selector that puts %o past EOF", async (window, field) => {
const root = await createTestTempDirectory("rea-entropy-window-");
const path = join(root, "bytes");
await writeFile(path, Buffer.alloc(1024));
const result = await new ByteEntropyService().inspect({ path, ...window });
if (result.ok) throw new Error("Expected an out-of-file window to fail");
expect(projectAnalysisError(result.error)).toMatchObject({
code: "invalid_request",
details: { issues: [{ path: [field], reason: "invalid_value" }] },
});
});
it.skipIf(process.platform !== "linux")(
"marks a generated /proc file that reports size 0 as not shown empty",
async () => {