mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 21:36:13 +00:00
* feat(artifacts): inspect classic iNES container regions
* fix(artifacts): preserve iNES source disappearance as integrity failure
* fix(artifacts): revalidate iNES source before parsing header
* fix(artifacts): validate admitted roots before classification
* fix(artifacts): normalize source loss during root hashing
* fix(artifacts): bind iNES extraction admission to inventory
* test(artifacts): clarify non-executing inspection wording
* fix: preserve binary plist detection with extended magic probe
* test(browser): wait for popup document loads before capture
* fix(artifacts): honor cancellation across source validation
* fix(artifacts): prefer artifact magic over implicit database suffix
* fix(artifacts): select extraction readers from scanned format
* fix(artifacts): complete prefix reads and share ZIP format admission
* fix(browser): budget scenario cleanup for content drain and shutdown
* test(artifacts): admit valid universal inputs before routing
* test(artifacts): verify iNES workflows on macOS
* test(ci): own iNES macOS coverage and portable fixture paths
* fix: preserve cleanup retries and avoid duplicate inventory parsing
* fix(contracts): share ZIP target formats across MCP lifecycle schemas
* fix(target): preserve typed cancellation during descriptor admission
* refactor(artifacts): use JSON-safe inventory producer output directly
* test(artifacts): share file read setup and satisfy CI checks
* fix(artifacts): classify changed admission as integrity failure
* ci: run Mach-O summary delivery coverage on macOS
* test(javascript): align parameter provenance with main contract
* test(browser): await discoverable fixture pages before runtime verification
* fix(artifacts): pass target metadata to format detection
* fix(artifacts): bind extraction to opened target
* fix: repair the static-check failures on the default branch (#2895)
* fix: repair the static-check failures on the default branch
The default branch fails its own required `Static checks` job three ways, so
every pull request reports that job as failed regardless of its own change.
- `npm run format:check` reports `src/domain/functionComparison.test.ts` and
`src/ida/IdaOperationRunner.ts`.
- `npm run lint` reports a duplicate `import { join } from "node:path"` in
`tests/boundary/mcp/ghidraInventoryMcp.test.ts` (lines 4 and 17).
- `npm run typecheck` reports `format: "devin"` missing from the client format
union in `src/application/SupportedClients.ts`, and an unchecked index in
`tests/boundary/cli/clientProfileLifecycle.test.ts`, whose pair array is
inferred as `string[][]`.
Apply the pinned formatter, drop the duplicate import, list the `"devin"` format
that its own definition already uses, and mark the pair array `as const`.
Validation: `npm run check:fast` and `npm run format:check` pass.
* fix(setup): keep Devin on the JSON configuration dialect
---------
Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
(cherry picked from commit df3d96da80)
* fix(artifacts): bind session inventories to target identity
* test(browser): bound fixture readiness acknowledgements
---------
Co-authored-by: 64579525 <17373302683@163.com>
Co-authored-by: 吴佳浩Alben <35291372+XiaoBinGan@users.noreply.github.com>
Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
172 lines
5.1 KiB
TypeScript
172 lines
5.1 KiB
TypeScript
import { readFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
|
|
import { describe, expect } from "vitest";
|
|
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
import {
|
|
processTest as it,
|
|
waitForExit,
|
|
} from "../../support/process/processFixture.js";
|
|
|
|
import {
|
|
BROWSER_DEVTOOLS_STARTUP_TIMEOUT_MS,
|
|
BrowserStartupError,
|
|
waitForBrowserDevtoolsPort,
|
|
} from "../../../scripts/lib/browser-process-startup.mjs";
|
|
import { assertOrdinaryWindowsVerifierCaller } from "../../../scripts/lib/windows-ordinary-user-verifier.mjs";
|
|
|
|
describe("browser process startup", () => {
|
|
it("requires a positively observed ordinary Windows verifier caller", () => {
|
|
expect(() =>
|
|
assertOrdinaryWindowsVerifierCaller({
|
|
administrator: false,
|
|
elevated: false,
|
|
integrityLevel: 8192,
|
|
}),
|
|
).not.toThrow();
|
|
|
|
for (const token of [
|
|
{ administrator: true, elevated: false },
|
|
{ administrator: false, elevated: true },
|
|
{ administrator: false },
|
|
{ administrator: false, elevated: null },
|
|
null,
|
|
]) {
|
|
expect(() => assertOrdinaryWindowsVerifierCaller(token)).toThrow(
|
|
/ordinary, non-elevated user token/u,
|
|
);
|
|
}
|
|
});
|
|
|
|
it("returns a delayed valid DevToolsActivePort", async ({ processes }) => {
|
|
const root = await temporaryRoot();
|
|
const portPath = join(root, "DevToolsActivePort");
|
|
const child = processes.spawn(process.execPath, [
|
|
"-e",
|
|
`setTimeout(() => require("node:fs").writeFileSync(${JSON.stringify(portPath)}, "43117\\n/browser"), 20); setTimeout(() => {}, 1000)`,
|
|
]);
|
|
try {
|
|
await expect(
|
|
waitForBrowserDevtoolsPort({
|
|
child,
|
|
executable: process.execPath,
|
|
activePortPath: portPath,
|
|
stderr: () => "",
|
|
timeoutMs: 1_000,
|
|
pollIntervalMs: 5,
|
|
}),
|
|
).resolves.toBe(43_117);
|
|
} finally {
|
|
child.kill("SIGKILL");
|
|
expect(await waitForExit(child, 5_000)).toBe(true);
|
|
}
|
|
});
|
|
|
|
it("classifies signal termination instead of timing out", async ({
|
|
processes,
|
|
}) => {
|
|
const root = await temporaryRoot();
|
|
const child = processes.spawn(process.execPath, [
|
|
"-e",
|
|
"process.kill(process.pid, 'SIGTERM')",
|
|
]);
|
|
|
|
const failure = await waitForBrowserDevtoolsPort({
|
|
child,
|
|
executable: process.execPath,
|
|
activePortPath: join(root, "DevToolsActivePort"),
|
|
stderr: () => "signal fixture",
|
|
timeoutMs: 1_000,
|
|
pollIntervalMs: 5,
|
|
}).catch((cause: unknown) => cause);
|
|
|
|
expect(failure).toBeInstanceOf(BrowserStartupError);
|
|
expect(failure).toMatchObject({
|
|
failure: "signalled",
|
|
exitCode: null,
|
|
signalCode: "SIGTERM",
|
|
stderr: "signal fixture",
|
|
});
|
|
});
|
|
|
|
it("reports bounded timeout diagnostics", async ({ processes }) => {
|
|
const root = await temporaryRoot();
|
|
const child = processes.spawn(process.execPath, [
|
|
"-e",
|
|
"setTimeout(() => {}, 1000)",
|
|
]);
|
|
try {
|
|
const failure = await waitForBrowserDevtoolsPort({
|
|
child,
|
|
executable: process.execPath,
|
|
activePortPath: join(root, "DevToolsActivePort"),
|
|
stderr: () => "",
|
|
timeoutMs: 20,
|
|
pollIntervalMs: 5,
|
|
}).catch((cause: unknown) => cause);
|
|
|
|
expect(failure).toBeInstanceOf(BrowserStartupError);
|
|
expect(failure).toMatchObject({
|
|
failure: "timeout",
|
|
exitCode: null,
|
|
signalCode: null,
|
|
startupTimeoutMs: 20,
|
|
});
|
|
expect(String(failure)).toContain("stderr=<empty>");
|
|
expect(String(failure)).toContain("timeoutMs=20");
|
|
} finally {
|
|
child.kill("SIGKILL");
|
|
expect(await waitForExit(child, 5_000)).toBe(true);
|
|
}
|
|
});
|
|
|
|
it("names the owner's deadline when a caller omits one", async ({
|
|
processes,
|
|
}) => {
|
|
const root = await temporaryRoot();
|
|
const child = processes.spawn(process.execPath, [
|
|
"-e",
|
|
"setTimeout(() => process.exit(3), 10)",
|
|
]);
|
|
|
|
const failure = await waitForBrowserDevtoolsPort({
|
|
child,
|
|
executable: process.execPath,
|
|
activePortPath: join(root, "DevToolsActivePort"),
|
|
stderr: () => "owner default fixture",
|
|
pollIntervalMs: 5,
|
|
}).catch((cause: unknown) => cause);
|
|
|
|
expect(failure).toBeInstanceOf(BrowserStartupError);
|
|
expect(failure).toMatchObject({
|
|
failure: "exited",
|
|
startupTimeoutMs: BROWSER_DEVTOOLS_STARTUP_TIMEOUT_MS,
|
|
});
|
|
expect(String(failure)).toContain(
|
|
`timeoutMs=${String(BROWSER_DEVTOOLS_STARTUP_TIMEOUT_MS)}`,
|
|
);
|
|
});
|
|
|
|
it("keeps one owner for the DevToolsActivePort deadline", async () => {
|
|
expect(BROWSER_DEVTOOLS_STARTUP_TIMEOUT_MS).toBe(60_000);
|
|
const source = await readFile(
|
|
new URL(
|
|
"../../../scripts/lib/browser-runtime-fixture-lifecycle.mjs",
|
|
import.meta.url,
|
|
),
|
|
"utf8",
|
|
);
|
|
expect(source).toContain(
|
|
"const deadline = performance.now() + BROWSER_DEVTOOLS_STARTUP_TIMEOUT_MS",
|
|
);
|
|
expect(source).toContain(
|
|
"timeoutMs: Math.max(1, deadline - performance.now())",
|
|
);
|
|
});
|
|
});
|
|
|
|
const temporaryRoot = async (): Promise<string> => {
|
|
return createTestTempDirectory("rea-browser-startup-");
|
|
};
|