Skip to content

docs: make the API examples compile, render and read as written - #965

Merged
allxsmith merged 5 commits into
mainfrom
docs/943-api-examples
Oct 8, 2026
Merged

allxsmith merged 5 commits into
mainfrom
docs/943-api-examples

Conversation

@allxsmith

Copy link
Copy Markdown
Owner

A smoke test of the API pages in a fresh Vite react-ts app found examples that fail that template's type-check when pasted, a wrong prop, a React warning, two rendering problems, and a stale snippet on the Variations page.

Examples that started state as useState(null), an untyped empty array or an untyped date, and then handed the setter to a typed callback, now type that state. The main ones are Autocomplete, the date and time pickers, Taginput, Toast and Dialog, and the ref examples type their refs too. Literal arrays mapped into union-typed props use as const, and untyped helper parameters gain annotations. Where an example needs a library type, the fence carries an import type line, which the live preview drops like its other import lines.

Autocomplete's string examples narrow the selected item, its object example finds the pick in its own data so the fields stay typed, and the examples that never showed a selection lose the unused state. The item template uses isLight. Field's static Input gains readOnly, as the Input page already has. Collapse's triggers drop the white-ter background that left their text unreadable in dark mode. Rate's Field and Control example drops the Control icon that sat on its first star. The Tags example's dismissible tag now starts visible. The Variations page drops its unused React imports and shows the markup the prefixed example really renders. The MCP index is regenerated from the updated pages.

Every live fence under the docs was type-checked as its own module under the react-ts template's settings with TypeScript 6, and the API pages now pass, unused-locals checks included. The changed fences were also run through the site's live pipeline and rendered, and the affected pages were checked in the browser for the warnings and the dark-mode contrast.

Left out: some guide and skill pages fail the same check, a few of them with wrong prop names. They are outside this issue and are better handled in one of their own.

pnpm all passes locally.

Fixes #943

Pasted into a fresh Vite react-ts app, a run of API page examples failed its type-check.
State started as useState(null) or an untyped [] and was then handed to a typed callback,
and a few literal arrays were mapped into union-typed props. Each one now types its state or
parameters with an annotation, uses `as const` on a literal array, or imports the library type
it needs with `import type`, which the live preview drops like any other import line.

Autocomplete's string examples narrow the selected item, the object example finds the pick in
its own data, and the examples whose selection was never shown lose the unused state. Its item
template tag uses isLight instead of the unknown light prop.

Field's static Input gains readOnly, as the Input page already has. Collapse's triggers drop the
white-ter background that left their text unreadable in dark mode. Rate's wrapper example drops
the Control icon that sat on its first star. The Tags dismissible tag now starts visible.

The Variations page drops its unused React imports and shows the markup the prefixed example
really renders. The MCP index is regenerated from the updated pages.
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: allxsmith/bestax/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cf23c8cd-1717-4b6e-9375-fb6a99f17d49
📥 Commits

Reviewing files that changed from the base of the PR and between 77e5c6d and cdbaab8.

📒 Files selected for processing (60)
  • bestax-mcp/data/catalog.json
  • bestax-mcp/data/components/Autocomplete.json
  • bestax-mcp/data/components/Avatar.json
  • bestax-mcp/data/components/Button.json
  • bestax-mcp/data/components/Buttons.json
  • bestax-mcp/data/components/Carousel.json
  • bestax-mcp/data/components/Collapse.json
  • bestax-mcp/data/components/DateInput.json
  • bestax-mcp/data/components/DateRangeInput.json
  • bestax-mcp/data/components/DateTimeInput.json
  • bestax-mcp/data/components/Dialog.json
  • bestax-mcp/data/components/Dropdown.json
  • bestax-mcp/data/components/Field.json
  • bestax-mcp/data/components/Link.json
  • bestax-mcp/data/components/LinkButton.json
  • bestax-mcp/data/components/Menu.json
  • bestax-mcp/data/components/Modal.json
  • bestax-mcp/data/components/Navbar.json
  • bestax-mcp/data/components/Panel.json
  • bestax-mcp/data/components/Rate.json
  • bestax-mcp/data/components/SubTitle.json
  • bestax-mcp/data/components/Switch.json
  • bestax-mcp/data/components/Tag.json
  • bestax-mcp/data/components/Taginput.json
  • bestax-mcp/data/components/Tags.json
  • bestax-mcp/data/components/TimeInput.json
  • bestax-mcp/data/components/Title.json
  • bestax-mcp/data/components/Toast.json
  • bestax-mcp/data/components/useBulmaClasses.json
  • docs/docs/api/components/avatar.md
  • docs/docs/api/components/carousel.md
  • docs/docs/api/components/collapse.md
  • docs/docs/api/components/dialog.md
  • docs/docs/api/components/dropdown.md
  • docs/docs/api/components/menu.md
  • docs/docs/api/components/modal.md
  • docs/docs/api/components/navbar.md
  • docs/docs/api/components/panel.md
  • docs/docs/api/components/toast.md
  • docs/docs/api/elements/button.md
  • docs/docs/api/elements/buttons.md
  • docs/docs/api/elements/link.md
  • docs/docs/api/elements/linkbutton.md
  • docs/docs/api/elements/subtitle.md
  • docs/docs/api/elements/tag.md
  • docs/docs/api/elements/tags.md
  • docs/docs/api/elements/title.md
  • docs/docs/api/form/autocomplete.md
  • docs/docs/api/form/checkboxes.md
  • docs/docs/api/form/datetime/dateinput.md
  • docs/docs/api/form/datetime/daterangeinput.md
  • docs/docs/api/form/datetime/datetimeinput.md
  • docs/docs/api/form/datetime/timeinput.md
  • docs/docs/api/form/field.md
  • docs/docs/api/form/radios.md
  • docs/docs/api/form/rate.md
  • docs/docs/api/form/switch.md
  • docs/docs/api/form/taginput.md
  • docs/docs/api/helpers/usebulmaclasses.md
  • docs/docs/guides/getting-started/variations.md
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Preview Deployment

