[PR #2358] [CLOSED] feat(ghidra): select a pre-imported project with -process #5184

Closed
opened 2026-10-31 01:04:37 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2358
Author: @goncalompontes
Created: 10/12/2026
Status: ❌ Closed

Base: main ← Head: feat/1048-existing-project-wiring


📝 Commits (10+)

  • adeb127 feat(ghidra): open a pre-imported project with -process instead of re-importing
  • c3c3f0b fix(ghidra): reject existing projects without the fixed rea-project name
  • 000f379 feat(ghidra): select a pre-imported project with -process
  • 1394412 fix(ghidra): bound existing project copies to owned cancellable inputs
  • 676326e fix(ghidra): preserve missing project admission diagnostics
  • dd53a55 fix(ghidra): reconcile project copies with runtime configuration
  • be9c21f fix(ghidra): isolate saved-project snapshot identities
  • bd8633c fix(config): clarify paired Ghidra project settings
  • 4b7f7d8 Merge captured main into PR #2358
  • 63c4779 fix(ghidra): preserve existing project import mode

📊 Changes

16 files changed (+1312 additions, -85 deletions)

View changed files

📝 docs/installation.md (+51 -0)
📝 src/application/binary/BinarySession.ts (+26 -2)
➕ src/application/binary/BinarySessionCopyIdentity.test.ts (+219 -0)
📝 src/application/binary/SessionProviderRouter.ts (+45 -0)
📝 src/config.test.ts (+101 -0)
📝 src/config/environment.ts (+60 -1)
➕ src/config/ghidraExistingProject.ts (+32 -0)
📝 src/config/parseConfig.ts (+9 -0)
📝 src/config/types.ts (+2 -0)
📝 src/ghidra/GhidraAnalysisProfile.ts (+37 -1)
📝 src/ghidra/GhidraLauncher.ts (+182 -44)
📝 src/ghidra/GhidraMipsProfile.test.ts (+108 -35)
📝 src/ghidra/GhidraProvider.behavior.test.ts (+116 -0)
📝 src/ghidra/GhidraProvider.ts (+19 -1)
📝 src/ghidra/GhidraProviderClient.ts (+5 -1)
📝 tests/boundary/providers/ghidra/ghidraLauncher.test.ts (+300 -0)

📄 Description

Summary

Adds the selection surface for the existing-project -process path introduced
by #2150, so a caller can open a project produced outside REA and pay import +
auto-analysis once, outside the provider startup deadline. This is the
product-wiring slice tracked by #2147 (items 1-3); it addresses #1048's
"documented environment variable" selection entry.

  • New REA_GHIDRA_EXISTING_PROJECT (directory holding rea-project.grez or
    rea-project.rep) and REA_GHIDRA_EXISTING_PROGRAM (program name for
    -process).
  • Both are required together and rejected when combined with import-time options
    (REA_GHIDRA_LANGUAGE_ID, REA_GHIDRA_COMPILER_SPEC_ID,
    REA_GHIDRA_SEED_FILE, REA_GHIDRA_DISABLED_ANALYZERS), which only apply to
    a fresh import.
  • Threaded through AppConfig to GhidraHeadlessLauncher.existingProject.
  • Rejected with an explicit reason at profile resolution for the Windows launch
    path and for DOS, raw-binary, and PSP targets.
  • The analysis profile records import_mode: "existing-project-copy"
    (provenance); the bridge's existing executable SHA-256 check rejects a stale
    or mismatched project.
  • GhidraExistingProject moves to src/config/ and is imported by the launcher,
    matching the GhidraLanguageOverride pattern.
  • Docs: pre-import analyzeHeadless command plus the read-only/copy-first
    provenance and mutation guarantees.

Stacks on #2150 (the launcher existingProject branch). Until #2150 merges,
this PR's diff also contains its two commits; I will rebase on main once it
lands. Ready for review once #2150 is in, or together with it.

Refs #1048, #2147.

Validation

  • npm run check — typecheck, lint (incl. module boundaries), format, knip,
    metadata, architecture guards: pass.
  • npm run test:focused -- src/config.test.ts src/ghidra/GhidraProvider.behavior.test.ts
    — 101 pass, including 12 new cases for the existing-project path (pairing,
    absolute-path, whitespace, import-time conflicts, profile mode, launcher
    hand-off, raw-binary and Windows rejection).
  • npx vitest run src/ghidra tests/boundary/providers/ghidra — 444 pass, 1
    skipped (includes #2150's launcher boundary tests).
  • npm run docs:check — pass.

Real-provider coverage

Not run in this slice (fixture/behavior harness only), matching #2150's own
note. Separately, the underlying -process -noanalysis reuse was exercised
against a real Ghidra 12.1.4 on Linux: a cold import + auto-analysis of a
445 KB PE took 27.7 s and the warm -process open took 6.3 s with identical
analysis results. I can post that evidence to #1048/#2150 or add a real-provider
lane here if wanted.

AI disclosure

This change (code, tests, and this description) was developed with AI
assistance, under human direction. Every validation command above was executed
on this branch's tip.


🔄 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/2358 **Author:** [@goncalompontes](https://github.com/goncalompontes) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/1048-existing-project-wiring` --- ### 📝 Commits (10+) - [`adeb127`](https://github.com/morluto/rea/commit/adeb1270b24db83d301ade1047786b48f0e67f84) feat(ghidra): open a pre-imported project with -process instead of re-importing - [`c3c3f0b`](https://github.com/morluto/rea/commit/c3c3f0b5967404e4669299846b44586d2b6bc722) fix(ghidra): reject existing projects without the fixed rea-project name - [`000f379`](https://github.com/morluto/rea/commit/000f379d59624ba3a5cb6cee2a83aab5905cecd6) feat(ghidra): select a pre-imported project with -process - [`1394412`](https://github.com/morluto/rea/commit/139441298aa2301a9cce90515bc6a3a84d23ff9c) fix(ghidra): bound existing project copies to owned cancellable inputs - [`676326e`](https://github.com/morluto/rea/commit/676326e9ce5934e5e8d9f11221f5f4ec566056a4) fix(ghidra): preserve missing project admission diagnostics - [`dd53a55`](https://github.com/morluto/rea/commit/dd53a554e7fbbe5d02c85d242685f65f99bacf9e) fix(ghidra): reconcile project copies with runtime configuration - [`be9c21f`](https://github.com/morluto/rea/commit/be9c21f5f9c812419a0db4c6d63bfe00290e6e33) fix(ghidra): isolate saved-project snapshot identities - [`bd8633c`](https://github.com/morluto/rea/commit/bd8633ca863a723339d206340bcc623676295fde) fix(config): clarify paired Ghidra project settings - [`4b7f7d8`](https://github.com/morluto/rea/commit/4b7f7d8f4ab409d976edb1e10ed9d6e889be81d8) Merge captured main into PR #2358 - [`63c4779`](https://github.com/morluto/rea/commit/63c4779a66cea39c6fccef6b4fd4feb8b35a4c9e) fix(ghidra): preserve existing project import mode ### 📊 Changes **16 files changed** (+1312 additions, -85 deletions) <details> <summary>View changed files</summary> 📝 `docs/installation.md` (+51 -0) 📝 `src/application/binary/BinarySession.ts` (+26 -2) ➕ `src/application/binary/BinarySessionCopyIdentity.test.ts` (+219 -0) 📝 `src/application/binary/SessionProviderRouter.ts` (+45 -0) 📝 `src/config.test.ts` (+101 -0) 📝 `src/config/environment.ts` (+60 -1) ➕ `src/config/ghidraExistingProject.ts` (+32 -0) 📝 `src/config/parseConfig.ts` (+9 -0) 📝 `src/config/types.ts` (+2 -0) 📝 `src/ghidra/GhidraAnalysisProfile.ts` (+37 -1) 📝 `src/ghidra/GhidraLauncher.ts` (+182 -44) 📝 `src/ghidra/GhidraMipsProfile.test.ts` (+108 -35) 📝 `src/ghidra/GhidraProvider.behavior.test.ts` (+116 -0) 📝 `src/ghidra/GhidraProvider.ts` (+19 -1) 📝 `src/ghidra/GhidraProviderClient.ts` (+5 -1) 📝 `tests/boundary/providers/ghidra/ghidraLauncher.test.ts` (+300 -0) </details> ### 📄 Description ## Summary Adds the selection surface for the existing-project `-process` path introduced by #2150, so a caller can open a project produced outside REA and pay import + auto-analysis once, outside the provider startup deadline. This is the product-wiring slice tracked by #2147 (items 1-3); it addresses #1048's "documented environment variable" selection entry. - New `REA_GHIDRA_EXISTING_PROJECT` (directory holding `rea-project.grez` or `rea-project.rep`) and `REA_GHIDRA_EXISTING_PROGRAM` (program name for `-process`). - Both are required together and rejected when combined with import-time options (`REA_GHIDRA_LANGUAGE_ID`, `REA_GHIDRA_COMPILER_SPEC_ID`, `REA_GHIDRA_SEED_FILE`, `REA_GHIDRA_DISABLED_ANALYZERS`), which only apply to a fresh import. - Threaded through `AppConfig` to `GhidraHeadlessLauncher.existingProject`. - Rejected with an explicit reason at profile resolution for the Windows launch path and for DOS, raw-binary, and PSP targets. - The analysis profile records `import_mode: "existing-project-copy"` (provenance); the bridge's existing executable SHA-256 check rejects a stale or mismatched project. - `GhidraExistingProject` moves to `src/config/` and is imported by the launcher, matching the `GhidraLanguageOverride` pattern. - Docs: pre-import `analyzeHeadless` command plus the read-only/copy-first provenance and mutation guarantees. **Stacks on #2150** (the launcher `existingProject` branch). Until #2150 merges, this PR's diff also contains its two commits; I will rebase on `main` once it lands. Ready for review once #2150 is in, or together with it. Refs #1048, #2147. ## Validation - `npm run check` — typecheck, lint (incl. module boundaries), format, knip, metadata, architecture guards: pass. - `npm run test:focused -- src/config.test.ts src/ghidra/GhidraProvider.behavior.test.ts` — 101 pass, including 12 new cases for the existing-project path (pairing, absolute-path, whitespace, import-time conflicts, profile mode, launcher hand-off, raw-binary and Windows rejection). - `npx vitest run src/ghidra tests/boundary/providers/ghidra` — 444 pass, 1 skipped (includes #2150's launcher boundary tests). - `npm run docs:check` — pass. ## Real-provider coverage Not run in this slice (fixture/behavior harness only), matching #2150's own note. Separately, the underlying `-process -noanalysis` reuse was exercised against a real Ghidra 12.1.4 on Linux: a cold import + auto-analysis of a 445 KB PE took 27.7 s and the warm `-process` open took 6.3 s with identical analysis results. I can post that evidence to #1048/#2150 or add a real-provider lane here if wanted. ## AI disclosure This change (code, tests, and this description) was developed with AI assistance, under human direction. Every validation command above was executed on this branch's tip. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:04:37 +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#5184
No description provided.