[PR #87] [MERGED] fix(contracts)!: return structured workflow failures #1825

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

📋 Pull Request Information

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

Base: main ← Head: codex/rea-low-mid-batch


📝 Commits (3)

  • 4c54ff6 fix(contracts)!: return structured workflow failures
  • dfd598f fix(native): classify pre-aborted analysis first
  • ac8cc66 fix(contracts): keep error schema internal

📊 Changes

11 files changed (+361 additions, -112 deletions)

View changed files

📝 scripts/verify-package.mjs (+14 -0)
📝 scripts/verify-real-hopper.mjs (+8 -2)
📝 src/application/EnhancedTools.ts (+58 -40)
📝 src/contracts/toolContracts.ts (+3 -3)
📝 src/contracts/toolOutputSchemas.ts (+50 -10)
📝 src/domain/errors.ts (+33 -25)
📝 src/domain/hopperValues.ts (+4 -0)
📝 src/native/NativeMacOSProvider.ts (+2 -0)
📝 tests/enhancedTools.test.ts (+101 -9)
📝 tests/errors.test.ts (+59 -23)
📝 tests/nativeProvider.test.ts (+29 -0)

📄 Description

Description

Enhanced workflows currently encode partial failures in prose, forcing callers to parse strings and making normal name-resolution misses indistinguishable from provider errors. This change returns exact discriminated results and makes native cancellation classification deterministic.

  • batch_decompile returns ordered ok/error items plus total, succeeded, and failed counts. Empty input returns zero counts.
  • get_call_graph gives every node an explicit status and projects failures as { tag, message, details }.
  • find_xrefs_to_name resolves exact names through the exhaustively paged Hopper name inventory and returns resolved or unresolved with the stable name_not_found reason.
  • Error projection coverage is compile-time exhaustive across all 23 AnalysisErrorTag variants and excludes causes and local paths.
  • Pre-aborted native requests return AnalysisCancelledError before operation dispatch or subprocess work.

The MCP inventory remains 68 tools.

Type of Change

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

Review Order

  1. src/contracts/toolOutputSchemas.ts and src/domain/errors.ts for the public variants and exhaustive error projection.
  2. src/application/EnhancedTools.ts and src/domain/hopperValues.ts for workflow behavior and exact-name resolution.
  3. src/native/NativeMacOSProvider.ts for cancellation-first classification.
  4. Tests and package/real-Hopper verifier updates.

Testing Performed

  • Unit tests added or updated
  • TypeScript typecheck passes (npm run typecheck)
  • Linting passes (npm run lint)
  • Full test suite passes (npm test) — 54 files, 345 tests; coverage thresholds passed
  • Real Hopper verification performed (npm run verify:hopper) — unavailable because this host has no Hopper installation
  • Linux real Hopper verification performed (npm run verify:hopper:linux) — unavailable because this host has no Hopper installation or desktop runtime
  • Package verification performed (npm run verify:package) — packaged CLI and 68-tool target-free MCP smoke passed
  • npm pack --dry-run — 135 package files
  • Autoreview against origin/main — clean after fixing exact-name resolution and not-found classification

Tool Contract Impact

This is an intentional breaking output-shape change for batch_decompile, get_call_graph, and find_xrefs_to_name. No tools are added or removed. Callers must consume the new discriminants instead of parsing error strings.

Closes #23.
Closes #53.

Breaking Change

batch_decompile, get_call_graph, and find_xrefs_to_name now return structured discriminated output shapes; their previous prose-encoded shapes are not retained.


🔄 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/87 **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:** `codex/rea-low-mid-batch` --- ### 📝 Commits (3) - [`4c54ff6`](https://github.com/morluto/rea/commit/4c54ff6bcaac02f39c6620a54ac29690a121f33d) fix(contracts)!: return structured workflow failures - [`dfd598f`](https://github.com/morluto/rea/commit/dfd598f76505af978f2d11afffb5e1f362d3a769) fix(native): classify pre-aborted analysis first - [`ac8cc66`](https://github.com/morluto/rea/commit/ac8cc668fb6b9305d2dc9014f7a6006d96b18ba6) fix(contracts): keep error schema internal ### 📊 Changes **11 files changed** (+361 additions, -112 deletions) <details> <summary>View changed files</summary> 📝 `scripts/verify-package.mjs` (+14 -0) 📝 `scripts/verify-real-hopper.mjs` (+8 -2) 📝 `src/application/EnhancedTools.ts` (+58 -40) 📝 `src/contracts/toolContracts.ts` (+3 -3) 📝 `src/contracts/toolOutputSchemas.ts` (+50 -10) 📝 `src/domain/errors.ts` (+33 -25) 📝 `src/domain/hopperValues.ts` (+4 -0) 📝 `src/native/NativeMacOSProvider.ts` (+2 -0) 📝 `tests/enhancedTools.test.ts` (+101 -9) 📝 `tests/errors.test.ts` (+59 -23) 📝 `tests/nativeProvider.test.ts` (+29 -0) </details> ### 📄 Description ## Description Enhanced workflows currently encode partial failures in prose, forcing callers to parse strings and making normal name-resolution misses indistinguishable from provider errors. This change returns exact discriminated results and makes native cancellation classification deterministic. - `batch_decompile` returns ordered `ok`/`error` items plus `total`, `succeeded`, and `failed` counts. Empty input returns zero counts. - `get_call_graph` gives every node an explicit status and projects failures as `{ tag, message, details }`. - `find_xrefs_to_name` resolves exact names through the exhaustively paged Hopper name inventory and returns `resolved` or `unresolved` with the stable `name_not_found` reason. - Error projection coverage is compile-time exhaustive across all 23 `AnalysisErrorTag` variants and excludes causes and local paths. - Pre-aborted native requests return `AnalysisCancelledError` before operation dispatch or subprocess work. The MCP inventory remains 68 tools. ## Type of Change - [x] Bug fix - [ ] New feature - [ ] Documentation update - [ ] Performance improvement - [ ] Refactoring (no functional change) - [x] Tool contract change (MCP schema modification) ## Review Order 1. `src/contracts/toolOutputSchemas.ts` and `src/domain/errors.ts` for the public variants and exhaustive error projection. 2. `src/application/EnhancedTools.ts` and `src/domain/hopperValues.ts` for workflow behavior and exact-name resolution. 3. `src/native/NativeMacOSProvider.ts` for cancellation-first classification. 4. Tests and package/real-Hopper verifier updates. ## 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`) — 54 files, 345 tests; coverage thresholds passed - [ ] Real Hopper verification performed (`npm run verify:hopper`) — unavailable because this host has no Hopper installation - [ ] Linux real Hopper verification performed (`npm run verify:hopper:linux`) — unavailable because this host has no Hopper installation or desktop runtime - [x] Package verification performed (`npm run verify:package`) — packaged CLI and 68-tool target-free MCP smoke passed - [x] `npm pack --dry-run` — 135 package files - [x] Autoreview against `origin/main` — clean after fixing exact-name resolution and not-found classification ## Tool Contract Impact This is an intentional breaking output-shape change for `batch_decompile`, `get_call_graph`, and `find_xrefs_to_name`. No tools are added or removed. Callers must consume the new discriminants instead of parsing error strings. ## Related Issues Closes #23. Closes #53. ## Breaking Change `batch_decompile`, `get_call_graph`, and `find_xrefs_to_name` now return structured discriminated output shapes; their previous prose-encoded shapes are not retained. --- <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:30 +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#1825
No description provided.