Files
reverse-engineering-anything/tests/boundary/filesystem/analysisSettingsAdmission.test.ts
T
morluto f3ed1657f8 feat(mcp): support runtime analysis limit recovery (#7049)
* feat(mcp): support runtime analysis limit recovery

* refactor(config): remove unused limit re-exports

* fix(android): keep fixture release metadata dependency-free

* fix(settings): preserve provider budgets and recovery facts

* fix(tests): resolve lint plugins from their repository owner

* refactor(mcp): verify guidance delivery without frozen wording

* fix(android): align availability with runtime timeout

* test(recovery): assert limit facts instead of frozen wording

* fix(mcp): share runtime settings with the default JADX provider

* test(mcp): bound acknowledgements and release held work on failure

* fix(catalog): declare runtime settings tools as MCP-only
2026-10-25 09:45:26 +08:00

43 lines
1.5 KiB
TypeScript

import { expect, it } from "vitest";
import { writeFile } from "node:fs/promises";
import { join } from "node:path";
import { pathToFileURL } from "node:url";
import { AnalysisSettings } from "../../../src/application/AnalysisSettings.js";
import { runtimeAsarHeaderAdmission } from "../../../src/config/runtimeAnalysisSettings.js";
import { authorizedElectronFile } from "../../../src/browser/ElectronFileScope.js";
import { asarHeaderBytes } from "../../fixtures/asarHeader.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
it("rechecks cached Electron ASAR headers against a lowered runtime admission", async () => {
const root = await createTestTempDirectory("rea-settings-cache-");
const archive = join(root, "cached.asar");
await writeFile(
archive,
Buffer.concat([
asarHeaderBytes(
JSON.stringify({ files: { "main.js": { size: 1, offset: "0" } } }),
),
Buffer.from("x"),
]),
);
const store = new AnalysisSettings({});
const admission = runtimeAsarHeaderAdmission({}, store.read);
const member = join(archive, "main.js");
const authorize = () =>
store.run(() =>
authorizedElectronFile(
pathToFileURL(member).href,
undefined,
"inspect_electron_page",
admission,
),
);
expect(await authorize()).toBe(member);
expect(
store.update({
changes: [{ setting: "asar.max_header_bytes", action: "set", value: 1 }],
}).ok,
).toBe(true);
expect(await authorize()).toBeUndefined();
});