Skip to content

fix(create-bestax): validate at submit in the bestax-form signup example - #474

Merged
allxsmith merged 2 commits into
mainfrom
fix/bestax-form-signup-submit
Aug 4, 2026
Merged

allxsmith merged 2 commits into
mainfrom
fix/bestax-form-signup-submit

Conversation

@allxsmith

Copy link
Copy Markdown
Owner

Found while writing the Form Library Agnostic post (#471): the bestax-form skill's canonical SignupForm reads the stale render-scope error right after setTouched(true), so an invalid email that was never blurred passes if (!error && email) on first submit. The blog demo deliberately ships the corrected pattern, which left the two shipped surfaces teaching different code.

  • Compute const valid = …regex.test(email) once; gate the error on touched && !valid; check valid in the submit handler (the && email guard is subsumed, an empty string fails the regex).
  • Add id + labelProps={{ htmlFor }} to the example, which the skill's own accessibility note (label does not wire htmlFor) prescribes but the example did not model.
  • Checked bulma-ui/src/skill-examples/Form.stories.tsx: its signup story uses a submit-gated submitted ? errors[k] : undefined pattern without the stale read, so it is unaffected.

fix(create-bestax) scope so the bundled skill copy actually releases. pnpm format:check and pnpm check:conformance pass.

The canonical SignupForm submitted on the stale render-scope error
after setTouched(true), so an invalid email that was never blurred
passed the if (!error && email) guard on first submit. Compute the
validity once and check it in the handler, matching the corrected
pattern the Form Library Agnostic post teaches, and wire the label to
the input (id plus labelProps htmlFor) the way the skill's own
accessibility note prescribes. The Storybook skill-example showcase
uses a different, submit-gated pattern and is unaffected.
Copilot AI balanced review requested due to automatic review settings August 4, 2026 11:37
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@allxsmith, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 35 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 01a0aee6-24c8-4eaf-87fa-ab143bab8a1f

📥 Commits

Reviewing files that changed from the base of the PR and between 7d2007c and af49a16.

📒 Files selected for processing (2)
  • bulma-ui/src/skill-examples/Form.stories.tsx
  • skills/bestax-form/SKILL.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes stale validation in the bundled bestax-form signup example.

Changes:

  • Computes and checks email validity directly on submission.
  • Associates the email label with its input for accessibility.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +171 to +172
id="signup-email"
labelProps={{ htmlFor: 'signup-email' }}
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Preview Deployment

Preview URL: https://758459ed.bestax.pages.dev

@allxsmith
allxsmith requested a balanced review from Copilot August 4, 2026 11:40
@allxsmith allxsmith self-assigned this Aug 4, 2026
@allxsmith allxsmith added documentation Improvements or additions to documentation deep-review labels Aug 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@bestaxbot

Copy link
Copy Markdown
Collaborator

AI triage — issues this PR may resolve

If this PR resolves one of these, add the line below to the PR description
so the issue closes on merge:

Fixes #368

@claude claude Bot 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.

Deep review — 0 blocking · 1 advisory

No Severity Area Finding Location
1 🔵 Advisory Accessibility The Storybook skill-example Signup story (which showcases agent output of this skill) does not model the id + labelProps={{ htmlFor }} wiring that the canonical example and the skill's own a11y note now teach; a pre-existing gap, not a regression from this PR. bulma-ui/src/skill-examples/Form.stories.tsx:83

Overall: The change is sound and correctly scoped. The original example had a genuine stale-closure bug: the submit handler read the render-scope error, which is undefined before the first setTouched(true) takes effect, so 'if (!error && email)' submitted an invalid-but-non-empty email on the first submit. The fix computes 'valid' unconditionally and gates the submit on it ('if (valid)'), and the dropped '&& email' guard is correctly subsumed because an empty string fails the regex. The id + labelProps={{ htmlFor }} addition is a valid API (Input forwards labelProps to Field and forwards id to InputBase via rest props) and matches the skill's own accessibility note. The fix(create-bestax) scope is right, since the skill is bundled into create-bestax at its build time. Nothing here needs a human to block on; the reviewer can glance at the advisory and decide whether the Storybook showcase is worth syncing in a follow-up.

Residual risk:

  • Same stale-read shape elsewhere — refuted: grepping for the buggy guard across skills/, docs/, and bulma-ui/src surfaces only the intended file, the already-correct blog demo (from #471), and the onBlur handlers. No other copy teaches the buggy pattern.
  • The skill-examples Signup story carrying the same bug — refuted: it uses a submit-gated 'submitted ? errors[k] : undefined' pattern where errors is computed unconditionally from current state, so there is no stale-closure read. The PR's unaffected claim is accurate.
  • An invalid API being taught — refuted: reading Input.tsx and Field.tsx confirms labelProps is typed React.LabelHTMLAttributes (which includes htmlFor) and id lands in the rest props spread onto InputBase.

🏄 Total gnarly little closure riptide, dude: the old code let a bogus email slip past the break on the first paddle-out, but this patch reads the wave right off 'valid' and the a11y leash is finally clipped in. Clean set, no blockers, go ahead and drop in.

Per review: skills/CLAUDE.md requires the Storybook showcases to track
the canonical example, and the signup story's Name, Email, and Country
controls rendered labels without the id plus labelProps htmlFor wiring
the skill now teaches. Scoped to the signup story, which is the
showcase of the canonical example this PR changes.
Copilot AI review requested due to automatic review settings August 4, 2026 12:00
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Preview Deployment

Preview URL: https://d0646a81.bestax.pages.dev

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

skills/bestax-form/SKILL.md:156

  • The input is still type="email", so browsers can block the submit event for values that fail native email constraint validation. For example, pressing Enter while an unblurred field contains foo never reaches this handler, setTouched(true) does not run, and the canonical userland-validation example still does not show its inline error. Disable native validation with noValidate on this form (and the corresponding shipped demos) so the regex-based submit path handles every invalid value consistently.
        if (valid) {

@allxsmith
allxsmith merged commit 5770490 into main Aug 4, 2026
14 checks passed
@allxsmith
allxsmith deleted the fix/bestax-form-signup-submit branch August 4, 2026 12:21
@bestax-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 4.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bestax-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 5.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bestax-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bestax-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 2.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deep-review documentation Improvements or additions to documentation released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants