Files
reverse-engineering-anything/src/config/kunaProjectDeadline.test.ts
T
Cursor Agent 5ba464527b fix(limits): reject invalid runtime seeds and keep the value an operation used
A malformed migrated launch seed stays on the config and the operation view reports configuration_invalid unless a snapshot override is active. Kuna, regex, GDB, and Rizin keep the deadline or heap accepted when the work started, and reattributed resource errors copy the structured limit.
2026-11-11 20:16:24 +08:00

44 lines
1.4 KiB
TypeScript

import { expect, it } from "vitest";
import { runWithAnalysisOperationSnapshot } from "../domain/analysisOperationSnapshot.js";
import {
kunaProjectDeadline,
readKunaConfiguration,
} from "../kuna/KunaConfiguration.js";
import { acceptedExportDeadline } from "../kuna/KunaProjectExport.js";
it("keeps the deadline a failed export accepted after the override is reset", () => {
const environment = {
REA_KUNA_COMMAND: "/usr/bin/kuna",
REA_KUNA_PROJECT_TIMEOUT_MS: "not-a-timeout",
};
const configuration = runWithAnalysisOperationSnapshot(
{
revision: 1,
overrides: { "kuna.project_timeout_ms": 5000 },
},
() => {
const parsed = readKunaConfiguration(environment, "linux");
if (!parsed.ok) throw new Error(parsed.error.reason);
return parsed.value;
},
);
expect(configuration.projectTimeoutLaunchValid).toBe(false);
const accepted = runWithAnalysisOperationSnapshot(
{
revision: 1,
overrides: { "kuna.project_timeout_ms": 5000 },
},
() => kunaProjectDeadline(configuration),
);
expect(accepted).toEqual({
setting: "REA_KUNA_PROJECT_TIMEOUT_MS",
ms: 5000,
source: "runtime",
});
expect(() => kunaProjectDeadline(configuration)).toThrow(
/no runtime override is active/,
);
expect(acceptedExportDeadline(configuration, accepted)).toEqual(accepted);
expect(accepted).toMatchObject({ ms: 5000, source: "runtime" });
});