Skip to content

feat(ui): add bounded adapter foundations - #3252

Merged
kwakayama merged 19 commits into
mainfrom
codex/ui-adapter-core-conformance-20260802
Aug 2, 2026
Merged

kwakayama merged 19 commits into
mainfrom
codex/ui-adapter-core-conformance-20260802

Conversation

@kojiwakayama

@kojiwakayama kojiwakayama commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a dependency-free UIAdapterProvider with explicit, fail-safe partial composition
  • add production-hardened builtin adapter slots for disclosure, toast, toggle groups, and toolbars
  • ship Accordion, Toast, ToggleGroup, and Toolbar public primitives with colocated Storybook documentation and Overview navigation
  • add independent-adapter conformance suites proving each contract is a real substitution seam
  • enforce the core UI primitive-engine dependency boundary

Safety and bounds

  • disclosure content remains mounted with stable ARIA control wiring and respects disabled or cancelled events
  • disabled slotted links and buttons are blocked at the shared Slot boundary for primary, auxiliary, and keyboard activation
  • toast queues are explicitly bounded with oldest-first eviction and validated durations and capacity
  • toast consumers use a stable context bridge, so swapping adapters with different hook implementations cannot violate React hook ordering
  • toolbar roving focus survives rerenders and follows RTL visual arrow direction
  • adapter composition enumerates known slots, so undefined entries cannot erase builtin behavior
  • browser-only layout work uses the shared isomorphic effect boundary for SSR safety
  • core remains free of third-party UI engines

Deliberate extraction boundary

This is a source-only extraction from #3185 onto the UI foundation merged in #3246. It intentionally does not transplant the recovered Popover, Dialog, Menu, Select, Tooltip, Drawer, or Combobox adapters: review found those implementations predate #3246 accessibility and lifecycle hardening and would regress it. Those surfaces require a separate migration that preserves the #3246 state machines intact.

Verification

  • rebased onto exact main commit 7250d13b3; all nine child commits are patch-equivalent by git range-diff
  • deno task verify:quick
  • full React suite: 187 suites / 1,102 steps green
  • deno task storybook:check (13 steps green)
  • changed package-metadata, API-reference, and framework-candidate tests green
  • deno task lint:test-typecheck (64 grandfathered files, 0 new)
  • generated manifests are current
  • git diff --check

@kojiwakayama
kojiwakayama requested a review from kwakayama as a code owner August 2, 2026 13:10

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a21d9e5092

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/react/components/ui/toggle-group.tsx
Comment thread src/react/components/ui/adapter/builtin/toggle-group.tsx
Comment thread src/react/components/ui/accordion.tsx Outdated
@kojiwakayama

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea281e1f7e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/react/components/ui/adapter/contract.ts
Comment thread src/react/components/ui/adapter/builtin/toggle-group.tsx Outdated
Comment thread src/react/components/ui/toast.tsx Outdated
@kojiwakayama

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 372cd30b4b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/react/components/ui/adapter/builtin/toggle-group.tsx
Comment thread src/react/components/ui/adapter/builtin/disclosure.tsx
@kojiwakayama
kojiwakayama force-pushed the codex/ui-adapter-core-conformance-20260802 branch from bfd6fb0 to a46c492 Compare August 2, 2026 16:08
@kojiwakayama
kojiwakayama force-pushed the codex/react-ui-workflow-hardening-train-20260802 branch 2 times, most recently from c8eaebd to 7fb43e5 Compare August 2, 2026 17:45
@kojiwakayama
kojiwakayama force-pushed the codex/ui-adapter-core-conformance-20260802 branch 6 times, most recently from c3ea04f to 6d28f4c Compare August 2, 2026 18:15
Base automatically changed from codex/react-ui-workflow-hardening-train-20260802 to main August 2, 2026 18:37
@kojiwakayama
kojiwakayama requested review from Copilot and removed request for Copilot August 2, 2026 18:39
@kojiwakayama
kojiwakayama force-pushed the codex/ui-adapter-core-conformance-20260802 branch from 6d28f4c to 2722510 Compare August 2, 2026 18:39
@kojiwakayama

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2722510701

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/react/components/ui/toggle-group.tsx Outdated
Comment thread src/react/components/ui/adapter/contract.ts Outdated
Copilot AI review requested due to automatic review settings August 2, 2026 18:49
@kojiwakayama

Copy link
Copy Markdown
Contributor Author

@codex review

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

This PR introduces a dependency-free UI adapter layer in src/react/components/ui/adapter/ and routes new primitives (Accordion, Toast, ToggleGroup, Toolbar) through adapter “mechanics” while keeping the public skins lightweight and theme-token based.

