[PR #5815] [MERGED] perf(rust): query selected dependency facts from retained Evidence #7081

Closed
opened 2026-11-01 21:45:15 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5815
Author: @gensokyo-dev
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @gensokyo-dev

Base: main ← Head: perf/5802-rust-dependency-views


📝 Commits (2)

  • cc83fd1 perf(rust): query selected dependency facts from retained Evidence
  • d8225c5 docs(perf): record Rust dependency task measurements

📊 Changes

24 files changed (+2192 additions, -74 deletions)

View changed files

📝 .agents/skills/reverse-engineer-anything/SKILL.md (+6 -0)
📝 docs/rust-binaries.md (+61 -0)
📝 experiments/analysis-efficiency/corpus.json (+32 -0)
➕ experiments/analysis-efficiency/rust-dependency-costs.py (+79 -0)
➕ experiments/analysis-efficiency/rust-dependency-views.json (+578 -0)
➕ experiments/analysis-efficiency/rust-dependency-views.md (+176 -0)
➕ experiments/analysis-efficiency/rust-dependency-views.mjs (+172 -0)
📝 src/application/rust/RustBinaryService.test.ts (+69 -2)
📝 src/application/rust/RustBinaryService.ts (+29 -20)
📝 src/cli/rustCommands.ts (+68 -15)
📝 src/contracts/analysisViewToolContracts.ts (+1 -1)
📝 src/contracts/rust/rustToolContracts.ts (+15 -6)
📝 src/domain/analysisView/analysisView.ts (+29 -0)
📝 src/domain/analysisView/goBinaryView.ts (+3 -19)
➕ src/domain/analysisView/rustBinaryView.test.ts (+173 -0)
➕ src/domain/analysisView/rustBinaryView.ts (+277 -0)
➕ src/domain/analysisView/selectViewRows.ts (+17 -0)
📝 src/domain/rust/rustBinary.ts (+15 -0)
➕ src/domain/rust/rustBinaryQuery.ts (+69 -0)
📝 src/server/createServer.ts (+1 -0)

...and 4 more files

📄 Description

Summary

Fixes #5802. A question about two embedded Rust crates previously returned every package and edge. Add opt-in first-call package/edge selection, summary delivery and retained queries to the existing CLI/MCP workflows; complete delivery and original Evidence identity stay unchanged.

For shipped Alpine Zellij (422 packages/1,063 edges), selecting serde and serde_derive returns their exact versions/sources/direct references in one call. The complete MCP inspect response shrinks 185,833 → 9,261 bytes, with the full parent still exportable.

Change and scope

The Rust domain owns exact intersecting filters, fields and matching-row pagination; both adapters use the shared Evidence projection/application layer. Indices retain original identity within the parent. Dependency vectors require explicit field selection. The small pager is shared with Go. Successful immutable-Evidence interpretation is reused only for that object's lifetime; mutable imports revalidate and every view checks subject identity.

Existing read-only ELF/PE/thin-Mach-O scope; maintainer decision not applicable. Missing sections, inferred compiler facts and unknown runtime coverage remain explicit. CLI compact delivery requires an exclusive Evidence output bundle. Existing provider limits/admission, complete graph construction and full-file reads remain. No new provider/tool, target execution, installation or dependency change. Authored guide/skill/contracts updated; generated catalogs/skills stay ignored.

Expected effects:

  • Read existing files or captured data.
  • Change files: only caller-selected Evidence outputs through existing publication/export paths.

Evidence and regression coverage

Measured task, corpus, raw-receipt hashes and limitations: official Alpine ripgrep 14.1.1 and Zellij 0.40.0, independently checked with GNU section extraction and Python zlib/JSON. Every package/edge, root/cycle result, section range, digest and complete exported parent matches. Applications were not executed.

Both lanes use two actual stdio SDK calls: inspect and export. Three alternating pairs per binary, bounded to one CPU/4 GiB. Offline cl100k estimates including all 212 input definitions once and all calls: Zellij 223,755 → 199,584 (−10.8%); ripgrep 200,603 → 199,584 (−0.5%). Full transport/output-schema accounting makes the small case more expensive. These are estimates, not model usage or a measured agent-host prompt.

Whole-task Zellij wall/CPU medians rise 4.957/4.782 → 5.671/5.441 seconds; diagnostic complete/selected controls show startup variation and do not isolate persistent compact-projection overhead. Peak family memory 610.3 → 604.3 MiB; ripgrep 569.0 → 587.3 MiB. No stable speedup or memory improvement claimed. All measured runs qualify exit/cleanup with zero resource events. The speculative JSON-sizing change was reverted after inconsistent results.

Tests exercise duplicate versions, both endpoint filters, empty selection, field omission, pagination, portable/retained reads after source deletion, immutable-cache trust, subject mismatch, malformed imports, missing metadata and delivery validation. Real shipped PE/Mach-O, larger graphs, warm retained-query performance and actual AI inference remain unmeasured.

  • Observed, derived and inferred claims remain distinguishable.
  • Artifact identity, source provenance and failed attempts remain preserved.
  • Unsupported, incomplete and uncertain outcomes remain visible.

Validation performed

  • npm run build:cached and npm run check — passed on measured source and the final rebased integration branch (typecheck, lint, format, knip, module/architecture guards).
  • Final rebased focused cohort: 144 tests / 13 files passed, including actual CLI/stdio SDK. Initial single-CPU mixed Go/Rust timeout passed in a two-CPU/4-GiB rerun without changing its timeout.
  • 12 real SDK task samples plus six diagnostic controls — passed complete parent/answer/source equality and qualified cleanup.
  • npm run docs:check and npm run verify:test-discovery — passed on the integration branch.
  • Final rebased real-artifact verification: SDK selected inspection/export on both binaries, plus CLI compact publication and portable Evidence-file queries on both — all passed; complete parents/selected facts/digests match, with qualified cleanup and zero resource events.

GitHub CI: static, source tests, build, docs, tool quality, package baseline and six integration shards passed. Shard 4 fails the existing WASM CLI schema assertion below; shard 7 was cancelled. No full-CI-green claim. The same sole assertion reproduces on untouched base a5f982de8 and PR head; Rust changed paths are outside that producer/test. Codex reports no findings and Greptile scores 5/5. All Rust CLI/MCP/format and new view acceptance specifications passed in CI. Merge uses the owner-authorized admin bypass for the unrelated base failure.

inspect-wasm-artifact options: advertised [], parser rejects [commandTimeoutMs]

Author readiness

Human owner: @gensokyo-dev

The following owner declarations are transcribed at the human owner's explicit standing instruction in this session. This records that instruction, not an independently witnessed human review by the agent.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/5815 **Author:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Base:** `main` ← **Head:** `perf/5802-rust-dependency-views` --- ### 📝 Commits (2) - [`cc83fd1`](https://github.com/morluto/rea/commit/cc83fd1ee3827861ea94d0e8f325e4521323bc89) perf(rust): query selected dependency facts from retained Evidence - [`d8225c5`](https://github.com/morluto/rea/commit/d8225c5f2d1fd28e04a8a369b76c17d726b19896) docs(perf): record Rust dependency task measurements ### 📊 Changes **24 files changed** (+2192 additions, -74 deletions) <details> <summary>View changed files</summary> 📝 `.agents/skills/reverse-engineer-anything/SKILL.md` (+6 -0) 📝 `docs/rust-binaries.md` (+61 -0) 📝 `experiments/analysis-efficiency/corpus.json` (+32 -0) ➕ `experiments/analysis-efficiency/rust-dependency-costs.py` (+79 -0) ➕ `experiments/analysis-efficiency/rust-dependency-views.json` (+578 -0) ➕ `experiments/analysis-efficiency/rust-dependency-views.md` (+176 -0) ➕ `experiments/analysis-efficiency/rust-dependency-views.mjs` (+172 -0) 📝 `src/application/rust/RustBinaryService.test.ts` (+69 -2) 📝 `src/application/rust/RustBinaryService.ts` (+29 -20) 📝 `src/cli/rustCommands.ts` (+68 -15) 📝 `src/contracts/analysisViewToolContracts.ts` (+1 -1) 📝 `src/contracts/rust/rustToolContracts.ts` (+15 -6) 📝 `src/domain/analysisView/analysisView.ts` (+29 -0) 📝 `src/domain/analysisView/goBinaryView.ts` (+3 -19) ➕ `src/domain/analysisView/rustBinaryView.test.ts` (+173 -0) ➕ `src/domain/analysisView/rustBinaryView.ts` (+277 -0) ➕ `src/domain/analysisView/selectViewRows.ts` (+17 -0) 📝 `src/domain/rust/rustBinary.ts` (+15 -0) ➕ `src/domain/rust/rustBinaryQuery.ts` (+69 -0) 📝 `src/server/createServer.ts` (+1 -0) _...and 4 more files_ </details> ### 📄 Description ## Summary Fixes #5802. A question about two embedded Rust crates previously returned every package and edge. Add opt-in first-call package/edge selection, summary delivery and retained queries to the existing CLI/MCP workflows; complete delivery and original Evidence identity stay unchanged. For shipped Alpine Zellij (422 packages/1,063 edges), selecting `serde` and `serde_derive` returns their exact versions/sources/direct references in one call. The complete MCP inspect response shrinks 185,833 → 9,261 bytes, with the full parent still exportable. ## Change and scope The Rust domain owns exact intersecting filters, fields and matching-row pagination; both adapters use the shared Evidence projection/application layer. Indices retain original identity within the parent. Dependency vectors require explicit field selection. The small pager is shared with Go. Successful immutable-Evidence interpretation is reused only for that object's lifetime; mutable imports revalidate and every view checks subject identity. Existing read-only ELF/PE/thin-Mach-O scope; maintainer decision not applicable. Missing sections, inferred compiler facts and unknown runtime coverage remain explicit. CLI compact delivery requires an exclusive Evidence output bundle. Existing provider limits/admission, complete graph construction and full-file reads remain. No new provider/tool, target execution, installation or dependency change. Authored guide/skill/contracts updated; generated catalogs/skills stay ignored. Expected effects: - [x] Read existing files or captured data. - [x] Change files: only caller-selected Evidence outputs through existing publication/export paths. ## Evidence and regression coverage [Measured task, corpus, raw-receipt hashes and limitations](https://github.com/morluto/rea/blob/d8225c5f2d1fd28e04a8a369b76c17d726b19896/experiments/analysis-efficiency/rust-dependency-views.md): official Alpine ripgrep 14.1.1 and Zellij 0.40.0, independently checked with GNU section extraction and Python zlib/JSON. Every package/edge, root/cycle result, section range, digest and complete exported parent matches. Applications were not executed. Both lanes use two actual stdio SDK calls: inspect and export. Three alternating pairs per binary, bounded to one CPU/4 GiB. Offline cl100k estimates including all 212 input definitions once and all calls: Zellij 223,755 → 199,584 (−10.8%); ripgrep 200,603 → 199,584 (−0.5%). Full transport/output-schema accounting makes the small case more expensive. These are estimates, not model usage or a measured agent-host prompt. Whole-task Zellij wall/CPU medians rise 4.957/4.782 → 5.671/5.441 seconds; diagnostic complete/selected controls show startup variation and do not isolate persistent compact-projection overhead. Peak family memory 610.3 → 604.3 MiB; ripgrep 569.0 → 587.3 MiB. No stable speedup or memory improvement claimed. All measured runs qualify exit/cleanup with zero resource events. The speculative JSON-sizing change was reverted after inconsistent results. Tests exercise duplicate versions, both endpoint filters, empty selection, field omission, pagination, portable/retained reads after source deletion, immutable-cache trust, subject mismatch, malformed imports, missing metadata and delivery validation. Real shipped PE/Mach-O, larger graphs, warm retained-query performance and actual AI inference remain unmeasured. - [x] Observed, derived and inferred claims remain distinguishable. - [x] Artifact identity, source provenance and failed attempts remain preserved. - [x] Unsupported, incomplete and uncertain outcomes remain visible. ## Validation performed - `npm run build:cached` and `npm run check` — passed on measured source and the final rebased integration branch (typecheck, lint, format, knip, module/architecture guards). - Final rebased focused cohort: 144 tests / 13 files passed, including actual CLI/stdio SDK. Initial single-CPU mixed Go/Rust timeout passed in a two-CPU/4-GiB rerun without changing its timeout. - 12 real SDK task samples plus six diagnostic controls — passed complete parent/answer/source equality and qualified cleanup. - `npm run docs:check` and `npm run verify:test-discovery` — passed on the integration branch. - Final rebased real-artifact verification: SDK selected inspection/export on both binaries, plus CLI compact publication and portable Evidence-file queries on both — all passed; complete parents/selected facts/digests match, with qualified cleanup and zero resource events. GitHub CI: static, source tests, build, docs, tool quality, package baseline and six integration shards passed. Shard 4 fails the existing WASM CLI schema assertion below; shard 7 was cancelled. No full-CI-green claim. The same sole assertion reproduces on untouched base `a5f982de8` and PR head; Rust changed paths are outside that producer/test. Codex reports no findings and Greptile scores 5/5. All Rust CLI/MCP/format and new view acceptance specifications passed in CI. Merge uses the owner-authorized admin bypass for the unrelated base failure. ```text inspect-wasm-artifact options: advertised [], parser rejects [commandTimeoutMs] ``` ## Author readiness Human owner: @gensokyo-dev The following owner declarations are transcribed at the human owner's explicit standing instruction in this session. This records that instruction, not an independently witnessed human review by the agent. - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:45:15 +00:00
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#7081
No description provided.