Preview URL: https://4d1f1d0f.bestax.pages.dev

@allxsmith

Copy link
Copy Markdown
Owner Author

deep-review: fresh

The previous run was cancelled at the runner limit before it posted anything, so this asks for the same full review again. The change is the tsx live examples on the API pages under docs/docs/api/, plus the Variations page; read those for whether each example still shows what its section says, compiles as written, and renders. The files under bestax-mcp/data/ are regenerated from these pages by pnpm gen:mcp and CI's gen:mcp:check holds them to the source, so they don't need a line-by-line read.

Comment thread docs/docs/api/helpers/usebulmaclasses.md Outdated
Comment thread docs/docs/api/form/autocomplete.md Outdated
Comment thread docs/docs/api/components/collapse.md

@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 · 3 advisory

# Severity Area Finding Location
1 🔵 Advisory API BulmaClassesProps annotation makes rest statically {}, so the example can no longer show the forwarding the prose above it describes docs/docs/api/helpers/usebulmaclasses.md:201
2 🔵 Advisory Robustness Both object-data examples recover the typed item by reference equality, which onSelect's contract does not promise docs/docs/api/form/autocomplete.md:164
3 🔵 Advisory Correctness Dark-mode contrast is fixed by deleting the trigger's background outright, leaving no header affordance in either scheme docs/docs/api/components/collapse.md:44

Overall: Sound, and the evidence holds up end to end — every claim in #943 maps to a real defect and to a fix I could verify against the source. The six interesting ones: Tag's prop really is isLight (elements/Tag.tsx:44); Input isStatic with a value and no handler really does warn, and readOnly is what the Input page already uses; Control iconLeftName really did overlay Rate's first star; Title size={2} really renders <h2 class="title is-2"> (elements/Title.tsx:89-99) and helper classes really are prefixed (useSpacingClasses.tsx:95-155), so the rewritten Variations snippet bestax-title bestax-is-2 / bestax-button bestax-is-primary bestax-mt-3 matches the real output in both name and order; useState() with no argument really did leave show undefined, so the dismissible tag was invisible. Every new annotation checks out against the declared types — the four import type names are all genuinely exported (ToastPosition, TaginputTag, BulmaClassesProps, and AutocompleteItem by name in the prose), the six forwarded-ref element types each match what the component casts to (PolymorphicComponent<…, 'button' | 'a' | 'figure'>, forwardRef<HTMLDivElement | HTMLElement, …>), and the four as const unions are each exactly the prop's declared union. The import type lines are safe in the live previews: transformCode drops any line starting with import (docs/src/theme/CodeBlock/index.js:31-43), and the fence gate mirrors that predicate exactly in asRendered, so the site and the test agree. The riskiest part is advisory #2 — reference-equality lookup in two examples, including the itemTemplate one where a miss blanks every dropdown row. Look at that first, then advisory #1, which is the one a reader actually trips over while adapting the snippet.

