Skip to content

fix: describe exclusive min and max validation failures - #1305

Open
FanWu-ai wants to merge 1 commit into
ianstormtaylor:mainfrom
FanWu-ai:fix-exclusive-bound-error-messages-20261012
Open

FanWu-ai wants to merge 1 commit into
ianstormtaylor:mainfrom
FanWu-ai:fix-exclusive-bound-error-messages-20261012

Conversation

@FanWu-ai

Copy link
Copy Markdown

Summary

Exclusive min and max refinements currently lose their explanatory error messages because || message binds only to the false branch of the conditional expression. For example, validate(11, max(number(), 10, {exclusive: true})) returns a generic refinement error without the bound.

Group the comparison expression before its error-message fallback. Acceptance, coercion, type signatures and dependencies are unchanged. Twelve regressions/controls cover numbers, dates, exact boundaries, inclusive messages and nested custom-error causes; six fail on the original source.

Validation

On Node 24.19.0 and 22.19.0, pristine full suite 225 passes; final 237 passes. Required npm test (build and source/test types included), npm run lint (configured ESLint and whole-project Prettier), package build and diff checks pass. Additional 1,572 scenarios per runtime and 624 independent review cases pass.

Two environment/check qualifications:

  • The reused dependency tree retains an existing expect 29.7 compatibility resolution for wildcard @types/expect; this patch makes no dependency change. A fresh unpinned CI install may differ.
  • Supplemental direct-file ESLint, beyond the configured required lint command, reports five existing no-shadow findings elsewhere in refinements.ts. Pristine and final findings are identical at the same locations; the new test has none. That supplemental check is not claimed passed.

Other CI runtimes and hosted results are not claimed. Prepared and tested with AI assistance (OpenAI Codex); no human review is claimed.

Group the bound comparison before the explanatory error fallback so exclusive bounds preserve their intended diagnostic messages.

AI assistance: OpenAI Codex.
@FanWu-ai
FanWu-ai marked this pull request as ready for review October 11, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant