mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 09:34:20 +00:00
* fix(javascript): name heap and semantic ceilings Refs #5910. Heap exhaustion names max_heap_mb with its effective value, range, and next-analysis worker restart. Semantic ceiling coverage names the four max_semantic_* arguments. Wakaru and transfer ceilings say this release has no runtime override. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(javascript): distinguish adjustable ceilings from fixed limits The effective transfer file ceiling and the parent result budget follow the CLI/MCP process heap, so recovery names NODE_OPTIONS instead of denying an override. A provenance report over 8 MiB keeps the fixed allowance guidance, and the Wakaru deadline says an unchanged retry may hit it again. Refs #5910 Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(javascript): keep Bun OOM and checkpoint heap controls distinct Bun heap-exhaustion exits no longer claim the ignored max_heap_mb V8 old-space limit. Checkpoint decode names the parent heap and Node NODE_OPTIONS, the same control as the parent result budget. Refs #5910 Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(javascript): name semantic ceilings without claiming both were reached Truncated semantic retention names the total and per-file controls as effective ceilings. Callers only know that retention was truncated, so the limitation no longer says both ceilings were reached. Refs #5910 Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(javascript): name only the semantic ceiling that stopped retention Semantic ceiling limitations claimed both the application total and the per-file control whenever either one truncated the graph. Record which offered budget stopped node and unknown retention, and name only those controls. Coverage limits still list both effective values. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(javascript): require a value in the NODE_OPTIONS heap example A bare --max-old-space-size is an illegal V8 flag and prevents Node from starting. Parent-heap and transfer-ceiling recovery now share --max-old-space-size=<MiB>, and the Kuna heap remediation uses the same complete form. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(javascript): limit the old-space placeholder to NODE_OPTIONS recovery The review covers the CLI/MCP NODE_OPTIONS example and the transfer-ceiling copy. The Kuna heap-headroom sentence stays unchanged. Co-authored-by: morluto <morluto@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com>
86 lines
3.2 KiB
TypeScript
86 lines
3.2 KiB
TypeScript
import { z } from "zod";
|
|
import { ANALYSIS_RESOURCE_KINDS } from "../../domain/analysisErrorCore.js";
|
|
import { jsonValueSchema } from "../../domain/jsonValue.js";
|
|
import { digestSchema } from "../../domain/digests.js";
|
|
import {
|
|
JAVASCRIPT_ANALYSIS_RESOURCE_DEFAULTS,
|
|
JAVASCRIPT_SEMANTIC_ITEM_MAXIMUM,
|
|
} from "../../domain/javascript/javascriptAnalysisResourceControls.js";
|
|
import { javaScriptAnalysisTransferDescriptorSchema } from "./JavaScriptAnalysisTransfer.js";
|
|
|
|
/** Independent worker execution budget; source length is not an admission rule. */
|
|
export const JAVASCRIPT_ANALYSIS_WORKER_DEFAULTS = {
|
|
...JAVASCRIPT_ANALYSIS_RESOURCE_DEFAULTS,
|
|
checkpointBytes: 8 * 1024 * 1024,
|
|
protocolBytes: 64 * 1024,
|
|
} as const;
|
|
|
|
/** The static checkpoint byte ceiling has no caller argument. */
|
|
export const javaScriptCheckpointCeilingRemediation = (
|
|
checkpointBytes: number,
|
|
): string =>
|
|
`The JavaScript static checkpoint ceiling is ${String(checkpointBytes)} bytes. This release has no runtime override. Raising max_heap_mb does not raise it. Paging or exporting session Evidence does not admit the omitted checkpoint.`;
|
|
|
|
/** Caller-selected artifact identity, separate from the decoded source-text digest. */
|
|
export const javaScriptWorkerRequestSchema = z.strictObject({
|
|
id: z.uuid(),
|
|
unknown_budget: z.number().int().min(0).max(JAVASCRIPT_SEMANTIC_ITEM_MAXIMUM),
|
|
node_budget: z.number().int().min(0).max(JAVASCRIPT_SEMANTIC_ITEM_MAXIMUM),
|
|
text_sha256: digestSchema,
|
|
file: z.strictObject({
|
|
path: z.string(),
|
|
sha256: digestSchema,
|
|
container_sha256: digestSchema,
|
|
bytes: z.number().int().nonnegative(),
|
|
inventory_artifact_id: z.string(),
|
|
kind: z.literal("javascript"),
|
|
unpacked: z.boolean(),
|
|
}),
|
|
});
|
|
|
|
/** Parent admission after validated static observations have been retained. */
|
|
export const javaScriptWorkerAdmissionSchema = z.strictObject({
|
|
id: z.uuid(),
|
|
semantic_result_budget_bytes: z.number().int().nonnegative(),
|
|
});
|
|
|
|
const identity = { id: z.uuid() };
|
|
|
|
/** Control frames never contain AST, full IR, graph rows or source text. */
|
|
export const javaScriptWorkerMessageSchema = z.discriminatedUnion("kind", [
|
|
z.strictObject({
|
|
kind: z.literal("ready"),
|
|
// Null when the worker runtime (Bun) does not enforce V8 heap flags.
|
|
heap_limit_bytes: z.number().int().positive().nullable(),
|
|
}),
|
|
z.strictObject({
|
|
kind: z.literal("phase"),
|
|
...identity,
|
|
phase: z.enum(["parse", "static", "semantic", "projection", "transfer"]),
|
|
}),
|
|
z.strictObject({
|
|
kind: z.literal("static"),
|
|
...identity,
|
|
bytes: z.number().int().nonnegative(),
|
|
sha256: digestSchema,
|
|
}),
|
|
z.strictObject({
|
|
kind: z.literal("complete"),
|
|
...identity,
|
|
descriptor: javaScriptAnalysisTransferDescriptorSchema.nullable(),
|
|
}),
|
|
z.strictObject({
|
|
kind: z.literal("failure"),
|
|
...identity,
|
|
reason: z.enum(["resource", "output", "io"]),
|
|
resource: z.enum(ANALYSIS_RESOURCE_KINDS).nullable(),
|
|
limits: z.record(z.string(), jsonValueSchema).nullable(),
|
|
message: z.string(),
|
|
}),
|
|
]);
|
|
|
|
/** One decoded control frame from the independently owned worker. */
|
|
export type JavaScriptWorkerMessage = z.output<
|
|
typeof javaScriptWorkerMessageSchema
|
|
>;
|