mirror of
https://github.com/morluto/rea.git
synced 2026-11-09 00:07:18 +00:00
* test: focus assertions on behavioral evidence Prune redundant and wording-coupled checks while retaining diagnostic, parser, recovery, and cleanup coverage. * refactor: remove test-only wrappers and duplicate checks Exercise production operations through test fixtures, remove unused adapters, and keep managed-member uncertainty guidance under its existing owner. * test: focus process validation on diagnostic facts * refactor: remove test-only runtime helpers Move semantic evidence fixture setup out of runtime and remove unused Windows settle recovery helpers while checking configured defaults independently. * test: focus artifact diagnostics on format facts * test: verify retained cleanup guidance delivery
50 lines
2.2 KiB
TypeScript
50 lines
2.2 KiB
TypeScript
import { truncate, writeFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import { expect, it } from "vitest";
|
|
import { projectAnalysisError } from "../../../src/domain/analysisErrorProjection.js";
|
|
import { RustBinaryProvider } from "../../../src/rust/RustBinaryProvider.js";
|
|
import { RUST_BINARY_INPUT_BYTES } from "../../../src/rust/RustAuditableReader.js";
|
|
import { createRustHashOverflowImage } from "../../fixtures/rust/image.js";
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
|
|
it("refuses extra rustc paths without asking the caller to wait", async () => {
|
|
const root = await createTestTempDirectory("rea-rust-hash-budget-");
|
|
const path = join(root, "many-hashes.elf");
|
|
await writeFile(path, createRustHashOverflowImage());
|
|
const result = await new RustBinaryProvider().inspect({ path });
|
|
if (result.ok) throw new Error("Expected a hash-capacity refusal");
|
|
const projected = projectAnalysisError(result.error);
|
|
expect(projected).toMatchObject({
|
|
retryable: false,
|
|
details: {
|
|
resource: "capacity",
|
|
reported_limits: { maximum_rustc_hashes: 64 },
|
|
},
|
|
});
|
|
expect(projected.remediation.action).toContain("rustc commit-path inventory");
|
|
expect(projected.remediation.action).not.toMatch(
|
|
/Wait for an active analysis/u,
|
|
);
|
|
});
|
|
|
|
it("refuses an oversized Rust input without evidence-reply advice", async () => {
|
|
const root = await createTestTempDirectory("rea-rust-input-budget-");
|
|
const path = join(root, "large.elf");
|
|
await writeFile(path, Buffer.from([0x7f, 0x45, 0x4c, 0x46]));
|
|
await truncate(path, RUST_BINARY_INPUT_BYTES + 1);
|
|
const result = await new RustBinaryProvider().inspect({ path });
|
|
if (result.ok) throw new Error("Expected an input-size refusal");
|
|
const projected = projectAnalysisError(result.error);
|
|
expect(projected).toMatchObject({
|
|
retryable: false,
|
|
details: {
|
|
resource: "file-size",
|
|
reported_limits: { maximum_input_bytes: RUST_BINARY_INPUT_BYTES },
|
|
},
|
|
});
|
|
expect(projected.remediation.action).toContain("does not admit this input");
|
|
expect(projected.remediation.action).not.toMatch(
|
|
/file-size allowance for the evidence reply/u,
|
|
);
|
|
});
|