[PR #3233] [CLOSED] fix(cli): advertise the outline-depth minimum the parser enforces #5662

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3233
Author: @fengqiaoqu
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: codex/issue-3211-outline-depth-schema


📝 Commits (1)

  • f56066c fix(cli): advertise the outline-depth minimum the parser enforces

📊 Changes

2 files changed (+61 additions, -1 deletions)

View changed files

📝 src/cli/utilityCommands.ts (+3 -1)
➕ tests/boundary/cli/referenceSourceOutlineDepthSchema.test.ts (+58 -0)

📄 Description

Problem

import-reference-source --outline-depth is declared as .number().int().nonnegative().safe() (#3211). In Zod's JSON Schema conversion, the .safe() check publishes its own safe-range minimum and overwrites the bound from .nonnegative(), so the exported command schema advertises minimum: -9007199254740991 while the parser rejects every negative value. A machine-readable argument contract therefore admits requests that fail validation.

Fix

Reorder the chain to .int().safe().nonnegative() so the nonnegative bound is applied last and survives conversion. Parsing behavior is unchanged: -1 is still rejected, 0 and positive safe integers are still accepted.

Validation

  • New CLI boundary test tests/boundary/cli/referenceSourceOutlineDepthSchema.test.ts exports the command schema via --schema --json, asserts outlineDepth is integer with minimum: 0, and checks with Ajv 2020-12 that -1 fails while 0 and 2 pass. It fails before the fix (expected -9007199254740991 to be +0) and passes after.
  • npx vitest run --project cli-boundary tests/boundary/cli/cliInputSchemaRequired.test.ts: passes.
  • tests/boundary/cli/referenceSourceImportStatus.test.ts has 6 pre-existing host-dependent failures on this Windows machine (they expect unsupported_host while the local native addon provides safe no-follow opens); identical failures occur on an unmodified tree, unrelated to this change.
  • npm run check:fast passes.

Fixes #3211


🔄 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/3233 **Author:** [@fengqiaoqu](https://github.com/fengqiaoqu) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/issue-3211-outline-depth-schema` --- ### 📝 Commits (1) - [`f56066c`](https://github.com/morluto/rea/commit/f56066c6d828a0cd1ec0bcb27350a4b110c8ba80) fix(cli): advertise the outline-depth minimum the parser enforces ### 📊 Changes **2 files changed** (+61 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/cli/utilityCommands.ts` (+3 -1) ➕ `tests/boundary/cli/referenceSourceOutlineDepthSchema.test.ts` (+58 -0) </details> ### 📄 Description ## Problem `import-reference-source --outline-depth` is declared as `.number().int().nonnegative().safe()` (#3211). In Zod's JSON Schema conversion, the `.safe()` check publishes its own safe-range minimum and overwrites the bound from `.nonnegative()`, so the exported command schema advertises `minimum: -9007199254740991` while the parser rejects every negative value. A machine-readable argument contract therefore admits requests that fail validation. ## Fix Reorder the chain to `.int().safe().nonnegative()` so the nonnegative bound is applied last and survives conversion. Parsing behavior is unchanged: `-1` is still rejected, `0` and positive safe integers are still accepted. ## Validation - New CLI boundary test `tests/boundary/cli/referenceSourceOutlineDepthSchema.test.ts` exports the command schema via `--schema --json`, asserts `outlineDepth` is `integer` with `minimum: 0`, and checks with Ajv 2020-12 that `-1` fails while `0` and `2` pass. It fails before the fix (`expected -9007199254740991 to be +0`) and passes after. - `npx vitest run --project cli-boundary tests/boundary/cli/cliInputSchemaRequired.test.ts`: passes. - `tests/boundary/cli/referenceSourceImportStatus.test.ts` has 6 pre-existing host-dependent failures on this Windows machine (they expect `unsupported_host` while the local native addon provides safe no-follow opens); identical failures occur on an unmodified tree, unrelated to this change. - `npm run check:fast` passes. Fixes #3211 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:08:24 +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#5662
No description provided.