perf(javascript): reuse graph buckets and query indexes

Append overlapping observations to node buckets instead of recopying groups, and share one node index across semantic seed admission and traversal. Preserve merged provenance and absent-seed behavior.
This commit is contained in:
morluto
2026-10-11 01:54:36 +08:00
parent e52c0a72c5
commit cf346368c4
4 changed files with 37 additions and 16 deletions
@@ -316,7 +316,7 @@ it("imports an operator-provided cache layer through an explicit file mapping",
const application = await applicationFixture();
const cache = await createTestTempDirectory("rea-runtime-cache-static-");
const runtimeCache = await createTestTempDirectory("rea-runtime-cache-live-");
const cacheSource = "export const cachedFeature = 'fixture';\n";
const cacheSource = SOURCE;
await mkdir(join(cache, "mapped"));
await Promise.all([
writeFile(join(cache, "mapped", "chunk.js"), cacheSource),
@@ -373,6 +373,16 @@ it("imports an operator-provided cache layer through an explicit file mapping",
status: "unknown",
reason: "layer-outside-runtime-scope",
});
const sharedFile = result.graph.nodes.find(
({ observations }) =>
observations.some(({ properties }) => properties.path === "app.js") &&
observations.some(
({ properties }) => properties.path === "mapped/chunk.js",
),
);
expect(
sharedFile?.observations.map(({ properties }) => properties.path),
).toEqual(expect.arrayContaining(["app.js", "mapped/chunk.js"]));
});
const applicationFixture = async (): Promise<string> => {