[PR #2127] [CLOSED] fix(cli): validate inspect-managed-members --type against the provider contract #5048

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

📋 Pull Request Information

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

Base: main ← Head: fix-cli-type-names-boundary-validation


📝 Commits (1)

  • dcd11a4 fix(cli): validate inspect-managed-members --type against the provider contract

📊 Changes

2 files changed (+77 additions, -6 deletions)

View changed files

📝 src/cli/managedCommands.ts (+7 -6)
➕ tests/acceptance/managedCliTypeValidation.test.ts (+70 -0)

📄 Description

Fixes #2121.

Problem

rea inspect-managed-members --type was declared in the CLI as z.array(z.string()), while the provider contract (managedMembersInputSchema.shape.type_names in src/contracts/managed/managedToolContracts.ts) requires non-empty, non-repeating names (min(1) strings, min(1) items, no-duplicate refine). A repeated or empty --type passed CLI parsing, reached ManagedStaticProvider, whose managedMembersInputSchema.parse(...) threw a ZodError that got projected as execution_failure — sending the caller to rea doctor for what is purely an input problem.

Change

src/cli/managedCommands.ts now reuses managedMembersInputSchema.shape.type_names for the --type option (same pattern as swiftSymbolsSchema reuse in utilityCommands.ts), so repeated/empty names are rejected at the CLI boundary with VALIDATION_ERROR naming the option (fieldErrors[].path: "type"), instead of execution_failure.

Verification

  • New acceptance test tests/acceptance/managedCliTypeValidation.test.ts drives the compiled CLI against a fixture-built managed PE (cliTest): repeated --type → exit 1, VALIDATION_ERROR with "must not repeat a name"; empty --type → exit 1, VALIDATION_ERROR; two distinct valid --type values → exit 0.
  • Regression bar: the test fails on unfixed code (returns Analysis failed / execution_failure path) and passes with the fix.
  • tsc --noEmit clean, oxlint clean, verify:module-boundaries clean, verify:test-discovery clean; related suites tests/acceptance/managedCliOutput.test.ts + tests/boundary/mcp/managedMcp.test.ts 7/7 green.
  • Note: per-issue expectation was a validation error naming --type; the framework reports the option schema path as type in fieldErrors, which is how this CLI surfaces option-level validation (consistent with other options).

🔄 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/2127 **Author:** [@nosmile99](https://github.com/nosmile99) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-cli-type-names-boundary-validation` --- ### 📝 Commits (1) - [`dcd11a4`](https://github.com/morluto/rea/commit/dcd11a467bd3b920a5a03a46c9260ca11bde8ff4) fix(cli): validate inspect-managed-members --type against the provider contract ### 📊 Changes **2 files changed** (+77 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/cli/managedCommands.ts` (+7 -6) ➕ `tests/acceptance/managedCliTypeValidation.test.ts` (+70 -0) </details> ### 📄 Description Fixes #2121. ## Problem `rea inspect-managed-members --type` was declared in the CLI as `z.array(z.string())`, while the provider contract (`managedMembersInputSchema.shape.type_names` in `src/contracts/managed/managedToolContracts.ts`) requires non-empty, non-repeating names (`min(1)` strings, `min(1)` items, no-duplicate refine). A repeated or empty `--type` passed CLI parsing, reached `ManagedStaticProvider`, whose `managedMembersInputSchema.parse(...)` threw a ZodError that got projected as `execution_failure` — sending the caller to `rea doctor` for what is purely an input problem. ## Change `src/cli/managedCommands.ts` now reuses `managedMembersInputSchema.shape.type_names` for the `--type` option (same pattern as `swiftSymbolsSchema` reuse in `utilityCommands.ts`), so repeated/empty names are rejected at the CLI boundary with `VALIDATION_ERROR` naming the option (`fieldErrors[].path: "type"`), instead of `execution_failure`. ## Verification - New acceptance test `tests/acceptance/managedCliTypeValidation.test.ts` drives the compiled CLI against a fixture-built managed PE (`cliTest`): repeated `--type` → exit 1, `VALIDATION_ERROR` with "must not repeat a name"; empty `--type` → exit 1, `VALIDATION_ERROR`; two distinct valid `--type` values → exit 0. - Regression bar: the test **fails on unfixed code** (returns `Analysis failed` / `execution_failure` path) and **passes with the fix**. - `tsc --noEmit` clean, `oxlint` clean, `verify:module-boundaries` clean, `verify:test-discovery` clean; related suites `tests/acceptance/managedCliOutput.test.ts` + `tests/boundary/mcp/managedMcp.test.ts` 7/7 green. - Note: per-issue expectation was a validation error naming `--type`; the framework reports the option schema path as `type` in `fieldErrors`, which is how this CLI surfaces option-level validation (consistent with other options). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:00: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#5048
No description provided.