Changes:

  • Adds UIAdapterProvider + a typed adapter contract, with builtin slots for disclosure, toast, toggle-group, and toolbar.
  • Ships new public UI primitives (Accordion, Toast, ToggleGroup, Toolbar) plus Storybook docs and overview navigation.
  • Adds adapter conformance suites and expands module-boundary guards to enforce “no third-party UI engine” imports in core.

Verification

  • Not run in this review environment. Recommended:
    • deno test --no-check --allow-all --quiet src/react/components/ui
    • deno task test -- scripts/docs
    • deno task storybook:check

Reviewed changes

Copilot reviewed 33 out of 34 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
storybook/stories/ui/Toolbar.stories.tsx Adds Storybook docs/examples for Toolbar.
storybook/stories/ui/ToggleGroup.stories.tsx Adds Storybook docs/examples for ToggleGroup (includes a controlled example).
storybook/stories/ui/Toast.stories.tsx Adds Storybook docs/examples for Toast provider and API usage.
storybook/stories/ui/Accordion.stories.tsx Adds Storybook docs/examples for Accordion.
storybook/stories/Overview.stories.tsx Registers new UI stories in the Overview navigation grid.
src/server/handlers/dev/framework-candidates.generated.test.ts Ensures new class candidates used by adapter-backed primitives are in the framework candidate set.
src/react/components/ui/toolbar.tsx Adds Toolbar skin routed through the adapter toolbar slot.
src/react/components/ui/toggle-group.tsx Adds ToggleGroup skin routed through the adapter toggleGroup slot.
src/react/components/ui/toast.tsx Adds adapter-routed Toast provider + stable context bridge (useToast).
src/react/components/ui/toast-parts.tsx Adds adapter-independent presentational toast parts + duration validation + auto-dismiss logic.
src/react/components/ui/slot.tsx Strengthens disabled Slot activation blocking across click/auxclick/keyboard.
src/react/components/ui/slot.test.tsx Expands coverage for disabled activation blocking and propagation suppression.
src/react/components/ui/index.ts Exposes new primitives and adapter surfaces on the public veryfront/ui barrel.
src/react/components/ui/index.test.ts Updates the “expected runtime exports” snapshot to include new runtime exports.
src/react/components/ui/boundary.test.ts Adds a module-boundary test to guard against third-party UI engine imports in core ui/**.
src/react/components/ui/adapter/toolbar.conformance.test.tsx Adds adapter conformance tests for the toolbar slot (builtin + independent adapter).
src/react/components/ui/adapter/toggle-group.conformance.test.tsx Adds adapter conformance tests for the toggleGroup slot (builtin + independent adapter).
src/react/components/ui/adapter/toast.conformance.test.tsx Adds adapter conformance tests for the toast slot (builtin + independent adapter + switching).
src/react/components/ui/adapter/disclosure.conformance.test.tsx Adds adapter conformance tests for the disclosure slot (builtin + independent adapter).
src/react/components/ui/adapter/contract.ts Defines the public adapter contract types (new veryfront/ui/adapter surface).
src/react/components/ui/adapter/context.tsx Implements UIAdapterProvider and useAdapter with explicit slot-by-slot merging.
src/react/components/ui/adapter/builtin/toolbar.tsx Implements builtin toolbar roving-focus mechanics as ToolbarParts.
src/react/components/ui/adapter/builtin/toggle-group.tsx Implements builtin toggle-group selection mechanics as ToggleGroupParts.
src/react/components/ui/adapter/builtin/toast.tsx Implements builtin toast queue + viewport + imperative API as ToastParts.
src/react/components/ui/adapter/builtin/index.ts Assembles the builtin adapter map.
src/react/components/ui/adapter/builtin/disclosure.tsx Implements builtin disclosure mechanics as DisclosureParts.
src/react/components/ui/accordion.tsx Adds Accordion skin coordinated by Accordion, with item mechanics routed through the disclosure slot.
src/react/components/ui/accordion.behaviour.test.tsx Adds end-to-end behavioural tests for Accordion + disclosure-slot wiring + hydration.
scripts/docs/generate-api-reference.ts Improves deep-import sample generation to emit import type for type-only barrels.
scripts/docs/generate-api-reference.test.ts Adds a regression assertion for import type generation on type-only deep imports.
scripts/build/npm-package-metadata.test.ts Asserts veryfront/ui/adapter is exported via deno.json exports/imports.
docs/api-reference/veryfront/ui.md Updates generated UI API reference to include new exports and deep import section.
deno.json Exposes ./ui/adapter and veryfront/ui/adapter as a public subpath.

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

Comment thread storybook/stories/ui/ToggleGroup.stories.tsx Outdated
Comment thread src/react/components/ui/boundary.test.ts

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd4a2414cd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/react/components/ui/adapter/contract.ts
Comment thread docs/api-reference/veryfront/ui.md Outdated

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 34 out of 35 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/react/components/ui/toolbar.tsx:117

  • ToolbarLink cannot be disabled via the shared Slot disabled gate. Because ToolbarLinkProps extends AnchorHTMLAttributes, consumers cannot pass disabled, so slotted links cannot be blocked the same way as other adapter-routed controls. If you intend disabled links to be supported (and styled) consistently with the Slot boundary, accept a disabled prop, forward it to toolbar.Item (so Slot receives it), and add aria-disabled:* styles so anchors show the disabled state (they will not get a native disabled attribute).
/** Props accepted by `<ToolbarLink>`. */
export interface ToolbarLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
  /** React 19: ref is a regular prop. */
  ref?: React.Ref<HTMLAnchorElement>;
}

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 393b9cb295

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/react/components/ui/collapsible.tsx Outdated
Comment thread src/react/components/ui/accordion.tsx
Comment thread src/react/components/ui/adapter/builtin/toast.tsx Outdated
Copilot AI review requested due to automatic review settings August 2, 2026 20:07
@kojiwakayama

