[PR #735] [MERGED] fix(cli): report reference-source import failures #2203

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

📋 Pull Request Information

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

Base: main ← Head: fix/reference-import-cli-failure-status


📝 Commits (1)

  • 431e8eb fix(cli): report reference-source import failures

📊 Changes

4 files changed (+242 additions, -19 deletions)

View changed files

➕ src/cli/referenceSourceImportStatus.ts (+14 -0)
📝 src/cli/utilityCommands.ts (+25 -19)
➕ src/cliReferenceSourceImportStatus.test.ts (+125 -0)
➕ tests/boundary/cli/referenceSourceImportStatus.test.ts (+78 -0)

📄 Description

Summary

Return a failing exit status and error log for expected import-reference-source failures.

No separate issue: this is a reproduced omission from command-specific CLI failure classification.

Problem and expected behavior

A missing root or a regular-file root returns the intentional legacy payload { error: "Import failed", category: "invalid_input", message: ... }, but the compiled CLI exits 0 and logs status: "ok".

The shared classifier recognizes canonical analysis errors. This command's reference-import projection intentionally contains only category/message plus the CLI label, so it needs the command-specific failure predicate introduced by #597.

The documented operation-failure contract requires exit 1.

Change and scope

Add a CLI-local predicate for the command's strict three-field legacy failure shape:

  • Exact Import failed label
  • Existing cancelled/invalid_input/execution_failure categories
  • Nonempty message and no extra fields

Retain existing common classification for canonical configuration failures and wire this predicate only into the reference-import command's existing logging wrapper.

The importer, shared classifier, error projections and structured operation payloads are unchanged.

Contract and boundary impact

  • Semantic owner: reference-import CLI exit/log classification.
  • CLI: expected failures exit 1 and log error status; success/error-like-data controls retain existing behavior.
  • MCP/schema/catalog: unchanged.
  • Import, traversal and VCS behavior: unchanged.
  • Process/authorization/cleanup: no new execution or authority.
  • Generated metadata/package/installation: unchanged.

The existing Incur --full-output wrapper still places returned error data under its legacy ok: true envelope. This patch corrects exit/log status and deliberately preserves that separate output contract.

Evidence and regression coverage

Against unchanged command wiring on main af48fe8, all eight real compiled dispatcher cases reproduce exit 0. Four logging-enabled cases also report level 30, status ok and “CLI command completed”; structured payload/full-output assertions already pass.

The complete baseline has 16 failures and 30 passes. For the new helper's red tests, a forwarding bridge delegates exactly to the existing isCliOperationFailure; it does not introduce command wiring or a substitute failure heuristic. Those eight additional failures cover legacy classification and logging.

Fixed coverage passes all 46 tests:

  • Four actual typed import-error variants
  • Canonical configuration failures
  • Strict near-shape/extra-field/category/label negatives
  • Ordinary error-like data, partial/unsupported results and success controls
  • Compiled missing/file preflight, JSON/full-output, preserved structured operation payload and error-level logging

Compiled cases use owned invalid roots. Stat preflight rejects them before realpath, ignore-file reads, traversal or VCS.

Validation performed

After fast-forwarding the unchanged reviewed patch to main 9dd6cef:

  • Focused helper/logging and compiled CLI preflight suites: 46 tests passed.
  • Build and npm run check: passed; all five check tasks succeeded (109 warnings, zero errors).
  • npm run jscpd (2.36%), npm run scan:todos, changed-file lint and git diff --check: passed.
  • Independent review completed before publication with no blocking findings.

Node.js 24.19.0, npm 11.9.0, exact locked dependencies. Optional Turbo telemetry was disabled for local verification. Hosted CI is tracked separately; no full local-suite pass is claimed.

Compatibility, safety, and release

No error-format, schema, dependency or package changes. No actual source import, source-tree traversal, VCS or real-provider workflow was run. The full-output wrapper limitation above remains explicit.

Prepared with AI assistance.


🔄 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/735 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/reference-import-cli-failure-status` --- ### 📝 Commits (1) - [`431e8eb`](https://github.com/morluto/rea/commit/431e8ebfcfba2925904c0deb4888bbd3755b17bf) fix(cli): report reference-source import failures ### 📊 Changes **4 files changed** (+242 additions, -19 deletions) <details> <summary>View changed files</summary> ➕ `src/cli/referenceSourceImportStatus.ts` (+14 -0) 📝 `src/cli/utilityCommands.ts` (+25 -19) ➕ `src/cliReferenceSourceImportStatus.test.ts` (+125 -0) ➕ `tests/boundary/cli/referenceSourceImportStatus.test.ts` (+78 -0) </details> ### 📄 Description ## Summary Return a failing exit status and error log for expected `import-reference-source` failures. No separate issue: this is a reproduced omission from command-specific CLI failure classification. ## Problem and expected behavior A missing root or a regular-file root returns the intentional legacy payload `{ error: "Import failed", category: "invalid_input", message: ... }`, but the compiled CLI exits 0 and logs `status: "ok"`. The shared classifier recognizes canonical analysis errors. This command's reference-import projection intentionally contains only category/message plus the CLI label, so it needs the command-specific failure predicate introduced by #597. The documented operation-failure contract requires exit 1. ## Change and scope Add a CLI-local predicate for the command's strict three-field legacy failure shape: - Exact `Import failed` label - Existing cancelled/invalid_input/execution_failure categories - Nonempty message and no extra fields Retain existing common classification for canonical configuration failures and wire this predicate only into the reference-import command's existing logging wrapper. The importer, shared classifier, error projections and structured operation payloads are unchanged. ## Contract and boundary impact - Semantic owner: reference-import CLI exit/log classification. - CLI: expected failures exit 1 and log error status; success/error-like-data controls retain existing behavior. - MCP/schema/catalog: unchanged. - Import, traversal and VCS behavior: unchanged. - Process/authorization/cleanup: no new execution or authority. - Generated metadata/package/installation: unchanged. The existing Incur `--full-output` wrapper still places returned error data under its legacy `ok: true` envelope. This patch corrects exit/log status and deliberately preserves that separate output contract. ## Evidence and regression coverage Against unchanged command wiring on main `af48fe8`, all eight real compiled dispatcher cases reproduce exit 0. Four logging-enabled cases also report level 30, status ok and “CLI command completed”; structured payload/full-output assertions already pass. The complete baseline has 16 failures and 30 passes. For the new helper's red tests, a forwarding bridge delegates exactly to the existing `isCliOperationFailure`; it does not introduce command wiring or a substitute failure heuristic. Those eight additional failures cover legacy classification and logging. Fixed coverage passes all 46 tests: - Four actual typed import-error variants - Canonical configuration failures - Strict near-shape/extra-field/category/label negatives - Ordinary error-like data, partial/unsupported results and success controls - Compiled missing/file preflight, JSON/full-output, preserved structured operation payload and error-level logging Compiled cases use owned invalid roots. Stat preflight rejects them before realpath, ignore-file reads, traversal or VCS. ## Validation performed After fast-forwarding the unchanged reviewed patch to main `9dd6cef`: - Focused helper/logging and compiled CLI preflight suites: 46 tests passed. - Build and `npm run check`: passed; all five check tasks succeeded (109 warnings, zero errors). - `npm run jscpd` (2.36%), `npm run scan:todos`, changed-file lint and `git diff --check`: passed. - Independent review completed before publication with no blocking findings. Node.js 24.19.0, npm 11.9.0, exact locked dependencies. Optional Turbo telemetry was disabled for local verification. Hosted CI is tracked separately; no full local-suite pass is claimed. ## Compatibility, safety, and release No error-format, schema, dependency or package changes. No actual source import, source-tree traversal, VCS or real-provider workflow was run. The full-output wrapper limitation above remains explicit. Prepared with AI assistance. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:15: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#2203
No description provided.