mirror of
https://github.com/morluto/rea
synced 2026-10-26 14:25:49 -04:00
fix(javascript): bound static getter reference expansion
Replace recursive getter histories with a query-owned worklist and memo. Bound precise expansion at 512 states and widen growing receiver cycles; retain escaped roots and constructed children rather than silently dropping suffixes. Carry the resource limit through semantic coverage, worker transport and graph Evidence while preserving direct writes, imports and unrelated literal facts. The small source probe reduced 65/326 paths to one widened reference for five and six getters. The original large Claude artifact was not rerun. Validate receiver/alias/mutation controls and compiled CLI/MCP consumers. Refs #3839, #3848 Co-authored-by: Yi Han <yhan606@aucklanduni.ac.nz>
This commit is contained in:
@@ -1,7 +1,32 @@
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import { analyzeJavaScriptStaticSource } from "../../domain/javascript/javascriptStaticAnalysis.js";
|
||||
import { javaScriptWorkerStaticAnalysisSchema } from "./JavaScriptAnalysisWorkerSchemas.js";
|
||||
import {
|
||||
javaScriptWorkerModuleHeaderSchema,
|
||||
javaScriptWorkerModuleRecordSchema,
|
||||
javaScriptWorkerStaticAnalysisSchema,
|
||||
} from "./JavaScriptAnalysisWorkerSchemas.js";
|
||||
import { analyzeJavaScriptSemantics } from "../../domain/javascript/javascriptSemanticAnalysis.js";
|
||||
import { getterExpansionSource } from "../../../tests/fixtures/javascriptGetterExpansion.js";
|
||||
|
||||
it("transfers getter expansion limits and unknown bindings across the worker boundary", () => {
|
||||
const ir = analyzeJavaScriptSemantics(getterExpansionSource());
|
||||
const header = { coverage: ir.coverage, limitations: ir.limitations };
|
||||
expect(
|
||||
javaScriptWorkerModuleHeaderSchema.parse(
|
||||
JSON.parse(JSON.stringify(header)) as unknown,
|
||||
),
|
||||
).toEqual(header);
|
||||
for (const value of ir.bindings) {
|
||||
const record = { kind: "binding", value };
|
||||
expect(
|
||||
javaScriptWorkerModuleRecordSchema.parse(
|
||||
JSON.parse(JSON.stringify(record)) as unknown,
|
||||
),
|
||||
).toEqual(record);
|
||||
}
|
||||
expect(ir.coverage.resourceLimits).toEqual(["getter-expansion"]);
|
||||
});
|
||||
|
||||
it("retains candidate endpoint interpretation across the worker boundary", () => {
|
||||
const facts = analyzeJavaScriptStaticSource(`
|
||||
|
||||
@@ -417,6 +417,7 @@ const resourceLimit = z.enum([
|
||||
"primitive-candidates",
|
||||
"primitive-bytes",
|
||||
"expression-depth",
|
||||
"getter-expansion",
|
||||
]);
|
||||
const primitive = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
||||
const property: z.ZodType<JavaScriptSemanticProperty> = z.lazy(() =>
|
||||
|
||||
Reference in New Issue
Block a user