Residual risk:

  • A fence that parses but no longer type-checks. Refuted as covered: scripts/eslint-plugin-docs.test.mjs parses every jsx/tsx fence under docs/docs and skills with @typescript-eslint/parser (jsx + latest), so the ~25 added useState<…> generics and ~12 as const wrappers are held to being parseable TSX, and a fence that parses no way at all fails the suite. What it does not do is resolve types, so the exact class #943 reported can still land; that gap, and the per-fence compile that would close it, is #961.
  • A live preview that compiles but throws in the browser. Open, and structural: previews are BrowserOnly + IntersectionObserver-deferred, so the Docusaurus build never evaluates one. react-live wraps the whole fence as return (<code>) (generateElement, react-live@5.0.0), which holds only because each changed fence is a single statement after the import strip — all of them are, and the gate above would catch a fence that stopped being one, but a render-time error stays invisible to CI either way.
  • The same defects surviving elsewhere. Refuted by sweep: no useState(null) / useState() / useRef(null) / useState([]) remains anywhere under docs/docs/api, no isStatic with a value and no readOnly remains in the repo, no color="info" light and no white-ter background remain in docs, skills or bulma-ui/src. The deferred guide and skill pages are enumerated in #961 with the wrong prop names named individually, so the PR body's "left out" paragraph is tracked rather than dropped.
  • A stale generated index. Refuted by inspection: bestax-mcp/data/components/*.json moves in lockstep with the pages it is derived from (spot-checked Collapse and Toast, including the embedded import type line), and gen:mcp:check holds it in CI.
  • A missing skills/ update. Refuted: none of the four corrected patterns appears under skills/, so there is nothing in this PR for the same-PR skills rule to carry.

🏄 Someone actually paddled out and surfed every example on these pages instead of reading them from the beach, and it shows — wrong prop, phantom warning, a star with an icon parked on it, all cleaned up, and the Variations markup finally matches the wave it claims to be. Three mellow notes to chew on, nothing holding it back. Good to go.

Main's MCP catalog still names 5.26.6 after the 5.27.0 release, so pnpm gen restamps it.
DateRangeInput's page arrived with the merge from main and starts its Controlled example from
useState([null, null]), which the template's type-check reads as null[] and refuses to hand to
onChange. It now types the state as DateRangeValue, imported with import type, and the
weekend predicate types its date, the pattern the other picker pages already follow.
…ue, border Collapse

MyColumns typed its props as the helper props alone, so rest had nothing in it and a reader
passing an id got a type error on the page that teaches rest. It now takes the div's own props
too. The Autocomplete object examples found the picked item by reference, which only holds while
the component hands back the array's own objects, so they look it up by value instead. The
Collapse examples lost their light header plate for dark mode and with it any sign the header
is clickable, so they use the component's bordered prop, which reads in both schemes.
@allxsmith

Copy link
Copy Markdown
Owner Author

deep-review: verify

Every open thread has a reply: fixed, with the commit, or refuted with a reason. This settles them on cdbaab8.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Preview Deployment

Preview URL: https://646dddd2.bestax.pages.dev

@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 (verify) — 3 resolved · 0 open

# Severity Area Finding Location
1 🔵 Advisory API Annotation rested away on the page that teaches rest — verified fixed docs/docs/api/helpers/usebulmaclasses.md:201
2 🔵 Advisory Robustness Object examples rested on an undocumented identity guarantee — verified fixed docs/docs/api/form/autocomplete.md:164
3 🔵 Advisory Correctness Collapse triggers lost every affordance along with the hardcoded plate — verified fixed docs/docs/api/components/collapse.md:45

Overall: This pass settled the threads the earlier review left open and reviewed no commits. All three were 🔵 Advisory and all three are genuinely addressed by cdbaab8e: MyColumns now takes BulmaClassesProps & React.ComponentPropsWithoutRef<'div'>, so rest carries the div attributes the prose promises; both Autocomplete object examples look the picked item up by value instead of by reference, within the declared AutocompleteItem | string | null signature; and every Collapse example uses the component's own bordered prop, whose border resolves through the scheme-derived --bulma-border, so the header reads in light and dark with no hardcoded white-ter. Nothing is left for a human to arbitrate.

Residual risk:

  • Docs fences are still unexecuted and untyped — open, and unchanged by this PR. docs/ has no tsconfig.json and no jest suite, so the three corrected snippets are verified by reading the library's declarations (useBulmaClasses.tsx:77-83, Autocomplete.tsx:106,112), not by a compiler. A later signature change can re-break any of them silently.
  • Helper-prop / DOM-attribute collisions in the new MyColumns annotation — refuted. I enumerated the keys of BulmaColorProps, BulmaSpacingProps, BulmaTypographyProps, BulmaVisibilityProps, BulmaFlexboxProps and BulmaOtherProps against React.HTMLAttributes; none collide (color lives on AllHTMLAttributes, not HTMLAttributes), so the intersection yields no never property and the example's own textAlign/textTransform still compile.
  • Generated MCP index drifting from the edited pages — refuted. cdbaab8e regenerated bestax-mcp/data/components/{Autocomplete,Collapse,useBulmaClasses}.json in the same commit, and the recorded code strings match the new fences, so gen:mcp:check has nothing stale to catch.

🏄 Three mellow advisories rolled in, three paddled back out — the docs now actually do what their own prose says they do. Clean set, no wipeouts, good to go.

@github-actions github-actions Bot added the review-converged Deep review converged: no blocking findings, all review threads resolved, checks green label Oct 8, 2026
@allxsmith allxsmith added the needs-human-review Loop converged (or contested): awaiting owner review + manual merge label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

📸 Story screenshots at handoff — cdbaab8

No Storybook stories map to this PR's changed files — nothing to screenshot. (workflow run)

@bestax-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 5.27.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bestax-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 4.2.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bestax-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 2.25.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bestax-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 1.14.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 needs-human-review Loop converged (or contested): awaiting owner review + manual merge released review-converged Deep review converged: no blocking findings, all review threads resolved, checks green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API docs examples that don't compile, warn, or render badly

1 participant