[GH-ISSUE #4810] perf(analysis-view): reuse validated immutable parents after Evidence import #2501

Closed
opened 2026-10-17 21:05:49 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @N0zoM1z0 on GitHub (Oct 17, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/4810

Area

Evidence, artifacts, or reconstruction; MCP retained analysis views.

Observed behavior

During #3134 verification on main f4322b15ed1423d736bd2572cf7a8eadf2b466e1, an authentic npm JavaScript analysis was exported, imported into a fresh production stdio MCP server, then queried repeatedly with inspect_analysis_view module pages of two rows. The resumed pages cost 1.05–1.46 seconds each across three traversals. In the original producer session, warm two-row pages cost 8–31 ms (first page 119 ms). This compares different retained states, not equivalent whole-task speedup measurements.

The source is the installed public npm distribution bundled with our pinned Node toolchain, explicitly selecting package.json, bin/npm-cli.js, lib/cli.js, lib/cli/entry.js and lib/commands/install.js. Source selection preserves 1,416 unselected files as unknown. The authentic bundle is ~21 MB, with 2,822 application nodes, 1,796 semantic nodes and 13,682 semantic unknowns. Target inventory digest: f8e576a7d162542c616168b25a95a5f62b9accf29467cc37e149905ad4b8e603.

An authentic SQLite ELF layout (SHA-256 2e6eef9a727f081f0d453b4e5e6cbd8b9ef8b6f86cbf7681cbad444d3b0b55c8; 1,479 symbols/2,963 relocations) also reparses the complete layout for each selected page; resumed warmed pages measured 30–70 ms in one task. Its owner should be included in the same narrow investigation, with benefits assessed independently.

Reproduction

  1. Build the pinned main with Node 24.18.0/npm 11.16.0.
  2. Run analyze_javascript_application with the five exact source_paths above and detail summary. Export its authentic Evidence bundle.
  3. In a fresh server, import the unchanged bundle. Discover its original Evidence ID using get_evidence_bundle detail summary.
  4. Request modules at offsets 0/2/4, limit 2, three times. Preserve original source Evidence/Unknowns and export again to verify them. #3134 records the full task and actual-agent comparisons separately.

Source-derived cause and implementation proposal

parseOwnedJavaScriptApplicationAnalysisSteps can reuse realm-private graph proofs from the original producer. Imported immutable Evidence lacks those format proofs, so every view repeats complete schema/hash/binding validation. Native layout views likewise invoke binaryLayoutSchema.safeParse on every page.

Propose one successful validated interpretation per exact immutable source object at its format owner. Recognize immutability only through existing realm-private proofs; validate imported/mutable/merely frozen data normally. Keep the key, lifetime and retained representation size explicit, avoid provider reruns, and release entries with the owning source. Do not cache failures or add a public projection API, implicit persistence, live-state cache or changed default.

Expected behavior / acceptance

  • Preserve exact existing outputs, Evidence IDs/links, omission/null/scalar distinctions, errors and coverage on original and imported sources.
  • Mutable input mutations and forged freeze/ownership hints cannot reuse stale validation; malformed imported content must still fail.
  • Cache admission occurs only after complete successful validation; cancellation/abandoned generators must not publish incomplete proofs.
  • Compare equivalent public SDK queries before/after on both authentic histories plus a small case; measure cold/warm time, CPU, process-family memory, retained-state cost and cleanup. Token reduction is not assumed when schemas/results are unchanged.

Scope, runtime and limits

Existing static local analysis and retained Evidence only; no target execution, mutation, new provider or protection recovery. Linux x86-64, Node 24.18.0/npm 11.16.0. Heavy tasks run serially under one CPU, 8 GiB hard family memory/no swap and 7 GiB early stop; observed resumed SDK peaks were ~0.84–1.09 GiB, zero OOM. Other hosts and benefits from the proposed correction remain unverified. Related open-issue search found #3134 and broad #4027, but no matching implementation owner.

Originally created by @N0zoM1z0 on GitHub (Oct 17, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/4810 ### Area Evidence, artifacts, or reconstruction; MCP retained analysis views. ### Observed behavior During #3134 verification on main `f4322b15ed1423d736bd2572cf7a8eadf2b466e1`, an authentic npm JavaScript analysis was exported, imported into a fresh production stdio MCP server, then queried repeatedly with `inspect_analysis_view` module pages of two rows. The resumed pages cost 1.05–1.46 seconds each across three traversals. In the original producer session, warm two-row pages cost 8–31 ms (first page 119 ms). This compares different retained states, not equivalent whole-task speedup measurements. The source is the installed public npm distribution bundled with our pinned Node toolchain, explicitly selecting package.json, bin/npm-cli.js, lib/cli.js, lib/cli/entry.js and lib/commands/install.js. Source selection preserves 1,416 unselected files as unknown. The authentic bundle is ~21 MB, with 2,822 application nodes, 1,796 semantic nodes and 13,682 semantic unknowns. Target inventory digest: f8e576a7d162542c616168b25a95a5f62b9accf29467cc37e149905ad4b8e603. An authentic SQLite ELF layout (SHA-256 2e6eef9a727f081f0d453b4e5e6cbd8b9ef8b6f86cbf7681cbad444d3b0b55c8; 1,479 symbols/2,963 relocations) also reparses the complete layout for each selected page; resumed warmed pages measured 30–70 ms in one task. Its owner should be included in the same narrow investigation, with benefits assessed independently. ### Reproduction 1. Build the pinned main with Node 24.18.0/npm 11.16.0. 2. Run `analyze_javascript_application` with the five exact source_paths above and detail summary. Export its authentic Evidence bundle. 3. In a fresh server, import the unchanged bundle. Discover its original Evidence ID using get_evidence_bundle detail summary. 4. Request modules at offsets 0/2/4, limit 2, three times. Preserve original source Evidence/Unknowns and export again to verify them. #3134 records the full task and actual-agent comparisons separately. ### Source-derived cause and implementation proposal `parseOwnedJavaScriptApplicationAnalysisSteps` can reuse realm-private graph proofs from the original producer. Imported immutable Evidence lacks those format proofs, so every view repeats complete schema/hash/binding validation. Native layout views likewise invoke binaryLayoutSchema.safeParse on every page. Propose one successful validated interpretation per exact immutable source object at its format owner. Recognize immutability only through existing realm-private proofs; validate imported/mutable/merely frozen data normally. Keep the key, lifetime and retained representation size explicit, avoid provider reruns, and release entries with the owning source. Do not cache failures or add a public projection API, implicit persistence, live-state cache or changed default. ### Expected behavior / acceptance - Preserve exact existing outputs, Evidence IDs/links, omission/null/scalar distinctions, errors and coverage on original and imported sources. - Mutable input mutations and forged freeze/ownership hints cannot reuse stale validation; malformed imported content must still fail. - Cache admission occurs only after complete successful validation; cancellation/abandoned generators must not publish incomplete proofs. - Compare equivalent public SDK queries before/after on both authentic histories plus a small case; measure cold/warm time, CPU, process-family memory, retained-state cost and cleanup. Token reduction is not assumed when schemas/results are unchanged. ### Scope, runtime and limits Existing static local analysis and retained Evidence only; no target execution, mutation, new provider or protection recovery. Linux x86-64, Node 24.18.0/npm 11.16.0. Heavy tasks run serially under one CPU, 8 GiB hard family memory/no swap and 7 GiB early stop; observed resumed SDK peaks were ~0.84–1.09 GiB, zero OOM. Other hosts and benefits from the proposed correction remain unverified. Related open-issue search found #3134 and broad #4027, but no matching implementation owner.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2501
No description provided.