[PR #965] [MERGED] refactor(binary): move production composition outside application workflows #2539

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/965
Author: @N0zoM1z0
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @N0zoM1z0

Base: main ← Head: refactor/binary-production-composition


📝 Commits (1)

  • cdcec11 refactor(binary): move production composition outside application workflows

📊 Changes

34 files changed (+359 additions, -76 deletions)

View changed files

📝 docs/adr/0001-provider-selection-and-analysis-profiles.md (+1 -1)
📝 docs/architecture.mermaid (+13 -4)
📝 docs/capability-migration.md (+38 -19)
📝 scripts/lib/module-boundaries.mjs (+3 -1)
📝 src/application/DirectAnalysis.ts (+23 -17)
➕ src/application/DirectAnalysisDependencies.ts (+12 -0)
📝 src/application/DirectAnalysisStatus.ts (+7 -4)
📝 src/cli/artifactCommands.ts (+1 -1)
📝 src/cli/coreBinaryCommands.ts (+1 -1)
📝 src/cli/coreNativeCommands.ts (+1 -1)
📝 src/cli/managedCommands.ts (+1 -1)
📝 src/cli/utilityCommands.ts (+1 -1)
📝 src/cliEnvironmentSeam.test.ts (+1 -1)
📝 src/composition/binary.ts (+6 -6)
➕ src/composition/directAnalysis.ts (+46 -0)
📝 src/main.ts (+1 -1)
📝 src/server/registerManagedTools.ts (+1 -1)
📝 tests/boundary/filesystem/directAnalysisPermissions.test.ts (+1 -1)
📝 tests/boundary/filesystem/runtimeIdentification.test.ts (+1 -1)
📝 tests/boundary/mcp/artifactEntryOrderMcp.test.ts (+1 -1)

...and 14 more files

📄 Description

Summary

Finish the binary production-composition boundary for #740. The former application runtime directly constructed concrete providers and required a special inward-dependency exception. Shared application workflows now receive the same two session factories; CLI and MCP use bound production entrypoints.

Problem and expected behavior

Moving runtime alone would make DirectAnalysis and status depend outward on composition. Preserve one-shot CLI isolation, managed-only execution, MCP connection state, selected configuration, snapshots, Evidence and finally-close while removing concrete provider creation from reusable workflows.

Change and scope

  • Move the unchanged binary and managed session factories to composition/binary. Bind their existing caller signatures in composition/directAnalysis; binding acquires no session or engine and retains no analysis state.
  • Supply the two factories explicitly through DirectAnalysisDependencies, using the existing BinarySession type and replay policy. Migrate all CLI/MCP, source and compiled fixture consumers.
  • Remove the exact application/runtime guard exception and reject six concrete production providers in application/server. Update ownership guidance, the component map and ADR link.

Contract and boundary impact

  • Semantic owner and earliest changed stage: production construction and application dependency injection.
  • CLI and MCP/tool-catalog contract: unchanged names, schemas, results and caller signatures.
  • Provider, bridge, target-format, or platform compatibility: unchanged constructor bodies, deep selection, lazy auxiliary and managed-only composition; no expanded platform claim.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged subjects, profiles, replay policy, recording and errors.
  • Process execution, authorization, cleanup, or containment impact: original cancellation and finally-close retained; no new permission/configuration fields.
  • Generated metadata, package, or installation impact: committed generated outputs unchanged; compiled fixture imports follow the new owner.

Evidence and regression coverage

  • Six real-BinarySession fixture cases cover independent calls, success/failure cleanup, cancellation before acquisition, managed/native isolation and selected/malformed configuration.
  • Seven guard cases reject the former exception and concrete application/server construction while admitting production composition.
  • Exact body/import/file-URL review confirms all 24 mechanical modules, including the moved production constructor, preserve implementations. The explicit dependency injection and binding diff was reviewed separately.
  • Remaining proof gaps: no fresh proprietary Hopper/IDA execution; one macOS-only focused case is deferred to native CI.

For evidence-bearing changes:

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

Validation performed

  • Five static gates, fresh docs/build checks passed.
  • 199 focused cases passed across 31 suites, one macOS case skipped; actual CLI/MCP SDK, canonical/reordered presentation, selection, snapshot and optional failure isolation included.
  • All 540 test files discovered exactly once. Generated catalog/managed commitments unchanged.
  • Existing Ghidra 12.1.4 and JDK: actual CLI plus six MCP operations, decompiler, file-byte oracle, caller-working-directory preservation and runtime cleanup passed. Source-owned fixture was analyzed without execution. Two-CPU supervised family peak RSS: 1090641920 bytes; no owned processes left.
  • npm run verify:package: isolated installation, CLI/MCP analysis and Evidence, setup/backups/recovery/update and lifecycle passed; 131 tools and six prompts. No owned descendants remained and the temporary tarball was cleaned. Sampled MCP RSS 367149056 bytes; observed tools/list startup 1863.01 ms, without a comparative performance claim.
  • All 22 final-head CI checks passed at cdcec115, including both macOS native package/Inspector baselines, Linux x64/arm64, Windows, real Apple, source tests and coverage. Compiled production/workflow entrypoints are present and former runtime outputs are absent.

Compatibility, safety, and release

  • Breaking changes or migration steps: internal application callers supply factories; public adapters retain their prior signatures. No compatibility barrel at the former runtime path.
  • Real Hopper/Ghidra, browser, or OS coverage: real bounded Linux Ghidra as above; recording seams establish their narrower composition claims. Native package/platform CI remains required.
  • Package or release metadata impact: no dependency/version changes.
  • Security, privacy, process, or containment review: serial heavy lanes, two CPUs, one worker, bounded heaps and owned cleanup; no Windows disk writes, installations or GUI changes. Public examples and source references contain no private paths.

Review checklist

  • Focused outcome and Conventional Commit title.
  • Tracking issue linked.
  • Meaningful failure and cleanup boundaries tested.
  • Owning docs and compiled fixture paths updated.
  • Public CLI/MCP meaning and generated metadata verified.
  • Final diff checked for unrelated changes 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/965 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `refactor/binary-production-composition` --- ### 📝 Commits (1) - [`cdcec11`](https://github.com/morluto/rea/commit/cdcec1152d526ff4d2b32be7c68551219805218c) refactor(binary): move production composition outside application workflows ### 📊 Changes **34 files changed** (+359 additions, -76 deletions) <details> <summary>View changed files</summary> 📝 `docs/adr/0001-provider-selection-and-analysis-profiles.md` (+1 -1) 📝 `docs/architecture.mermaid` (+13 -4) 📝 `docs/capability-migration.md` (+38 -19) 📝 `scripts/lib/module-boundaries.mjs` (+3 -1) 📝 `src/application/DirectAnalysis.ts` (+23 -17) ➕ `src/application/DirectAnalysisDependencies.ts` (+12 -0) 📝 `src/application/DirectAnalysisStatus.ts` (+7 -4) 📝 `src/cli/artifactCommands.ts` (+1 -1) 📝 `src/cli/coreBinaryCommands.ts` (+1 -1) 📝 `src/cli/coreNativeCommands.ts` (+1 -1) 📝 `src/cli/managedCommands.ts` (+1 -1) 📝 `src/cli/utilityCommands.ts` (+1 -1) 📝 `src/cliEnvironmentSeam.test.ts` (+1 -1) 📝 `src/composition/binary.ts` (+6 -6) ➕ `src/composition/directAnalysis.ts` (+46 -0) 📝 `src/main.ts` (+1 -1) 📝 `src/server/registerManagedTools.ts` (+1 -1) 📝 `tests/boundary/filesystem/directAnalysisPermissions.test.ts` (+1 -1) 📝 `tests/boundary/filesystem/runtimeIdentification.test.ts` (+1 -1) 📝 `tests/boundary/mcp/artifactEntryOrderMcp.test.ts` (+1 -1) _...and 14 more files_ </details> ### 📄 Description ## Summary Finish the binary production-composition boundary for #740. The former application runtime directly constructed concrete providers and required a special inward-dependency exception. Shared application workflows now receive the same two session factories; CLI and MCP use bound production entrypoints. ## Problem and expected behavior Moving runtime alone would make DirectAnalysis and status depend outward on composition. Preserve one-shot CLI isolation, managed-only execution, MCP connection state, selected configuration, snapshots, Evidence and finally-close while removing concrete provider creation from reusable workflows. ## Change and scope - Move the unchanged binary and managed session factories to composition/binary. Bind their existing caller signatures in composition/directAnalysis; binding acquires no session or engine and retains no analysis state. - Supply the two factories explicitly through DirectAnalysisDependencies, using the existing BinarySession type and replay policy. Migrate all CLI/MCP, source and compiled fixture consumers. - Remove the exact application/runtime guard exception and reject six concrete production providers in application/server. Update ownership guidance, the component map and ADR link. ## Contract and boundary impact - Semantic owner and earliest changed stage: production construction and application dependency injection. - CLI and MCP/tool-catalog contract: unchanged names, schemas, results and caller signatures. - Provider, bridge, target-format, or platform compatibility: unchanged constructor bodies, deep selection, lazy auxiliary and managed-only composition; no expanded platform claim. - Evidence, artifact, provenance, or reconstruction contract: unchanged subjects, profiles, replay policy, recording and errors. - Process execution, authorization, cleanup, or containment impact: original cancellation and finally-close retained; no new permission/configuration fields. - Generated metadata, package, or installation impact: committed generated outputs unchanged; compiled fixture imports follow the new owner. ## Evidence and regression coverage - Six real-BinarySession fixture cases cover independent calls, success/failure cleanup, cancellation before acquisition, managed/native isolation and selected/malformed configuration. - Seven guard cases reject the former exception and concrete application/server construction while admitting production composition. - Exact body/import/file-URL review confirms all 24 mechanical modules, including the moved production constructor, preserve implementations. The explicit dependency injection and binding diff was reviewed separately. - Remaining proof gaps: no fresh proprietary Hopper/IDA execution; one macOS-only focused case is deferred to native CI. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - Five static gates, fresh docs/build checks passed. - 199 focused cases passed across 31 suites, one macOS case skipped; actual CLI/MCP SDK, canonical/reordered presentation, selection, snapshot and optional failure isolation included. - All 540 test files discovered exactly once. Generated catalog/managed commitments unchanged. - Existing Ghidra 12.1.4 and JDK: actual CLI plus six MCP operations, decompiler, file-byte oracle, caller-working-directory preservation and runtime cleanup passed. Source-owned fixture was analyzed without execution. Two-CPU supervised family peak RSS: 1090641920 bytes; no owned processes left. - `npm run verify:package`: isolated installation, CLI/MCP analysis and Evidence, setup/backups/recovery/update and lifecycle passed; 131 tools and six prompts. No owned descendants remained and the temporary tarball was cleaned. Sampled MCP RSS 367149056 bytes; observed tools/list startup 1863.01 ms, without a comparative performance claim. - All 22 final-head CI checks passed at cdcec115, including both macOS native package/Inspector baselines, Linux x64/arm64, Windows, real Apple, source tests and coverage. Compiled production/workflow entrypoints are present and former runtime outputs are absent. ## Compatibility, safety, and release - Breaking changes or migration steps: internal application callers supply factories; public adapters retain their prior signatures. No compatibility barrel at the former runtime path. - Real Hopper/Ghidra, browser, or OS coverage: real bounded Linux Ghidra as above; recording seams establish their narrower composition claims. Native package/platform CI remains required. - Package or release metadata impact: no dependency/version changes. - Security, privacy, process, or containment review: serial heavy lanes, two CPUs, one worker, bounded heaps and owned cleanup; no Windows disk writes, installations or GUI changes. Public examples and source references contain no private paths. ## Review checklist - [x] Focused outcome and Conventional Commit title. - [x] Tracking issue linked. - [x] Meaningful failure and cleanup boundaries tested. - [x] Owning docs and compiled fixture paths updated. - [x] Public CLI/MCP meaning and generated metadata verified. - [x] Final diff checked for unrelated changes and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:07:19 +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#2539
No description provided.