refactor(limits): declare the Node timer bound and duration schema once (#10640)

* refactor(limits): declare the Node timer bound and duration schema once

Fifteen modules re-declared 2_147_483_647 as their own timer maximum and
eleven built the same 1..2^31-1 millisecond schema. They now use
MAX_NODE_TIMER_DELAY_MS and timerDurationMsSchema from
src/domain/analysisResourceLimits.ts, and an architecture guard rejects the
literal outside that owner and five non-timer int32 bounds. The generated
MCP tool catalog is byte-identical.

* refactor(limits): keep the JVM processor-count bound separate from the timer bound

REA_JADX_ACTIVE_PROCESSOR_COUNT is a Java int count, not a timer delay, so it keeps its own named bound and a documented exception in the signed 32-bit guard. Remove the timer-bound and zod imports the duration-schema migration left unused.

* refactor(limits): keep the TShark packet-count bound separate from the timer bound

packet_limit is passed to TShark's -c as a C int packet count, not a timer delay, so it keeps its own named bound and a documented exception in the signed 32-bit guard.
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 16:40:03 +08:00
1 parent 6de147aa3f
commit 8443930bd3
55 files changed
+241 -269

No files matched your search

@@ -1,3 +1,4 @@
import { timerDurationMsSchema } from "../analysisResourceLimits.js";
import {
JAVASCRIPT_SEMANTIC_PRECISION_DEFAULTS,
javaScriptSemanticPrecisionSchema,
@@ -258,11 +259,7 @@ export const javaScriptAnalysisResourceControlsSchema = z.strictObject({
.describe(
"Maximum V8 old-space heap in MiB for the isolated JavaScript source analyzer; defaults to 1024. This does not change the CLI/MCP process heap. When REA runs on Bun, which ignores V8 heap flags, Windows instead limits the analyzer's committed memory to this budget plus a 512 MiB runtime reserve; other Bun hosts enforce no limit.",
),
analysis_timeout_ms: z
.number()
.int()
.min(1)
.max(2_147_483_647)
analysis_timeout_ms: timerDurationMsSchema
.optional()
.describe(
"Maximum startup, analysis and transfer time per JavaScript source, in milliseconds; defaults to 300000. On timeout, return collected partial Evidence and stop the analysis.",