Copy link
Copy Markdown
Contributor Author

Addressed the latest exact-head review findings in commit 4c48499:

  • made Collapsible SSR fail closed for unresolved part-owned ID references, while root-owned IDs provide complete static linkage
  • coordinated Accordion composed-child IDs across SSR, hydration, builtin adapters, and independent adapters
  • preserved valid falsy Toast React nodes such as numeric zero and empty strings
  • added disabled ToolbarLink behavior through the adapter/Slot activation boundary
  • extracted one shared disclosure ID registry instead of duplicating traversal or mutable render-time state

Validation is green locally: verify:quick; 187 React suites / 1,130 steps; docs generator; Storybook; and test-typecheck baseline. The synthetic merge against current main ef22006 is clean with no overlapping files.

@codex review

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 36 out of 37 changed files in this pull request and generated no new comments.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c48499003

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/react/components/ui/adapter/contract.ts Outdated
Comment thread src/react/components/ui/adapter/builtin/toolbar.tsx
Comment thread src/react/components/ui/toast-parts.tsx Outdated
Copilot AI review requested due to automatic review settings August 2, 2026 20:22
@kojiwakayama

Copy link
Copy Markdown
Contributor Author

Addressed the exact-head review findings in commit 3d19b29:

  • made composed disabled toolbar semantics a normative adapter contract and exercised click, auxiliary, Enter, and Space paths against builtin and independent adapters
  • rehomes focus and the roving stop when the focused toolbar item becomes disabled or disappears, with cross-document-safe blur ownership
  • preserves localized ToastClose aria-label values while retaining the English default

Validation is green locally: verify:quick; focused adapter suites (42 steps); full React suite (188 suites / 1,133 steps); docs generator; Storybook; and test-typecheck baseline. The one 1 ms SSR deadline test that flaked under concurrent load passed alone and again in the clean full-suite rerun. Synthetic merge against current main 847b50d is clean with no overlapping files.

@codex review

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 36 out of 37 changed files in this pull request and generated no new comments.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d19b295a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/react/components/ui/adapter/contract.ts
Comment thread src/react/components/ui/adapter/toolbar.conformance.test.tsx
Copilot AI review requested due to automatic review settings August 2, 2026 22:29

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 36 out of 37 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/react/components/ui/toolbar.tsx:91

  • ToolbarButton does not set a safe default type. If an adapter’s toolbar.Item renders a native <button> without explicitly applying type="button", using ToolbarButton inside a <form> will default to type="submit" and can trigger unintended form submits. Other UI button-like primitives in this codebase defensively default to button when not asChild (e.g. src/react/components/ui/button.tsx:147).
export function ToolbarButton({ className, ...props }: ToolbarButtonProps): React.ReactElement {
  const { toolbar } = useAdapter();
  return (
    <toolbar.Item

Copilot AI review requested due to automatic review settings August 2, 2026 22:37

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 36 out of 37 changed files in this pull request and generated no new comments.

@kwakayama
kwakayama enabled auto-merge August 2, 2026 22:46
@kwakayama
kwakayama added this pull request to the merge queue Aug 2, 2026
Merged via the queue into main with commit 22274e6 Aug 2, 2026
32 checks passed
@kwakayama
kwakayama deleted the codex/ui-adapter-core-conformance-20260802 branch August 2, 2026 22:56
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.

3 participants