fix(ci): consolidate shared timer limit export

This commit is contained in:
morluto committed 2026-10-31 01:16:19 +08:00
1 parent 0ffed7a48c
commit ebfef27b46
9 files changed
+19 -27

No files matched your search

+3 -3
View File
@@ -3,7 +3,7 @@ import { expect, it } from "vitest";
import { explicitSetupRegistrationEnvironment } from "../application/SetupRegistrationEnvironment.js";
import {
DEFAULT_HOPPER_CALLER_SCAN_BUDGET_MS,
MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS,
MAX_NODE_TIMER_DELAY_MS,
MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS,
} from "../domain/analysisResourceLimits.js";
import {
@@ -35,7 +35,7 @@ it("records the default caller-scan budget and forwards an explicit setting", ()
milliseconds: DEFAULT_HOPPER_CALLER_SCAN_BUDGET_MS,
source: "default",
floorMilliseconds: MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS,
maximumMilliseconds: MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS,
maximumMilliseconds: MAX_NODE_TIMER_DELAY_MS,
});
const selected = parseConfig({
[HOPPER_CALLER_SCAN_BUDGET_SETTING]: "250",
@@ -66,7 +66,7 @@ it("explains the time budget and that fixed byte allowances have no override", (
`The default is ${String(DEFAULT_HOPPER_CALLER_SCAN_BUDGET_MS)} ms`,
);
expect(time).toContain(
`from ${String(MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS)} to ${String(MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS)} ms`,
`from ${String(MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS)} to ${String(MAX_NODE_TIMER_DELAY_MS)} ms`,
);
expect(time).toContain("no runtime override");
expect(time).toContain(
+2 -2
View File
@@ -1,6 +1,6 @@
import {
DEFAULT_HOPPER_CALLER_SCAN_BUDGET_MS,
MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS,
MAX_NODE_TIMER_DELAY_MS,
MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS,
} from "../domain/analysisResourceLimits.js";
import {
@@ -28,7 +28,7 @@ export const defaultHopperCallerScanBudget = (): HopperCallerScanBudget => ({
source: "default",
defaultMilliseconds: DEFAULT_HOPPER_CALLER_SCAN_BUDGET_MS,
floorMilliseconds: MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS,
maximumMilliseconds: MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS,
maximumMilliseconds: MAX_NODE_TIMER_DELAY_MS,
});
/** Record whether the launch environment supplied the budget. */
+2 -2
View File
@@ -1,5 +1,5 @@
import {
MAX_PROVIDER_STARTUP_TIMEOUT_MS,
MAX_NODE_TIMER_DELAY_MS,
MAX_GHIDRA_DECOMPILE_TIMEOUT_SECONDS,
} from "../domain/analysisResourceLimits.js";
import { z } from "zod";
@@ -20,4 +20,4 @@ export const providerStartupTimeoutSchema = z
.string()
.regex(/^[1-9]\d*$/u, "must be a positive decimal integer")
.transform(Number)
.pipe(z.int().min(1).max(MAX_PROVIDER_STARTUP_TIMEOUT_MS));
.pipe(z.int().min(1).max(MAX_NODE_TIMER_DELAY_MS));
+2 -9
View File
@@ -45,21 +45,14 @@ export const MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS = 1;
* Largest delay Node schedules exactly. Delays above this signed 32-bit
* boundary become a 1 ms timer, so startup and swiftc timeouts stop here.
*/
export const MAX_PROVIDER_STARTUP_TIMEOUT_MS = 2_147_483_647;
/**
* Largest caller-scan budget Node can schedule exactly. A delay above this
* signed 32-bit bound becomes 1 ms, so the setting stops here.
*/
export const MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS =
MAX_PROVIDER_STARTUP_TIMEOUT_MS;
export const MAX_NODE_TIMER_DELAY_MS = 2_147_483_647;
/**
* Ghidra 12.1.4 converts whole seconds to a signed int millisecond delay.
* Keep that multiplication positive and exact rather than imposing a day cap.
*/
export const MAX_GHIDRA_DECOMPILE_TIMEOUT_SECONDS = Math.floor(
MAX_PROVIDER_STARTUP_TIMEOUT_MS / 1000,
MAX_NODE_TIMER_DELAY_MS / 1000,
);
/** Matching deadline used when the setting is unset. Today's fixed constant. */
+2 -2
View File
@@ -5,7 +5,7 @@ import {
MAXIMUM_ASAR_MAX_HEADER_BYTES,
DEFAULT_GHIDRA_STARTUP_TIMEOUT_MS,
DEFAULT_HOPPER_STARTUP_TIMEOUT_MS,
MAX_PROVIDER_STARTUP_TIMEOUT_MS,
MAX_NODE_TIMER_DELAY_MS,
MAX_GHIDRA_DECOMPILE_TIMEOUT_SECONDS,
DEFAULT_REGEX_MATCHING_DEADLINE_MS,
MAXIMUM_REGEX_MATCHING_DEADLINE_MS,
@@ -42,7 +42,7 @@ interface SettingDefinition {
}
const timer = {
minimum: 1,
maximum: MAX_PROVIDER_STARTUP_TIMEOUT_MS,
maximum: MAX_NODE_TIMER_DELAY_MS,
unit: "ms",
appliesAt: "next_operation",
} as const;
+2 -3
View File
@@ -1,4 +1,4 @@
import { MAX_PROVIDER_STARTUP_TIMEOUT_MS } from "./analysisResourceLimits.js";
import { MAX_NODE_TIMER_DELAY_MS } from "./analysisResourceLimits.js";
export type HopperPrivateDisplayStrategy =
| "direct"
@@ -19,8 +19,7 @@ export const MINIMUM_HOPPER_DEMO_DIALOG_TIMEOUT_MS = 1;
* Largest accepted dialog watch. Delays above this signed 32-bit bound are
* the same ceiling REA uses for its other millisecond settings.
*/
export const MAXIMUM_HOPPER_DEMO_DIALOG_TIMEOUT_MS =
MAX_PROVIDER_STARTUP_TIMEOUT_MS;
export const MAXIMUM_HOPPER_DEMO_DIALOG_TIMEOUT_MS = MAX_NODE_TIMER_DELAY_MS;
/** Rejected dialog-timeout setting retained with the adapter diagnostic. */
export type DialogTimeoutRejection = {
+2 -2
View File
@@ -7,7 +7,7 @@ import {
AnalysisCancelledError,
AnalysisTimeoutError,
} from "../domain/analysisErrorCore.js";
import { MAX_PROVIDER_STARTUP_TIMEOUT_MS } from "../domain/analysisResourceLimits.js";
import { MAX_NODE_TIMER_DELAY_MS } from "../domain/analysisResourceLimits.js";
import { ProviderStartupDeadline } from "../process/ProviderDeadline.js";
/** Which JEB MCP phase consumed `REA_JEB_MCP_TIMEOUT_MS`. */
@@ -19,7 +19,7 @@ export const jebMcpTimeoutGuidance = (
timeoutMs: number,
): { readonly userMessage: string; readonly remediationAction: string } => ({
userMessage: `This request reached REA's configured JEB ${phase === "discovery" ? "catalog discovery" : phase} deadline of ${String(timeoutMs)} ms (deadlineExpired).`,
remediationAction: `Increase REA_JEB_MCP_TIMEOUT_MS in REA's launch environment to an integer from 1 to ${String(MAX_PROVIDER_STARTUP_TIMEOUT_MS)} milliseconds (omitted means ${String(DEFAULT_REQUEST_TIMEOUT_MSEC)} ms) and restart and reconnect REA to apply it. The same setting raises catalog discovery and each tools/call. Allow execution, cleanup and delivery headroom in the outer MCP client deadline. Confirm outstanding work and cleanup before retrying.`,
remediationAction: `Increase REA_JEB_MCP_TIMEOUT_MS in REA's launch environment to an integer from 1 to ${String(MAX_NODE_TIMER_DELAY_MS)} milliseconds (omitted means ${String(DEFAULT_REQUEST_TIMEOUT_MSEC)} ms) and restart and reconnect REA to apply it. The same setting raises catalog discovery and each tools/call. Allow execution, cleanup and delivery headroom in the outer MCP client deadline. Confirm outstanding work and cleanup before retrying.`,
});
/** SDK 2.3.1 preserves an SdkError abort reason by identity. */
@@ -4,7 +4,7 @@ import {
resolveSwiftcCompileTimeoutMs,
swiftcCompileTimeoutRecovery,
} from "./DarwinProcessRunTokenReader.js";
import { MAX_PROVIDER_STARTUP_TIMEOUT_MS } from "../domain/analysisResourceLimits.js";
import { MAX_NODE_TIMER_DELAY_MS } from "../domain/analysisResourceLimits.js";
describe("resolveSwiftcCompileTimeoutMs", () => {
it("keeps the historical default when unset", () => {
@@ -40,7 +40,7 @@ describe("resolveSwiftcCompileTimeoutMs", () => {
const recovery = swiftcCompileTimeoutRecovery(300_000);
expect(recovery).toContain("REA_SWIFTC_COMPILE_TIMEOUT_MS");
expect(recovery).toContain("300000 ms");
expect(recovery).toContain(`1..${String(MAX_PROVIDER_STARTUP_TIMEOUT_MS)}`);
expect(recovery).toContain(`1..${String(MAX_NODE_TIMER_DELAY_MS)}`);
expect(recovery).toContain("120000 ms");
expect(recovery).toContain("restart REA");
expect(recovery).toContain("next ownership-helper compile");
+2 -2
View File
@@ -10,7 +10,7 @@ import {
DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS,
providerStartupTimeoutSchema,
} from "../config/providerStartupTimeout.js";
import { MAX_PROVIDER_STARTUP_TIMEOUT_MS } from "../domain/analysisResourceLimits.js";
import { MAX_NODE_TIMER_DELAY_MS } from "../domain/analysisResourceLimits.js";
import { err, ok, type Result } from "../domain/result.js";
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
import type {
@@ -132,7 +132,7 @@ export const resolveSwiftcCompileTimeoutMs = (
/** Name the existing swiftc deadline when a helper compile times out. */
export const swiftcCompileTimeoutRecovery = (timeoutMs: number): string =>
`The effective REA_SWIFTC_COMPILE_TIMEOUT_MS value is ${String(timeoutMs)} ms (integer range 1..${String(MAX_PROVIDER_STARTUP_TIMEOUT_MS)}; omitted default ${String(DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS)} ms). Set it in the environment that starts REA and restart REA; the next ownership-helper compile uses the new value.`;
`The effective REA_SWIFTC_COMPILE_TIMEOUT_MS value is ${String(timeoutMs)} ms (integer range 1..${String(MAX_NODE_TIMER_DELAY_MS)}; omitted default ${String(DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS)} ms). Set it in the environment that starts REA and restart REA; the next ownership-helper compile uses the new value.`;
/** Bound on compiler diagnostics embedded in the inspection failure text. */
const STDERR_EXCERPT_LIMIT = 512;