[PR #107] [MERGED] fix(errors): return actionable caller-safe failures #1838

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

📋 Pull Request Information

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

Base: main ← Head: morl/roadmap_implementation


📝 Commits (6)

  • 3be439c feat(errors): add caller-safe typed error projections
  • eb38e4c feat(mcp): return structured typed tool results
  • af8c4ef fix(cli): render actionable analysis errors
  • 77454dc fix(errors): improve recovery guidance
  • 12060f6 fix(copy): use agent terminology
  • a93a198 Merge branch 'main' into morl/roadmap_implementation

📊 Changes

61 files changed (+1953 additions, -346 deletions)

View changed files

📝 README.md (+12 -12)
📝 docs/api/functions/application_Setup.detectClients.html (+1 -1)
📝 docs/installation.md (+2 -2)
📝 docs/roadmap.md (+1 -1)
➕ docs/user-visible-errors.csv (+103 -0)
📝 install.sh (+11 -11)
📝 package.json (+2 -2)
📝 scripts/rea.mjs (+6 -3)
📝 skills/rea-analysis/SKILL.md (+1 -1)
📝 src/application/DirectAnalysis.ts (+11 -8)
📝 src/application/ProcessCaptureAuthority.ts (+5 -3)
📝 src/application/ProcessCaptureError.ts (+24 -0)
📝 src/application/ProcessCaptureLifecycle.ts (+26 -1)
📝 src/application/ProcessCli.ts (+127 -32)
📝 src/application/ProcessHarness.ts (+5 -3)
📝 src/application/ReferenceSourceImportEntries.ts (+21 -3)
📝 src/application/ReferenceSourceImportTypes.ts (+42 -2)
📝 src/application/Setup.ts (+6 -24)
➕ src/application/SetupClients.ts (+39 -0)
📝 src/application/Uninstall.ts (+69 -21)

...and 41 more files

📄 Description

Description

REA currently forwards provider diagnostics, parser details, local paths, and other implementation-specific text through several CLI and MCP failure paths. Callers cannot reliably decide whether to retry, correct input, request permission, or choose another provider.

This change gives expected failures a provider-neutral category and actionable message, then applies that projection consistently across MCP tools, one-shot commands, setup, uninstall, upgrade, reference-source import, process capture, the installer, and MCP startup/shutdown. It also inventories 102 user-visible error paths in docs/user-visible-errors.csv.

CLI validation output is sanitized in both normal and --full-output formats. Process command failures retain a nonzero exit code, so redirected output cannot be mistaken for valid Evidence. MCP mode now enters through the same safe startup wrapper whether invoked through dist/main.js or the packaged dispatcher.

Suggested review order

  1. src/domain/errors.ts and src/contracts/toolOutputSchemas.ts for the caller-visible projection contract.
  2. src/server/ registrations and src/main.ts for MCP translation and lifecycle behavior.
  3. src/cliOutput.ts, src/application/ProcessCli.ts, and src/cliProcessCommands.ts for CLI safety and exit semantics.
  4. Setup, uninstall, installer, and reference-source adapters.
  5. Regression tests and docs/user-visible-errors.csv.

AI-assisted implementation and review.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Performance improvement
  • Refactoring (no functional change)
  • Tool contract change (MCP schema modification)

Testing Performed

  • Unit tests added or updated
  • TypeScript typecheck passes (npm run typecheck)
  • Linting passes (npm run lint)
  • Full test suite passes (npm test) — 60 files, 393 tests
  • Real Hopper verification performed (npm run verify:hopper)
  • Linux real Hopper verification performed (npm run verify:hopper:linux) or unavailability explained
  • Package verification performed (npm run verify:package)

Additional checks:

  • npm run check
  • npm run knip (only existing configuration hints)
  • npm run jscpd (0.99% duplicated TypeScript lines; no threshold failure)
  • npm run scan:todos
  • npm pack --dry-run
  • autoreview against origin/main — no accepted or actionable findings

Real Hopper verification was not run because this environment does not provide an activated Hopper installation and two distinct target binaries. The change does not modify Hopper bridge behavior; package and fake-launcher integration tests cover the changed caller boundaries.

Tool Contract Impact

The 68-tool inventory is unchanged. Expected MCP failures now expose a structured provider-neutral object with category and message; provider identifiers, bridge diagnostics, local paths, validator internals, and raw causes are omitted. Output schemas now require JSON objects instead of accepting unconstrained values where the registered tools return object results.

No linked issue.


🔄 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/107 **Author:** [@morluto](https://github.com/morluto) **Created:** 7/13/2026 **Status:** ✅ Merged **Merged:** 7/13/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `morl/roadmap_implementation` --- ### 📝 Commits (6) - [`3be439c`](https://github.com/morluto/rea/commit/3be439cbf3db2c53c766bf93a4e247fdfb8242ae) feat(errors): add caller-safe typed error projections - [`eb38e4c`](https://github.com/morluto/rea/commit/eb38e4c4024a7d66001b3e69f8309c85492f05c0) feat(mcp): return structured typed tool results - [`af8c4ef`](https://github.com/morluto/rea/commit/af8c4efb4a415e4bdeae0151a8d29cd71af61916) fix(cli): render actionable analysis errors - [`77454dc`](https://github.com/morluto/rea/commit/77454dc8f412e8431bbceff1a4c90ee8f636c9c7) fix(errors): improve recovery guidance - [`12060f6`](https://github.com/morluto/rea/commit/12060f6d8dd3ed61fbd1d07fa604652c6b0a93e2) fix(copy): use agent terminology - [`a93a198`](https://github.com/morluto/rea/commit/a93a198da77d8b4afa54db01d980fe4fc39f5bca) Merge branch 'main' into morl/roadmap_implementation ### 📊 Changes **61 files changed** (+1953 additions, -346 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+12 -12) 📝 `docs/api/functions/application_Setup.detectClients.html` (+1 -1) 📝 `docs/installation.md` (+2 -2) 📝 `docs/roadmap.md` (+1 -1) ➕ `docs/user-visible-errors.csv` (+103 -0) 📝 `install.sh` (+11 -11) 📝 `package.json` (+2 -2) 📝 `scripts/rea.mjs` (+6 -3) 📝 `skills/rea-analysis/SKILL.md` (+1 -1) 📝 `src/application/DirectAnalysis.ts` (+11 -8) 📝 `src/application/ProcessCaptureAuthority.ts` (+5 -3) 📝 `src/application/ProcessCaptureError.ts` (+24 -0) 📝 `src/application/ProcessCaptureLifecycle.ts` (+26 -1) 📝 `src/application/ProcessCli.ts` (+127 -32) 📝 `src/application/ProcessHarness.ts` (+5 -3) 📝 `src/application/ReferenceSourceImportEntries.ts` (+21 -3) 📝 `src/application/ReferenceSourceImportTypes.ts` (+42 -2) 📝 `src/application/Setup.ts` (+6 -24) ➕ `src/application/SetupClients.ts` (+39 -0) 📝 `src/application/Uninstall.ts` (+69 -21) _...and 41 more files_ </details> ### 📄 Description ## Description REA currently forwards provider diagnostics, parser details, local paths, and other implementation-specific text through several CLI and MCP failure paths. Callers cannot reliably decide whether to retry, correct input, request permission, or choose another provider. This change gives expected failures a provider-neutral `category` and actionable `message`, then applies that projection consistently across MCP tools, one-shot commands, setup, uninstall, upgrade, reference-source import, process capture, the installer, and MCP startup/shutdown. It also inventories 102 user-visible error paths in `docs/user-visible-errors.csv`. CLI validation output is sanitized in both normal and `--full-output` formats. Process command failures retain a nonzero exit code, so redirected output cannot be mistaken for valid Evidence. MCP mode now enters through the same safe startup wrapper whether invoked through `dist/main.js` or the packaged dispatcher. ### Suggested review order 1. `src/domain/errors.ts` and `src/contracts/toolOutputSchemas.ts` for the caller-visible projection contract. 2. `src/server/` registrations and `src/main.ts` for MCP translation and lifecycle behavior. 3. `src/cliOutput.ts`, `src/application/ProcessCli.ts`, and `src/cliProcessCommands.ts` for CLI safety and exit semantics. 4. Setup, uninstall, installer, and reference-source adapters. 5. Regression tests and `docs/user-visible-errors.csv`. AI-assisted implementation and review. ## Type of Change - [x] Bug fix - [ ] New feature - [ ] Documentation update - [ ] Performance improvement - [ ] Refactoring (no functional change) - [x] Tool contract change (MCP schema modification) ## Testing Performed - [x] Unit tests added or updated - [x] TypeScript typecheck passes (`npm run typecheck`) - [x] Linting passes (`npm run lint`) - [x] Full test suite passes (`npm test`) — 60 files, 393 tests - [ ] Real Hopper verification performed (`npm run verify:hopper`) - [ ] Linux real Hopper verification performed (`npm run verify:hopper:linux`) or unavailability explained - [x] Package verification performed (`npm run verify:package`) Additional checks: - `npm run check` - `npm run knip` (only existing configuration hints) - `npm run jscpd` (0.99% duplicated TypeScript lines; no threshold failure) - `npm run scan:todos` - `npm pack --dry-run` - autoreview against `origin/main` — no accepted or actionable findings Real Hopper verification was not run because this environment does not provide an activated Hopper installation and two distinct target binaries. The change does not modify Hopper bridge behavior; package and fake-launcher integration tests cover the changed caller boundaries. ## Tool Contract Impact The 68-tool inventory is unchanged. Expected MCP failures now expose a structured provider-neutral object with `category` and `message`; provider identifiers, bridge diagnostics, local paths, validator internals, and raw causes are omitted. Output schemas now require JSON objects instead of accepting unconstrained values where the registered tools return object results. ## Related Issues No linked issue. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:11:38 +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#1838
No description provided.