[PR #1256] [MERGED] fix(errors): report caller-selected evidence path failures as invalid input #2744

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

📋 Pull Request Information

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

Base: main ← Head: fix/evidence-file-selection-code


📝 Commits (1)

  • db177c9 fix(errors): report caller-selected evidence path failures as invalid input

📊 Changes

3 files changed (+43 additions, -5 deletions)

View changed files

📝 src/domain/analysisErrorPresentation.ts (+7 -0)
📝 src/domain/analysisErrorProjection.test.ts (+30 -1)
📝 src/domain/analysisErrorProjection.ts (+6 -4)

📄 Description

Problem

Every tool that reads or writes a caller-selected Evidence file (rea evidence-import, evidence-export, compare, MCP import_evidence_bundle / export_evidence_bundle, and retained-Evidence path inputs) projects path-selection failures as a tool failure:

$ rea evidence-import /path/missing.json --format json
{ "code": "execution_failure", "category": "execution_failure",
  "message": "Evidence file does not exist at the selected path. Check the path and try again.",
  "details": { "operation": "read", "reason": "missing", "path": "/path/missing.json" } }

The message and remediation already tell the caller to fix the path, but code and category say the execution failed. An agent that branches on those fields (AGENTS.md: "Malformed input is distinct from … host operating-system permission denial") treats a typo in the path as a failed tool. evidenceFileCode mapped every EvidenceFileError reason except invalid-json to execution_failure, and the category fell through to the execution_failure default.

Change

EvidenceFileError reason code / category before after
missing (read: file; write: output directory) execution_failure / execution_failure invalid_request / invalid_input
not-file execution_failure / execution_failure invalid_request / invalid_input
exists (output already present) execution_failure / execution_failure invalid_request / invalid_input
invalid-json evidence_integrity_mismatch / execution_failure unchanged
io execution_failure / execution_failure unchanged

Messages, remediation, retryable and details (operation, reason, path) are unchanged. The invalid-json category mismatch, where the code says integrity but the category says execution, is left out of scope.

Verification

  • New analysis error projection: evidence files cases in src/domain/analysisErrorProjection.test.ts cover all six reason/operation pairs and validate against analysisErrorProjectionSchema. The four selection cases fail on main.
  • Every test that references Evidence file errors or evidence import/export/compare paths, including acceptance and conformance (14 files, 115 tests), passed after npm run build:cached. npm run check:changed also passed (typecheck, lint, 553 affected tests).
  • Real CLI on macOS: missing and directory selections for evidence-import and compare now return invalid_request / invalid_input. Invalid JSON still returns evidence_integrity_mismatch. MCP import_evidence_bundle returns the same invalid_request with details.reason: "missing" and the path.

No Hopper or Ghidra verification was needed; neither provider is involved.

🤖 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/1256 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/evidence-file-selection-code` --- ### 📝 Commits (1) - [`db177c9`](https://github.com/morluto/rea/commit/db177c91b83adb0c3edc4f9f6f06e31ac7523d53) fix(errors): report caller-selected evidence path failures as invalid input ### 📊 Changes **3 files changed** (+43 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/analysisErrorPresentation.ts` (+7 -0) 📝 `src/domain/analysisErrorProjection.test.ts` (+30 -1) 📝 `src/domain/analysisErrorProjection.ts` (+6 -4) </details> ### 📄 Description ## Problem Every tool that reads or writes a caller-selected Evidence file (`rea evidence-import`, `evidence-export`, `compare`, MCP `import_evidence_bundle` / `export_evidence_bundle`, and retained-Evidence path inputs) projects path-selection failures as a tool failure: ``` $ rea evidence-import /path/missing.json --format json { "code": "execution_failure", "category": "execution_failure", "message": "Evidence file does not exist at the selected path. Check the path and try again.", "details": { "operation": "read", "reason": "missing", "path": "/path/missing.json" } } ``` The message and remediation already tell the caller to fix the path, but `code` and `category` say the execution failed. An agent that branches on those fields (AGENTS.md: "Malformed input is distinct from … host operating-system permission denial") treats a typo in the path as a failed tool. `evidenceFileCode` mapped every `EvidenceFileError` reason except `invalid-json` to `execution_failure`, and the category fell through to the `execution_failure` default. ## Change | `EvidenceFileError` reason | `code` / `category` before | after | | --- | --- | --- | | `missing` (read: file; write: output directory) | `execution_failure` / `execution_failure` | `invalid_request` / `invalid_input` | | `not-file` | `execution_failure` / `execution_failure` | `invalid_request` / `invalid_input` | | `exists` (output already present) | `execution_failure` / `execution_failure` | `invalid_request` / `invalid_input` | | `invalid-json` | `evidence_integrity_mismatch` / `execution_failure` | unchanged | | `io` | `execution_failure` / `execution_failure` | unchanged | Messages, remediation, `retryable` and `details` (operation, reason, path) are unchanged. The `invalid-json` category mismatch, where the code says integrity but the category says execution, is left out of scope. ## Verification - New `analysis error projection: evidence files` cases in `src/domain/analysisErrorProjection.test.ts` cover all six reason/operation pairs and validate against `analysisErrorProjectionSchema`. The four selection cases fail on `main`. - Every test that references Evidence file errors or evidence import/export/compare paths, including acceptance and conformance (14 files, 115 tests), passed after `npm run build:cached`. `npm run check:changed` also passed (typecheck, lint, 553 affected tests). - Real CLI on macOS: missing and directory selections for `evidence-import` and `compare` now return `invalid_request` / `invalid_input`. Invalid JSON still returns `evidence_integrity_mismatch`. MCP `import_evidence_bundle` returns the same `invalid_request` with `details.reason: "missing"` and the path. No Hopper or Ghidra verification was needed; neither provider is involved. 🤖 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:09: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#2744
No description provided.