mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 11:13:21 +00:00
Add opt-in REA_GHIDRA_CHECKPOINT_DIR for owned Ghidra Program persistence through the shared CLI/MCP provider. Save completed initial analysis and metadata changes on normal close; verify and restore the last successful packed Program without auto-analysis. Preserve generation identity, exclusive ownership, typed cancellation and cleanup retry. Refresh checkpoint-dependent profiles after retirement, including failed-switch restoration, while retaining caller selection provenance. Keep source executables and caller projects unchanged. Validated with 720 focused tests (3 platform skips), 13 real Ghidra CLI/MCP scenarios, static/docs checks and CI. Review findings addressed. No version bump or release publication. Refs #8165.
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { expect, it } from "vitest";
|
|
import {
|
|
ghidraDecompileTimeoutRecovery,
|
|
ghidraStartupTimeoutGuidance,
|
|
} from "./GhidraProviderClient.js";
|
|
|
|
it("names the saved Program when a finished invocation must restart after a decompile deadline", () => {
|
|
const recovery = ghidraDecompileTimeoutRecovery(10, "owned-checkpoint");
|
|
expect(recovery.remediationAction).toContain(
|
|
"restores the last saved Program from REA_GHIDRA_CHECKPOINT_DIR",
|
|
);
|
|
expect(recovery.remediationAction).toContain(
|
|
"if initial analysis never completed",
|
|
);
|
|
expect(recovery.remediationAction).not.toContain(
|
|
"repeats import and analysis",
|
|
);
|
|
expect(recovery.continuingRemediationAction).toContain(
|
|
"update_analysis_settings",
|
|
);
|
|
});
|
|
|
|
it("keeps initial analysis and later restore explicit in checkpoint startup recovery", () => {
|
|
const guidance = ghidraStartupTimeoutGuidance(250, "owned-checkpoint");
|
|
expect(guidance.userMessage).toContain(
|
|
"checkpoint restore or initial analysis and saving",
|
|
);
|
|
for (const action of [
|
|
guidance.remediationAction,
|
|
guidance.continuingCallerGuidance.remediationAction,
|
|
]) {
|
|
expect(action).toContain("Keep REA_GHIDRA_CHECKPOINT_DIR");
|
|
expect(action).toContain(
|
|
"initial analysis and its first checkpoint must complete once",
|
|
);
|
|
expect(action).not.toContain("repeats import from scratch");
|
|
expect(action).not.toContain("REA_GHIDRA_PROJECT_PATH");
|
|
}
|
|
});
|