Skip to content

fix: validate asynchronous rules selected by when - #97

Merged
simonguo merged 1 commit into
masterfrom
fix/conditional-async-validation
Oct 24, 2026
Merged

simonguo merged 1 commit into
masterfrom
fix/conditional-async-validation

Conversation

@simonguo

@simonguo simonguo commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

StringType().when(() => StringType().addAsyncRule(async () => false, 'Invalid')).checkAsync('value') currently reports success without invoking the selected asynchronous rule. The same skipped validation occurs in model/field checks and can hide selected rule rejections.

Register separate synchronous and asynchronous callbacks for the existing conditional priority rule. Synchronous checks retain the original .check() path; asynchronous checks await the selected type's .checkAsync(), including arrays, shaped objects and nested conditions. Preserve the existing rule-before-message order for synchronous selected rules. Conditions and selected rules are evaluated once per check.

Add 20 regression/compatibility cases for pending validation, model branch selection/reselection, field arguments, recursive error shapes, regular/priority rejection and throw identity, message factories, required/empty values, outer rule ordering and synchronous behavior. The original implementation passes five controls and fails 15; the candidate passes all 227 runtime tests, both module builds, full source ESLint and strict public-declaration fixtures on Node 16.20.2, 18.20.8, 20.20.2 and 22.22.3. All 42 public declaration files remain byte-identical to the merged type fix.

RSuite integration: four new Form controls fail against the published 2.4.3 provider. With the exact 154-file private candidate tarball in an independently installed dependency tree, Chromium and Firefox each pass all 617 cases across 50 files in src/Form/test, including error rendering, selected-rule rejection/throw identity and subsequent recovery. Full RSuite source type-check also passes. Three obsolete array test workaround registrations and one obsolete expected-type-error comment are removed only in that private consumer; existing assertions/deadlines and RSuite manifests/lockfile remain unchanged. The private candidate's runtime dependency requirements match the registry provider.

No dependency, supported-runtime floor or package-version change. This is an unreleased source fix; the existing v2.4.3 tag and npm package remain unchanged. Its first hosted run 40065614926 passed all four Node jobs, each with 227 runtime tests and the strict declaration fixture. All four actual Coveralls uploads were verified against synthetic merge c13f368d907be0a64753c5890d5874c7d46e0316; coverage is 95.5010% (+0.005 percentage points). Snyk passes and there are no unresolved inline review threads. The exact-head CodeSandbox preview has an actually empty API log and is covered by the existing user-authorized exception after all project gates pass. The preview is the only pending check being waived.

Copilot AI balanced review requested due to automatic review settings October 24, 2026 05:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@simonguo
simonguo merged commit 9502b46 into master Oct 24, 2026
6 of 7 checks passed
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.

2 participants