Skip to content

fix(core): clear stale wizard step errors#289

Merged
RtlZeroMemory merged 1 commit intomainfrom
codex/fix-form-wizard-stale-errors
Mar 18, 2026
Merged

fix(core): clear stale wizard step errors#289
RtlZeroMemory merged 1 commit intomainfrom
codex/fix-form-wizard-stale-errors

Conversation

@RtlZeroMemory
Copy link
Copy Markdown
Owner

@RtlZeroMemory RtlZeroMemory commented Mar 17, 2026

Summary

  • clear stored step errors during async-enabled wizard transition revalidation so stale async-style errors cannot keep blocking navigation after a field edit
  • apply the same behavior to both nextStep() and goToStep() transition paths
  • add regressions for stale step-error recovery after editing the blocked field value

Testing

  • npm run build
  • npm run lint
  • npm run typecheck
  • node scripts/run-tests.mjs --filter "form.wizard"
  • node scripts/run-tests.mjs --filter "useForm"

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed wizard form transitions that displayed stale validation errors after users corrected a field value, preventing progression to the next step. When async validation errors occurred on a field and users subsequently changed that field's value, the outdated error would persist. The form now correctly clears these errors during step transitions.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

This pull request fixes a bug where wizard transitions were blocked by stale async validation errors. When field values change after async revalidation, the step-specific errors are now cleared before navigation. The fix includes regression tests for nextStep() and goToStep() scenarios.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Added Unreleased section entries documenting the bug fix for wizard transitions clearing stale step errors and associated regression tests.
Tests
packages/core/src/forms/__tests__/form.wizard.test.ts
Added two regression tests verifying that async step errors are cleared when field values change during nextStep() and goToStep() transitions, with proper step advancement and error state cleanup.
Wizard Core Logic
packages/core/src/forms/internal/wizard.ts
Added optional includeSourceErrors parameter to resolveWizardTransition options. Introduced conditional logic to clear stale errors from mergedErrors when async errors are resolved. Propagated the parameter through nextStep, goToStep, and async revalidation flows to control when source errors are included in validation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰✨ A wizard's steps once stumbled when errors went stale,
But now when fields change, we clear the trail!
Async validations resolved with care,
No more false blocks—just smooth sailing there! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(core): clear stale wizard step errors' directly and concisely summarizes the main change: fixing stale step errors in the wizard component. It aligns with the primary objective and changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-form-wizard-stale-errors
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/core/src/forms/internal/wizard.ts (1)

200-218: ⚠️ Potential issue | 🟠 Major

This broadens error clearing beyond edited-field cases; verify the intended contract.

The code clears setFieldError(...) blockers whenever validateAsync is enabled and the transition passes, even if the user never changed the field value. When includeSourceErrors: false (line 289), clearValidationFields removes stored step errors before running validation, and if runWizardStepValidation produces no new errors, the blocker stays cleared.

All existing tests pair setFieldError with setFieldValue before navigation, so they don't expose this path. If the intended behavior is "only clear errors stale from old values," add a field-value-change gate. Otherwise, confirm this broader behavior is intentional and update test coverage to cover the no-edit scenario.

Also applies to callers at lines 289, 342, 406, 459 All four transition entry points use the same `includeSourceErrors: !options.validateAsync` pattern.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 90919b1d-0ee9-4efd-918b-fcdf417dce82

📥 Commits

Reviewing files that changed from the base of the PR and between 2980659 and f8234a5.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • packages/core/src/forms/__tests__/form.wizard.test.ts
  • packages/core/src/forms/internal/wizard.ts

@RtlZeroMemory RtlZeroMemory merged commit 36ddadf into main Mar 18, 2026
32 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.

1 participant