[PR #1473] [MERGED] perf(artifacts): deliver the inspected artifact graph once #2911

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1473
Author: @kaoru0822-kitauji
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/10/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: perf/artifact-inspection-single-inventory


📝 Commits (1)

  • 09d9acd perf(artifacts): deliver the inspected artifact graph once

📊 Changes

3 files changed (+13 additions, -57 deletions)

View changed files

📝 src/contracts/artifactToolContracts.ts (+1 -1)
📝 src/domain/artifactInspection.ts (+3 -56)
📝 tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts (+9 -0)

📄 Description

Summary

inspect_artifact embedded the complete inventory Evidence in substeps[0].evidence and then copied it again into the same result:

  • every artifact node and every occurrence became an observations[] entry whose value was the full record, and
  • every graph edge became a derived_relationships[] entry.

No code reads those copies. compare_artifacts, the prompt guidance, and the boundary tests all read the nested inventory Evidence.

This change keeps that nested Evidence as the only copy of the graph:

  • observations now holds only the root-manifest summary (node, occurrence and edge counts) and integrity findings. The artifact and occurrence kinds are gone.
  • derived_relationships is removed, along with its relationships_retained / relationships_omitted coverage counters.
  • The tool description now says the graph comes back once, as the nested inventory Evidence.

Measured effect

rea inspect-artifact /Applications/Transmission.app --format json (630 nodes, 723 occurrences, 716 edges):

bytes
main 2,462,121
this branch 1,095,316 (−55%)

Over MCP the success result carries the JSON twice (once as structured content, once as escaped text), so the bytes saved there are roughly double. The result also stays under the stdio response budget for larger bundles than before.

Contract change

The advertised output schema of inspect_artifact changes: two observation kinds and derived_relationships are removed. Every removed value can still be read from normalized_result.substeps[0].evidence.normalized_result (nodes, occurrences, edges).

Verification

  • npm run test:focused -- tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts tests/boundary/providers/native/artifactProvider.directAnalysis.test.ts tests/boundary/mcp/artifactMcp.test.ts tests/boundary/mcp/artifactMcp.inlineInventory.test.ts tests/boundary/mcp/promptCompletion.test.ts tests/composition/analysis-sessions/artifactComparison.test.ts tests/boundary/cli/cliOutput.test.ts passes (33 tests).
  • A new assertion checks that the nested Evidence still holds every occurrence and that observations hold only the root manifest.
  • npm run check:fast and npm run docs:check pass.
  • I ran the CLI by hand against a real app bundle (Transmission.app) to get the numbers above.
  • No real Hopper or Ghidra verification was needed: the artifact graph provider is used alone.

🤖 Generated with Claude Code


🔄 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/1473 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/10/2026 **Status:** ✅ Merged **Merged:** 10/10/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `perf/artifact-inspection-single-inventory` --- ### 📝 Commits (1) - [`09d9acd`](https://github.com/morluto/rea/commit/09d9acd9201cac955c7d33ae1f8ecabb91510874) perf(artifacts): deliver the inspected artifact graph once ### 📊 Changes **3 files changed** (+13 additions, -57 deletions) <details> <summary>View changed files</summary> 📝 `src/contracts/artifactToolContracts.ts` (+1 -1) 📝 `src/domain/artifactInspection.ts` (+3 -56) 📝 `tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts` (+9 -0) </details> ### 📄 Description ## Summary `inspect_artifact` embedded the complete inventory Evidence in `substeps[0].evidence` and then copied it again into the same result: - every artifact node and every occurrence became an `observations[]` entry whose `value` was the full record, and - every graph edge became a `derived_relationships[]` entry. No code reads those copies. `compare_artifacts`, the prompt guidance, and the boundary tests all read the nested inventory Evidence. This change keeps that nested Evidence as the only copy of the graph: - `observations` now holds only the `root-manifest` summary (node, occurrence and edge counts) and `integrity` findings. The `artifact` and `occurrence` kinds are gone. - `derived_relationships` is removed, along with its `relationships_retained` / `relationships_omitted` coverage counters. - The tool description now says the graph comes back once, as the nested inventory Evidence. ## Measured effect `rea inspect-artifact /Applications/Transmission.app --format json` (630 nodes, 723 occurrences, 716 edges): | | bytes | |---|---| | main | 2,462,121 | | this branch | 1,095,316 (−55%) | Over MCP the success result carries the JSON twice (once as structured content, once as escaped text), so the bytes saved there are roughly double. The result also stays under the stdio response budget for larger bundles than before. ## Contract change The advertised output schema of `inspect_artifact` changes: two observation kinds and `derived_relationships` are removed. Every removed value can still be read from `normalized_result.substeps[0].evidence.normalized_result` (`nodes`, `occurrences`, `edges`). ## Verification - `npm run test:focused -- tests/boundary/providers/native/artifactProvider.archiveInventory.test.ts tests/boundary/providers/native/artifactProvider.directAnalysis.test.ts tests/boundary/mcp/artifactMcp.test.ts tests/boundary/mcp/artifactMcp.inlineInventory.test.ts tests/boundary/mcp/promptCompletion.test.ts tests/composition/analysis-sessions/artifactComparison.test.ts tests/boundary/cli/cliOutput.test.ts` passes (33 tests). - A new assertion checks that the nested Evidence still holds every occurrence and that observations hold only the root manifest. - `npm run check:fast` and `npm run docs:check` pass. - I ran the CLI by hand against a real app bundle (Transmission.app) to get the numbers above. - No real Hopper or Ghidra verification was needed: the artifact graph provider is used alone. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:11:44 +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#2911
No description provided.