Skip to content

Cmdk binding - #210

Merged
trueadm merged 26 commits into
octanejs:mainfrom
mrdiyorbek-juraev:cmdk-port-plan
Jul 27, 2026
Merged

trueadm merged 26 commits into
octanejs:mainfrom
mrdiyorbek-juraev:cmdk-port-plan

Conversation

@mrdiyorbek-juraev

@mrdiyorbek-juraev mrdiyorbek-juraev commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds @octanejs/cmdk, the [email protected] command menu ported to octane: the full Command namespace, useCommandState, the vendored scorer, and Command.Dialog over @octanejs/radix.
  • Ranks filtered results with CSS order rather than by relocating DOM nodes, which is what upstream does and what octane's comment-fenced ranges cannot tolerate.
  • Fixes three defects found in review that the suite passed over, each now covered by a test with a proven pre-fix failure.

Why

cmdk is DOM-authoritative: it hides items by unmounting them and ranks matches by physically appendChild-ing nodes into the list. Octane fences every component's DOM with comment markers and tracks the range between them, and a template construct like @for or @if wraps each item in a second, outer range. That seam is where the port's real bugs lived:

  1. An item mounted while a search was active never rendered unless it carried an explicit value — the single most common real-world flow, since results arrive while the user types. Unscored was treated as scored-zero, which deadlocks: the item renders null, so ref.current stays null, so useValue has no textContent to infer from, so it registers empty and scores zero forever. Upstream cannot reach this because it reads the value out of props.children synchronously. Both existing async fixtures passed a value, which is why it was invisible.

  2. Ranking orphaned DOM nodes. Relocating an item carried it out of every enclosing range at once, so a @for later cleared an emptied range and the real node survived forever — every item stacked above "No results found.". moveWithMarkers only ever repaired the innermost range, so it broke again at each new nesting construct.

  3. Removing the selected item alongside a sibling left nothing selected. All item teardowns scheduled under one batcher key, and the batcher is a Map, so the last teardown overwrote the rest and the surviving callback had captured a different selectedItem.

Ranking declaratively removes the whole class of bug rather than an instance of it, and it makes source order come back for free when the search clears — physical reordering left a residue that accumulated across searches and never recovered.

Changes

packages/cmdk (33 files)

  • sort() assigns CSS order inside a flex container instead of moving nodes; moveWithMarkers is gone. Item and group rank spaces are kept disjoint so the sizer's ungrouped items and group hosts cannot tie.
  • getValidItems() walks the ranked containers so selection and arrow-key navigation agree with what is on screen, with the flat query kept as a fast path when no filter is active and DOM order already is visual order.
  • Items with no score entry render once so useValue can infer from textContent.
  • Registration teardowns are keyed per item; the force-mount path no longer shares one key between its mount emit and its teardown re-select.
  • status.json divergence rewritten for the ranking model; the entry describing the residual-order bug is deleted.
  • @octanejs/radix moves to workspace:*, required by the sibling rule this branch merges in (see follow-ups).

Elsewhere: playground cmdk demo (its styles live in playground.css in shadcn tokens, since upstream retired the inline <style> block), MCP bridge entry, root typecheck chain, and the generated inventories.

Two tests were pinning bugs as contracts and now assert parity: restores every item when the search is cleared asserted the scrambled residue, and the differential's clearing restores every item documented it as a divergence from React. That checkpoint now compares the whole tree instead of a few hand-picked values. The filtering checkpoints strip only the three ranking declarations, so every other attribute and node still compares byte-for-byte.

Validation

  • pnpm format:check — clean
  • pnpm typecheck — not run in full. tsrx-tsc --noEmit -p packages/cmdk/tsconfig.json is clean.
  • pnpm test — not run in full. The root invocation recurses into fixture node_modules in this checkout and is not a usable signal.
  • targeted tests: vitest --project cmdk --project cmdk-ssr — 53 passed, covering behaviour, SSR, hydration and the differential rig against real [email protected] on React.
  • rules:check, packages:inventory:check, binding-parity:gaps:check, bindings:status:check, changeset:check, test:markers:check, tsrx-decls:check, context:budget:check — all pass.

Each of the three fixes has a regression test whose pre-fix failure was observed, not assumed:
expected [ 'Apple' ] to deeply equal [ 'Apple', 'Apricot' ], expected [ 'Apple', 'Banana', 'Salad' ] to deeply equal [], and no element matching [cmdk-item][aria-selected="true"].

Risk / follow-ups

  • Divergence traded, not removed. The list sizer and each group's item container are flex columns while a filter is active, so a consumer relying on physical DOM order (:nth-child styling, drag handles) or on a custom container display diverges from upstream. Recorded in status.json.
  • Untested shape: a menu mixing ungrouped items with groups under an active search. The rank spaces are disjoint by construction, but no fixture exercises it.
  • The @octanejs/radix pin was reversed by upstream, not by choice. It was pinned to the published 0.1.12 on maintainer request so the port exercised the release consumers install. The merge brings in validateWorkspacePackages, which rejects any sibling edge that is not workspace:*; keeping the pin now fails packages:inventory:check with packages/cmdk dependencies.@octanejs/radix must be "workspace:*". Worth a maintainer's confirmation that the dogfooding intent is satisfied another way.
  • Known, unaddressed: an all-forceMount menu never auto-selects (inherited from upstream, but the port half-adopted force-mounted items into the registration model); two Command.Lists under one Command emit duplicate ids; context.label is dead (faithful to upstream). Each is a small follow-up rather than a blocker.

Note

Medium Risk
New UI binding with intentional upstream divergences (flex order while filtering, SSR empty behavior) and broad command-menu registration/teardown paths; well-tested but affects accessibility and async result lists.

Overview
Introduces @octanejs/cmdk ([email protected]): the full Command surface, store, filtering, keyboard navigation, useCommandState, vendored scorer, and Command.Dialog on @octanejs/radix, plus repo wiring (typecheck, vitest projects, generated binding docs, changeset).

Ranking no longer appendChild-reorders nodes (which broke Octane comment-fenced ranges inside keyed @for / @if and left orphan items). While a filter is active, the list sizer and group item containers become flex columns and matches are ordered via order; clearing the search drops those styles and restores source order. Selection, arrows, and alt+arrow group stepping use the same visual order.

Correctness fixes: items without a score yet render once so textContent value inference works when results arrive mid-search; per-item registration teardown keys fix losing selection when removing the selected item with a sibling; force-mounted / group value registration is refreshed and ranked so stale scores and empty-state clashes don’t win; controlled selection keeps input/list aria-activedescendant in sync.

@octanejs/radix is workspace:* (replacing a pinned published version). Behavioral, SSR, hydration, and differential tests against real cmdk on React are included; active filter ranking is a documented divergence from physical DOM order.

Reviewed by Cursor Bugbot for commit a548bfc. Bugbot is set up for automated code reviews on this repo. Configure here.

mrdiyorbek-juraev and others added 2 commits July 21, 2026 02:16
A faithful port of [email protected] (dip/cmdk) onto the octane renderer: the full
Command namespace (Command/Root, Input, List, Item, Group, Separator, Dialog,
Empty, Loading), useCommandState, and defaultFilter, with the DOM-authoritative
store, item/group registration, textContent value inference, onInput-driven
search, score filtering + DOM sort, keyboard navigation (arrows/Home/End/vim/
Enter), controlled value/loop/shouldFilter/custom filter, a radix-backed
Command.Dialog, and SSR + hydration.

Authored in idiomatic .tsrx and split into focused modules (barrel + components/,
hooks.tsrx, context.tsrx, lib/) with a single .tsrx.d.ts sidecar. Covered by 26
behavioral + hydration + SSR tests.

Octane divergences (documented in status.json / the file header): ref-as-prop
(no forwardRef); native onInput instead of synthetic onChange; value inferred
from the value prop or rendered textContent (opaque compiled children); sort()
reorders only surviving items so hydrated unmounts don't orphan moved nodes;
asChild is unsupported (SlottableWithNestedChildren has no faithful equivalent).

Registers the package across the workspace: catalog + lockfile, the typecheck
tsgo entry, cmdk + cmdk-ssr vitest projects, the MCP bridge, website bindings
list + llms.txt, and the generated docs (packages.md, bindings-status.md,
binding-parity-gaps.md), rulesync outputs, and evals corpus.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Integrate the latest upstream (6 commits: self-contained TanStack Start,
SSR livelock fix, native-change timing, SSR/TTFB + tanstack-com benchmarks,
and the Version Packages release) while preserving the @octanejs/cmdk port.

Conflict resolution:
- package.json: union of upstream's tanstack-start/typetests tsgo entry and the
  cmdk tsgo entry.
- pnpm-lock.yaml: took upstream, then pnpm install re-reconciled cmdk.
- Generated files regenerated (not hand-edited): docs/packages.md,
  docs/bindings-status.md, docs/binding-parity-gaps.md, the evals corpus
  manifest/training, and the rulesync targets.
- website/src/routes/* and routeTree.gen.ts: took upstream's versions (the
  branch made no intentional route changes; upstream owns the
  @tanstack/octane-router -> @octanejs/tanstack-router migration).

Verified: packages/cmdk + docs/cmdk-port-plan.md are byte-identical to the
pre-merge commit (ec07498); cmdk tsrx-tsc/tsgo clean; 26/26 cmdk tests pass;
repo-wide format:check clean; bindings/inventory/rules/parity-gaps/markers OK.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

@mrdiyorbek-juraev is attempting to deploy a commit to the Ripple Team Team on Vercel.

A member of the Team first needs to authorize it.

@WebEferen

WebEferen commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Took a deeper pass through the port. Really solid overall - it reads very close to upstream and the registration is complete. A few things need fixing before this lands though:

1. Group value registration is broken (the big one). Octane compiles custom-hook calls as withSlot(sym, hook, ...args, sym) - the trailing slot symbol becomes an extra argument. Group's 3-arg useValue(id, ref, [props.value, headingRef]) (src/components/group.tsrx:30) puts that symbol into the aliases param (the = [] default only fires on undefined), so aliases.map throws at src/hooks.tsrx:60 on every render. Run the cmdk project with --reporter=verbose and you'll see the TypeError 5x while all 25 tests stay green. Net effect: groups never register a value, never get data-value, and the group-reorder branch in sort() (src/components/command.tsrx:267-272) can never match - grouped results don't reorder by score. Fix: pass [] explicitly at the Group call site and harden useValue against non-array aliases; add a test asserting group data-value + grouped score ordering (and ideally failing on console noise - that's what let this slip through). Side note: the trailing-symbol thing is a core footgun (any custom hook with an optional trailing param hits it) - probably worth a compiler diagnostic as a separate follow-up.

2. status.json contradicts itself. surface still says "SSR/hydration are not yet covered" while ssr says "Supported and tested"; verified: 2026-07-20 predates the phase-5 stamps; notes still says "Port in progress"; and the README still says only the scorer is available. All of it flows into docs/bindings-status.md verbatim. Update packages/cmdk/status.json + README.md, then pnpm bindings:status.

3. --cmdk-list-height is missing and unrecorded. Upstream List keeps that CSS var updated via a ResizeObserver (upstream index.tsx ~840-857); the port only has a "later phase" comment in src/components/list.tsrx. Either implement it (~15 lines, nothing octane-specific in the way) or record it in status.json surface/divergences so the table doesn't over-promise.

4. The batcher's catch {} in src/hooks.tsrx:82-88 swallows user callbacks too - a throwing onValueChange just disappears (controlled path: schedule(1, selectFirstItem) → setState('value') → onValueChange). It's also silently eating a jsdom scrollIntoView throw in every test run today. Guard just the scrollIntoView call (or rethrow async), and if the isolation stays, list it in status.json divergences with the others.

5. Phases 1-3 exit criteria are differential parity, but there's no tests/differential/ - and the Phase 2 stamp doesn't carry the deferral caveat the others do. Either land the differential layer (sonner's globalSetup wiring in vitest.config.js is the template; the devDeps are already staged) or restate the stamps - right now the plan doc claims evidence that doesn't exist.

Happy to re-review once 1-3 are in.

@mrdiyorbek-juraev

Copy link
Copy Markdown
Contributor Author

Took a deeper pass through the port. Really solid overall - it reads very close to upstream and the registration is complete. A few things need fixing before this lands though:

1. Group value registration is broken (the big one). Octane compiles custom-hook calls as withSlot(sym, hook, ...args, sym) - the trailing slot symbol becomes an extra argument. Group's 3-arg useValue(id, ref, [props.value, headingRef]) (src/components/group.tsrx:30) puts that symbol into the aliases param (the = [] default only fires on undefined), so aliases.map throws at src/hooks.tsrx:60 on every render. Run the cmdk project with --reporter=verbose and you'll see the TypeError 5x while all 25 tests stay green. Net effect: groups never register a value, never get data-value, and the group-reorder branch in sort() (src/components/command.tsrx:267-272) can never match - grouped results don't reorder by score. Fix: pass [] explicitly at the Group call site and harden useValue against non-array aliases; add a test asserting group data-value + grouped score ordering (and ideally failing on console noise - that's what let this slip through). Side note: the trailing-symbol thing is a core footgun (any custom hook with an optional trailing param hits it) - probably worth a compiler diagnostic as a separate follow-up.

2. status.json contradicts itself. surface still says "SSR/hydration are not yet covered" while ssr says "Supported and tested"; verified: 2026-07-20 predates the phase-5 stamps; notes still says "Port in progress"; and the README still says only the scorer is available. All of it flows into docs/bindings-status.md verbatim. Update packages/cmdk/status.json + README.md, then pnpm bindings:status.

3. --cmdk-list-height is missing and unrecorded. Upstream List keeps that CSS var updated via a ResizeObserver (upstream index.tsx ~840-857); the port only has a "later phase" comment in src/components/list.tsrx. Either implement it (~15 lines, nothing octane-specific in the way) or record it in status.json surface/divergences so the table doesn't over-promise.

4. The batcher's catch {} in src/hooks.tsrx:82-88 swallows user callbacks too - a throwing onValueChange just disappears (controlled path: schedule(1, selectFirstItem) → setState('value') → onValueChange). It's also silently eating a jsdom scrollIntoView throw in every test run today. Guard just the scrollIntoView call (or rethrow async), and if the isolation stays, list it in status.json divergences with the others.

5. Phases 1-3 exit criteria are differential parity, but there's no tests/differential/ - and the Phase 2 stamp doesn't carry the deferral caveat the others do. Either land the differential layer (sonner's globalSetup wiring in vitest.config.js is the template; the devDeps are already staged) or restate the stamps - right now the plan doc claims evidence that doesn't exist.

Happy to re-review once 1-3 are in.

Taking a look

mrdiyorbek-juraev and others added 2 commits July 21, 2026 20:25
Group value registration was broken: octane compiles a custom-hook call as
withSlot(sym, hook, ...args, sym), so Group's 3-arg useValue() put that trailing
slot symbol into the `aliases` parameter (`= []` only defaults on undefined) and
aliases.map threw every render — aborting registration before context.value and
setAttribute ran. Groups therefore had no data-value at all, while every test
stayed green. Pass `aliases` explicitly and harden the read; add a console-noise
guard so an exception raised inside an effect fails the test that caused it.

Also fixes, from the same review:
- Group reordering resolved each group by `[data-value="<groupId>"]`, which can
  never match (data-value holds the heading text) — upstream's group sort is
  dead code. Resolve the id to its registered value so groups reorder by score.
- status.json contradicted itself (surface said SSR was uncovered while ssr said
  supported), `verified` predated the work, notes still said "port in progress",
  and the README claimed only the scorer shipped. All corrected.
- `--cmdk-list-height` was never implemented; port upstream's ResizeObserver,
  guarded for hosts without one (SSR/jsdom) and recorded in status.json.
- The scheduler's bare `catch {}` swallowed user callbacks (a throwing
  onValueChange vanished) and masked a jsdom scrollIntoView throw. Guard
  scrollIntoView at its source and report failures instead of discarding them,
  keeping sibling isolation.

Adds the differential suite (tests/differential) running the same fixtures
through @octanejs/cmdk and published [email protected], which immediately surfaced four
divergences: the `radix-` id prefix (now matched), aria-activedescendant on
flush-driven selections, group ordering, and DOM order not being restored when a
search is cleared. All recorded in status.json. `normaliseHtml` is exported from
the shared rig so documented divergences can be compared byte-for-byte minus a
single attribute.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Brings in 5 upstream commits: the safe inline-script content contract
(octanejs#215), the tanstack.com shell port (octanejs#214), the TSRX directive arm output
docs (octanejs#213), the inline hook-memo tier (octanejs#208), and the website menu /
scroll-spy work (octanejs#209). Upstream added three bindings
(tanstack-router-ssr-query, tanstack-hotkeys, tanstack-pacer), taking the
table to 39.

Six conflicts, all resolved as unions so neither side lost content:

- website/src/content/bindings.json — @octanejs/cmdk listed alongside
  upstream's three new bindings; the "UI and interaction" description
  keeps command menus and gains keyboard shortcuts and event pacing.
- website/public/llms.txt — same union in prose form.
- docs/bindings-status.md, docs/packages.md, docs/binding-parity-gaps.md
  and the evals user-apps-v1 manifest are generated, so they were taken
  from upstream and regenerated (39 bindings, 48 publishable packages,
  0 parity pins, 19 eval tasks).

packages/cmdk is byte-identical to its pre-merge state; upstream's
compiler changes do not perturb it. Verified: 32/32 cmdk and cmdk-ssr
tests including both differential parity checks against [email protected],
tsrx-tsc and tsgo clean, prettier clean, and all five freshness gates
current.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Registering a changed item value during an active search scored that item
into `filtered.items` but left `filtered.count` and `filtered.groups`
describing the previous values. Those two drive `Command.Empty` and group
visibility, so an item that started matching rendered while "no results"
was still on screen, and its group could stay hidden.

Re-derive the aggregate by calling filterItems() before sort() in the
scheduled callback. filterItems() is the single place count, groups, and
item scores are derived, so reusing it keeps them from drifting apart; the
batcher already collapses a burst of value changes into one flush, so this
is one O(items) pass per flush — the same work item registration does.

[email protected] has the identical gap: its `value` path runs only sort(), while
its own item-registration path runs filterItems() then sort(), so the
omission reads as an oversight rather than intent. Recorded as a
divergence and the bindings-status table regenerated.

The regression test fails without the fix (Empty renders alongside the
matching item) and covers group visibility on the same path.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Comment thread packages/cmdk/src/components/item.tsrx Resolved
A QA pass found three ways the empty state could contradict what is on
screen, plus a slow memory leak. All four are inherited from [email protected]
rather than introduced by the port, so each is recorded as a divergence.

- forceMount items are now counted. Upstream skips registration entirely
  for a force-mounted item, so it never reaches `filtered.count` and a
  search matching nothing renders the item and "no results" on top of
  each other. Tracked in a separate `forceMountedCount` so
  `filtered.count` keeps its upstream meaning for `useCommandState`.
- Command.Empty renders nothing during SSR. Items register in layout
  effects, which never run on the server, so the count is unavoidably 0
  there and every server-rendered page shipped "No results found." above
  a full list — permanently so without JavaScript. Empty subscribes to
  the store directly rather than through useCmdk: a server snapshot
  passed to a base hook from inside a custom .tsrx hook does not reach
  the SSR runtime. The hydration fixture is regenerated from real
  renderToString output, which no longer contains the empty state.
- An item leaving a group is removed from that group's member set.
  Upstream never removes it, so a group accumulates dead ids for the
  Command's lifetime. No test can observe this — dead ids score 0, so
  there is no behavioural difference, only memory — and it rests on code
  review rather than coverage.
- Duplicate item values are reported in development. Selection is keyed
  by value, so two items sharing one both render aria-selected while only
  the first responds to Enter. The runtime cannot pick a winner, so it
  warns rather than silently emitting an invalid single-select listbox.

The console.error guard moves to tests/_setup.ts so hydration, SSR and
differential runs are covered too, not just the behavioural suite — a
suite-wide gap that previously let a per-render TypeError survive six
green runs. Verified by injecting an error into the SSR suite.

New coverage for the untested props that let the forceMount bug through:
forceMount both directions, duplicate values, keywords, shouldFilter,
defaultValue, disabled-item skip, and clearing the search (which pins the
documented residual-order divergence in both directions).

Docs corrected: status.json advertised a `Command.Root` that exists in
neither the port nor upstream, and both it and the README still claimed
no differential suite existed and that Radix Primitive/Slot were used.

Verified: 42/42 cmdk + cmdk-ssr, 40/40 under the production compile
(hmr: false), tsrx-tsc, tsgo, prettier and all freshness gates clean.
Each fix was confirmed load-bearing by reverting it and watching the test
fail, except the group-set cleanup as noted above.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

@WebEferen WebEferen 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.

For now it crashes on the playground. @mrdiyorbek-juraev is working on to fix it

cmdk's sort is DOM-authoritative: it puts matches in score order by
physically relocating item nodes. React tolerates that because it
re-parents the nodes it owns on the next render. Octane instead fences
each component's DOM between a pair of comment markers and tracks the
range between them, so appending the element on its own stranded it
outside its own markers — the runtime's bookkeeping then described a
range that no longer held the node, and the next update or teardown ran
off stale references:

  TypeError: Cannot read properties of undefined (reading 'm')
      at unmountScope / runEffectLifecycleCallback
  NotFoundError: Failed to execute 'insertBefore' on 'Node'

Reproduced by typing into the input and clearing it: the search relocates
items, narrowing unmounts them, and clearing remounts them. Bisection
pinned it to the relocation itself — disabling sort() entirely was clean,
disabling only the group reorder was not, and a search whose winning
group was already last never crashed.

Move each node together with the comment markers flanking it so the range
stays intact. This does couple the port to how octane fences a component;
there is no public API for relocating a range, so it is the narrowest
thing that works, and the durable fix belongs upstream — either a
supported relocate primitive or a teardown that tolerates externally
moved nodes. Any library that reorders DOM imperatively will hit this.

Also links the package into the playground with a demo covering items,
groups, separators, forceMount, loop and the dialog, so the behaviour can
be exercised by hand.
Brings in 12 upstream commits, including the shared TSRX semantic analysis
across client/server/universal/Volar compilation (octanejs#230), the deferred
hydration fix (octanejs#229), Lynx Milestone 7 worklets (octanejs#227), template-free
production hydration (octanejs#218), and the dependency/TSRX toolchain refresh
(octanejs#223) with the release that followed it.

Two conflicts, both in generated files, resolved by taking upstream and
regenerating from the merged tree:

- docs/packages.md — 47 publishable packages upstream, 48 here. Verified
  as a strict superset: every package upstream lists is still present,
  and the only additions are `@octanejs/cmdk` and `packages/cmdk`.
- packages/octane-evals/.../manifest.jsonl — all 19 task ids match
  upstream, and a field-level comparison shows only
  environment.overlayLockfileHash and grader.graderDigest differ. No
  prompt, policy, reference or grader command changed, so task semantics
  are untouched; both fields derive from the lockfile, which necessarily
  moved.

pnpm install also rewrote pnpm-workspace.yaml as a side effect — it
flattened upstream's `*esrap_common` YAML anchor and appended
[email protected] to minimumReleaseAgeExclude. Both are reverted, so the file
differs from upstream by exactly one line: the `cmdk: 1.1.1` catalog pin
this package needs.

packages/cmdk is unchanged apart from one comparator re-wrapped by the
refreshed prettier; the whitespace-only diff is the entire delta.

Verified: 43/43 cmdk and cmdk-ssr against the new compiler, 48/48 evals
(including the corpus freshness gate), tsrx-tsc, tsgo, prettier, and all
five generated-artifact gates current.
`[email protected]` is our own published package, resolved from the registry as an
optional peer of `@tsrx/[email protected]`. It was published today, so
`pnpm install --frozen-lockfile` rejected the lockfile:

  [ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION] 1 lockfile entries failed verification:
    [email protected] was published at 2026-07-22T09:29:59.000Z, within the
    minimumReleaseAge cutoff

The lockfile is neither stale nor bypassed — every other optional peer of that
same plugin (`@tsrx/react`, `@tsrx/ripple`, `@tsrx/solid`, and the plugin
itself) is already excluded; `[email protected]` is the one that postdates the last
curation of the list.

Verified both ways: without this entry the check fails as above, with it
`pnpm install --frozen-lockfile` reports the lockfile passes all 2065 entries.
No `pnpm-lock.yaml` change, so the evals corpus does not need regenerating.
…unts quiet

Three defects, all on the item/group removal path, which had no test coverage —
the committed suite only ever removed items via the filter (where the Item
itself renders null) or by unmounting the whole Command.

1. Registration teardowns reported a cross-render update.

   Octane runs a removed child's effect cleanups DURING the parent's render
   (renderBranchSlot -> unmountBlock -> unmountScope -> runEffectCleanupCallback),
   so scheduling follow-up work straight from a teardown landed its state update
   mid-render and the runtime reported:

     Cannot update a component (`CommandRoot`) while rendering a different
     component (`__children$N`). Move the update out of the rendering component
     body.

   Advice a teardown cannot act on, since it does not choose when it runs.
   Reproduced on all three registration paths (plain item, force-mounted item,
   group) and on a realistic result list shrinking. Behaviour was correct
   throughout — Empty appeared, selection advanced, aria-activedescendant
   followed — but the message reached every consumer's console on the most
   ordinary interaction a command menu has, and tests/_setup.ts treats a
   console.error as a failure.

   Teardowns now hop a microtask before scheduling (scheduleFromTeardown).
   Only the teardowns defer: every other caller schedules from a layout effect,
   where the synchronous update is load-bearing (the search -> filter ->
   select-first chain has to settle inside one commit). Verified the deferral
   changes only the diagnostic — the same fixtures produce byte-identical
   behaviour logs against the pre-fix source. React has no equivalent problem
   because it runs cleanups in the commit phase.

2. Only the plain-item teardown released the value it registered.

   Items, force-mounted items and groups all register through the same
   useValue, but forceItem's and group's teardowns never decremented the
   dev-only owner count, and forceItem never cleared `ids`/`filtered.items` at
   all. Re-showing a force-mounted item therefore counted its value again each
   time and blamed the author for code holding exactly one live item with it:

     [@octanejs/cmdk] 2 items share the value "Always visible (forceMount)"...
     [@octanejs/cmdk] 3 items share the value "Always visible (forceMount)"...

   plus unbounded growth of `ids`/`filtered.items` for the Command's lifetime.
   All three paths now release through one `releaseValue` helper.

3. Removing the selected force-mounted item left nothing selected.

   Pre-existing, and surfaced by the regression test written for (1). The value
   kept pointing at a removed node, so nothing rendered aria-selected, the
   combobox's aria-activedescendant dangled at a removed id, and Enter did
   nothing until the user arrowed away. The force-mount teardown now re-selects
   the same way the plain item teardown does. Upstream cannot have this bug
   because it never registers force-mounted items — which is also why it cannot
   fix it.

Tests: six added, each with a proven pre-fix failure — the three removal paths,
an async result set exercising Empty and selection handoff plus
aria-activedescendant, and the two duplicate-value repros matching the
playground's forceMount toggle.

Gates: cmdk + cmdk-ssr 49/49 (was 43), prod compile (hmr: false) 37/37,
typecheck clean, format:check clean, docs/bindings-status.md regenerated.
Reported in review. sort() reordered group hosts by score with a plain
`appendChild`, while item reordering already used `moveWithMarkers` so octane's
comment-marker ranges stay aligned with the DOM. A Group is a component too, so
relocating its host without its flanking markers stranded it outside its own
fence.

It surfaced not as a thrown error but as a silent orphan: when a relocated
group later unmounted, the runtime removed the heading and items it still
tracked and left the host behind.

  <div cmdk-group="" role="presentation" data-value="Beta">
    <div cmdk-group-items="" role="group" aria-labelledby="radix-:r0-in-4:"></div>
  </div>

That is a visible empty block for anyone styling `[cmdk-group]`, a `role="group"`
inside the listbox whose `aria-labelledby` points at a removed id, and a ghost
that keeps its `data-value` — so the group lookup in sort() can match the dead
node instead of a live group of the same name. The shells accumulate as groups
churn.

The earlier QA pass tried this and cleared it, but only ever reordered groups
and then cleared the search or unmounted the whole Command — never removed an
individual relocated group, which is the transition that strands one.

Regression test: reorder three groups by score, remove one that sort() moved,
assert the host is gone rather than left as an empty shell. Pre-fix it reports
['Alpha', 'Gamma', undefined].

Gates: cmdk + cmdk-ssr 50/50, prod compile 38/38, typecheck clean,
format:check clean.
Comment thread packages/cmdk/package.json Resolved
mrdiyorbek-juraev and others added 3 commits July 23, 2026 03:30
Resolves pnpm-workspace.yaml minimumReleaseAgeExclude in favor of upstream's
bumped @tsrx/* pins (catalog already at ^0.1.47/^0.3.109), reconciles
pnpm-lock.yaml via pnpm install on upstream's base, and regenerates the
octane-evals corpus from the merged lockfile.

Co-Authored-By: Claude Fable 5 <[email protected]>
Per maintainer review: resolve radix from the registry at a fixed release
rather than linking the workspace source. The published package ships raw
sources, so cmdk's suites still compile it through the same toolchain; the
octane peer still resolves to the workspace runtime. Evals corpus
regenerated for the lockfile change.
Resolves the root package.json typecheck script as the union of both sides
(upstream's lynx:demo:typecheck step plus this branch's packages/cmdk entry),
reconciles pnpm-lock.yaml via pnpm install, and regenerates the octane-evals
corpus from the merged lockfile.
@leonidaz
leonidaz requested a review from WebEferen July 24, 2026 15:35
Brings in the consumer build contracts, Redact scheduler coverage, and the
immutable-AST compiler conversion. Sole conflict was the generated evals
manifest — resolved by reconciling the lockfile via pnpm install and
regenerating the corpus. Validated post-merge: cmdk suite 50/50 against the
new compiler internals, package typecheck, repo-wide format check.
@mrdiyorbek-juraev mrdiyorbek-juraev mentioned this pull request Jul 24, 2026
@leonidaz leonidaz assigned leonidaz and unassigned leonidaz Jul 25, 2026
@leonidaz
leonidaz self-requested a review July 25, 2026 19:56
@leonidaz

Copy link
Copy Markdown
Collaborator

had claude dig into this and impirically verify:

Branch: cmdk-port-plan @ d53c1f5d · 57 files, +3984/−39


Verdict

The engineering craft here is high — the comment quality is the best of any binding in
the repo, status.json is unusually honest, and the console.error-fails-the-test guard
in tests/_setup.ts is exactly the right instinct. All the gates the PR claims are
genuinely green (I re-ran them).

But the suite is green because of what the fixtures pass, not because the behaviour is
right
. Three functional defects survive behind it, and one of them
(F1) breaks the single most common real-world command-menu flow: results arriving
while the user is typing. Two more (F2, F4) are consequences of one architectural
decision — inheriting cmdk's DOM-authoritative sort into a renderer that owns comment-fenced
DOM ranges — that moveWithMarkers only patches one level deep.

I'd hold the merge for F1 and F2. F3/F5 are quick fixes. The rest is polish.

Gates I re-ran (all pass, as claimed)

Gate Result
vitest --project cmdk --project cmdk-ssr 50 pass (PR says 49)
tsgo --noEmit -p packages/cmdk/tsconfig.json clean
prettier --check on every changed file clean
node scripts/generate-bindings-status.mjs --check current (39 bindings)
vitest --project octane packages/octane/tests/differential 144 pass — the normaliseHtml export change is safe

F1 — Blocking: an item mounted while a search is active is permanently invisible

An item added to a live menu never renders unless it carries an explicit value prop.
Not "renders late" — never, for as long as the search is non-empty.

octane, no value prop      before add: [ 'Apple' ]   after add: [ 'Apple' ]            ← Apricot never appears
octane, value="Apricot"    before add: [ 'Apple' ]   after add: [ 'Apple', 'Apricot' ]
react [email protected]           before add: [ 'Apple' ]   after add: [ 'Apple', 'Apricot' ]

Typing further makes it worse — narrowing 'ap' → 'apr' yields zero items and an
empty state, while a matching item sits mounted-but-null in the tree.

Root cause — a genuine deadlock

  1. item.tsrx:31-39 — a freshly mounted item
    has no entry in filtered.items, so (s.filtered.items.get(id) ?? 0) > 0 is false and
    the component returns null at line 57.
  2. No host element ⇒ ref.current is null.
  3. hooks.tsrx:73-90 — useValue walks deps
    ([props.value, ref]), finds props.value undefined and ref.current null, and returns
    valueRef.current, which is undefined.
  4. context.value(id, undefined) stores ''; score() short-circuits
    (itemValue ? filter(...) : 0) to 0.
  5. Score 0 ⇒ still not rendered ⇒ goto 2. The item is hidden because it has no value, and
    has no value because it is hidden.

Upstream cannot hit this: its useValue deps are [props.value, props.children, ref], and
for <Command.Item>Apricot</Command.Item> the children entry is the string. The port
drops that ("octane's compiled children are opaque") and status.json asserts "the
textContent fallback covers the same case" — empirically it does not. It only covers items
that were visible at least once.

Why the suite misses it

The only two fixtures with a changing item set both hand the port a value:
AsyncItemsMenu uses value={label} (basic.tsrx:254)
and RemovableMenu uses value="Apple". Drop those props and the async test fails.

Smallest correct fix

Treat unregistered as visible rather than as score 0 — an item that has never been scored
is not the same as an item that scored zero:

// item.tsrx, the render selector
: !s.search ? true
: s.filtered.items.has(id) ? (s.filtered.items.get(id) ?? 0) > 0 : true

It renders once, ref.current populates, useValue registers the real value, the next
filter pass hides it if it genuinely doesn't match. One extra frame for one item, and the
deadlock is gone. (See the architectural note for the bigger alternative.)


F2 — High: sort() orphans DOM nodes inside a keyed @for

@for is the idiomatic way to render a data-driven menu in Octane — and it is the one shape
the fixtures never combine with a search.

mount @for(['Salad','Apple','Banana']) → type 'a' (sort runs) → set items to []

items still in the DOM:  [ 'Apple', 'Banana', 'Salad' ]
cmdk-empty rendered:     1                                  ← "No results found." *and* 3 items

Without a prior search the same removal is clean ([]), and @if-wrapped items are clean
too. The difference is nesting depth.
moveWithMarkers carries the
component's <!--comp-->/<!--/comp--> pair with the node — but a @for iteration is a
second, outer range. After a sort the sizer looks like:

<!--for--><!--it--><!--/it--><!--it--><!--/it--><!--/for-->   ← the loop's ranges, now empty
<!--comp--><div cmdk-item>Banana</div><!--/comp-->            ← the real nodes, relocated out

When the loop drops an iteration it clears the (empty) range and the real node stays forever.
This also silently swallows insertions: adding 'Apricot' to the array while the sorted DOM
was live produced no new item at all until the search cleared.

moveWithMarkers is a one-level fix for an N-level problem. Every construct that gives an
item its own tracked range — @for iterations, @if, @switch — reintroduces it. The
existing regression tests only exercise the depth the helper happens to handle.


F3 — Medium: bulk removal still leaves the selection dangling, and octane's aria-activedescendant dangles worse than React's

Remove the selected item together with a sibling in one update:

octane   items: ['Cherry']  selected: null  aria-activedescendant: radix-:r0-in-3:  (live item is in-5)
react    items: ['Cherry']  selected: null  aria-activedescendant: null

The dangling selection is inherited — upstream does the same. But the dangling
aria-activedescendant pointing at a removed node is port-specific
: it is the downside of
the divergence status.json frames as a pure improvement ("aria-activedescendant is wired
on the initial auto-select and after every filter"). A combobox whose active descendant names
a node that isn't in the document is worse for a screen reader than one that names nothing.

Root cause is the schedule-key collision the PR's own fix inherited: every item teardown
writes schedule(4, …), so the last teardown's callback wins and its captured
selectedItem isn't the removed selected one. The PR fixed the one-item case and shipped a
test for it; a shrinking async list — the shape it explicitly set out to cover — removes more
than one.

The same collision was newly introduced on the force-mount path, where id 8 is used for both
the mount emit and the teardown re-select

(command.tsrx:191 and :205).

Fix: key teardowns per item — the batcher map is already Map<string | number, …>, so
schedule('rm:' + id, …) works and needs no other change. Give the force-mount mount path its
own id while you're there.


F4 — Medium: residual order after clearing a search is arbitrary and accumulates

initial   [ Apple, Banana, Cherry, Avocado, Blueberry ]
'a' → ''  [ Cherry, Apple, Avocado, Blueberry, Banana ]
'b' → ''  [ Apple, Avocado, Banana, Cherry, Blueberry ]
'rr'→ ''  [ Apple, Avocado, Banana, Cherry, Blueberry ]
'e' → ''  [ Avocado, Banana, Apple, Cherry, Blueberry ]

status.json calls this "only the residual order differs." For a command menu, source order
is the product — recents first, primary actions above destructive ones. A user who types and
backspaces four times gets a menu whose resting order is effectively random and never recovers.
This is the same root cause as F2 and should be fixed with it, not documented around.


F5 — Medium: @octanejs/radix is depended on by registry version, uniquely in this repo

"dependencies": { "@octanejs/radix": "0.1.12" }

Every other cross-binding dependency in the monorepo uses workspace:* — including
@octanejs/radix's own dependency on @octanejs/floating-ui. Verified by resolution:

packages/cmdk/node_modules/@octanejs/radix -> .pnpm/@[email protected]_octane@packages+octane/…

So Command.Dialog is tested against a published tarball, local radix regressions are
invisible to this package, it costs the 77 added lockfile lines, and it will silently pin
stale the moment radix bumps. Change to workspace:*.


F6 — The differential suite proves less than the PR says

The PR body: "a differential suite … asserting byte-equal HTML across filtering, keyboard
selection, grouped rendering and the empty state."

Of the 8 checkpoints in parity.test.ts, 2 are step() (the rig's byte-equal comparison):
arrow-down and arrow-up. The other 6 are observe(), which the rig documents as "unlike
step, this does not require equal HTML"
— filtering, the empty state, grouped rendering and
group filtering are all observe, and two of those further relax to
expectEqualIgnoringActiveDescendant.

That's still a useful suite. It just isn't the claim, and the claim is what a reviewer budgets
their attention against. (The catch { return } swallowing in differential/_setup.ts is a
smell but benign — a missing cache file makes loadReactFixture's dynamic import throw, so it
does fail loudly.)


Smaller items

F7 — useValue's per-render re-run is emergent, not declared. Confirmed from the compiled
output: the inferred deps are [deps, aliases, aliases.map, context.value, id, ref.current].
It re-runs only because every call site allocates a fresh array literal. The upstream contract
is "every render"; write null and make it load-bearing. (aliases.map as a dependency is
also just noise.)

F8 — the aliases: string[] = [] footgun deserves an upstream issue, not just a comment.
Confirmed in compiled output: _$withSlot(_h$10, useLazyRef, () => new Map(), _h$10) — the
slot symbol really is appended as a trailing argument, so any custom hook with an optional
trailing parameter silently receives a Symbol instead of its default. The port works around it
with Array.isArray(aliases) plus a 12-line comment. That is the correct local call, but the
next author to write a .tsrx custom hook will rediscover it the hard way. File it against the
compiler and link the issue from the comment.

F9 — two Command.Lists under one Command emit duplicate ids and selection follows
whichever list won context.listInnerRef last (['radix-:r7-in-0:', 'radix-:r7-in-0:'], first
item selected is Banana from the second list). Inherited from upstream; a dev warning would
be cheap.

F10 — an all-forceMount menu never auto-selects anything. Inherited (React does the same),
but the port half-adopted force-mounted items into the registration model — it counts them for
Empty and re-selects on their removal — without extending select-first. Either finish the
adoption or say why not.

F11 — context.label is dead (command.tsrx:219);
nothing reads it. Upstream has the same dead field, so it's faithful, but it's still dead.

F12 — the PR description needs a rewrite before merge. It contains a duplicated section
("Also in this round" twice, "2. Only the plain-item teardown…" twice), a stray literal
markdown line, and a sentence that stops mid-word ("Two caveats before you"). It is the
first artifact a reviewer reads.

Confirmed-harmless, as the PR states: CommandRoot leaving ref in its rest spread. The
callback ref fires exactly once on mount and once on unmount, and no ref attribute lands on
the DOM (['tabindex', 'cmdk-root']). Worth tidying for consistency, not for behaviour.


Architectural note — the real decision

F1, F2 and F4 are one decision wearing three hats: cmdk's model is DOM-authoritative (it
sorts by physically relocating nodes and hides items by unmounting them), and Octane's renderer
owns those nodes through comment-fenced ranges. moveWithMarkers and the "only sort survivors"
divergence are both patches on that seam, and both leave residue.

Two coherent exits, either of which collapses all three findings:

  1. Stop moving DOM. Keep the score order in state and express it with CSS order on the
    cmdk-list-sizer (flex/grid). Ordering becomes declarative, no range is ever violated,
    source order returns for free when the search clears, nothing can be orphaned, and
    moveWithMarkers deletes itself. Cost: consumers relying on physical DOM order
    (:nth-child styling, drag handles) diverge from upstream — a documentable divergence, and
    a smaller one than the current residual-order divergence.
  2. Keep DOM authority, stop unmounting. Always render items and toggle hidden — the exact
    pattern Command.Group already uses (group.tsrx:43).
    textContent is then always available (F1 dissolves), and nothing is ever moved-then-unmounted
    (F2 dissolves). Cost: the filtered DOM diverges from upstream byte-wise, so the two
    filtering observes stay observes.

(2) is the smaller change and fixes the most. (1) is the cleaner end state. What shouldn't
happen is a third marker-carrying special case for @for.

Separately: while F1 stands, status.json's surface field should not read "Complete" with
"useValue text-content inference" listed as covered.


What's genuinely good

  • Comment quality. moveWithMarkers, scheduleFromTeardown and releaseValue each explain
    the runtime path that forced them and name the observed failure. That is how a port should be
    documented.
  • tests/_setup.ts. Failing a test on console.error is why several real bugs surfaced at
    all, and putting it in setupFiles so hydration/SSR/differential inherit it is the right call.
  • Five test layers, wired into vitest.config.js as first-class projects, with the SSR
    project correctly aliasing octane → octane/src/server/index.ts.
  • Real upstream bugs fixed, not copied: the dead [data-value="<groupId>"] group selector,
    the unbounded allGroups leak, re-deriving the filter aggregate on value re-registration, and
    not shipping "No results found." above a full list during SSR. Each is argued in status.json.
  • Generated artefacts are actually current — bindings-status --check passes, the MCP bridge
    entry and the root typecheck chain were both updated, and the package shape matches the
    sonner convention exactly.

…per item

Three defects from review, all of which the suite passed over because the
fixtures happened to avoid the shapes that trigger them.

1. An item mounted while a search was active never rendered unless it carried
   an explicit `value`. Unscored was treated as scored-zero, which deadlocks:
   the item renders null, so `ref.current` stays null, so `useValue` has no
   textContent to infer from, so it registers empty and scores zero forever.
   Upstream cannot reach this — it reads the value out of `props.children`
   synchronously, while octane's compiled children are opaque, so the first
   render IS the registration. Unscored items now render once so that pass can
   happen. Every upstream cmdk example omits `value`; both existing async
   fixtures passed one, which is why this was invisible.

2. Ranking moved DOM nodes, which orphans them. A `@for` iteration wraps each
   item in a SECOND comment-fenced range on top of the component's own, so
   relocating a node carried it out of both: the loop later cleared an empty
   range and the real node survived in the list forever — every item stacked
   above "No results found.". `moveWithMarkers` only ever repaired the
   innermost range, so it broke again at each nesting construct.

   Ranking is now CSS `order` inside a flex container. Nothing moves, so no
   range can be violated, and clearing the search restores true source order
   because the styles are simply dropped — the physical reordering left a
   residue that accumulated across searches and never recovered.

   `getValidItems()` had to follow: it returned DOM order, which WAS the
   ranking while nodes moved. Left alone, selection and arrow keys would have
   navigated in source order behind a differently-ordered list. It now
   descends the ranked containers, with the flat query kept as a fast path for
   when no filter is active and DOM order already is visual order.

3. Removing the selected item alongside any sibling left nothing selected. All
   item teardowns scheduled under one batcher key, and the batcher is a Map, so
   the last teardown overwrote the rest and the surviving callback had captured
   a different `selectedItem`. Keyed per item now. The force-mount path also
   used one key for both its mount emit and its teardown re-select, so a mount
   and a removal in the same pass cancelled each other.

Two tests were pinning bugs as contracts: `restores every item when the search
is cleared` asserted the scrambled residue, and the differential's `clearing
restores every item` documented it as a divergence from React. Both now assert
parity, and that differential checkpoint compares the whole tree instead of a
few hand-picked values. The filtering checkpoints strip only the three ranking
declarations, so every other attribute and node still compares byte-for-byte.

status.json divergence [3] rewritten for the ranking model; [4], which
described the residual-order bug, is gone.
Nineteen conflicts. Every derived artifact was regenerated rather than
hand-merged; the rest were unions, except where upstream deliberately removed
what this branch had edited.

Unions:
- pnpm-workspace.yaml — kept both catalog entries (cmdk, tailwind-merge).
- playground/octane/package.json — both dependency sets.
- playground/octane/src/App.tsrx — both demos' imports (the body already
  auto-merged), and vite.config.ts's optimizeDeps exclude list.
- website/src/content/bindings.json and website/public/llms.txt — both
  @octanejs/cmdk and @octanejs/shadcn, which landed upstream in this range.

Superseded by upstream:
- .rulesync/rules/project.md — the "rightsize the agent context surface"
  rewrite drops the binding enumeration this branch had added `cmdk` to; the
  inventory now lives in the generated docs/packages.md.
- package.json — upstream restructured `typecheck` around a new
  `bindings:typecheck` step, so took theirs and re-inserted the cmdk entry in
  its original slot after sonner.

Needed care:
- playground/octane/index.html — upstream deleted the inline <style> block
  wholesale (playground chrome moved to CSS files), and this branch had edited
  that same block. Taking theirs alone would have silently dropped every cmdk
  demo style, so the `cmdk-*` rules were re-homed in
  playground/octane/src/styles/playground.css and translated from the old
  hard-coded palette to the shadcn tokens that file already uses
  (--fg/--panel/--accent/--muted → --foreground/--card/--primary/
  --muted-foreground, the two rgba() values → color-mix, radii → the --radius
  scale).

Regenerated: the five RuleSync targets, docs/packages.md,
docs/bindings-status.md (41 bindings), docs/binding-parity-gaps.md, the
user-app corpus manifest, and pnpm-lock.yaml — the lockfile re-resolved from
the merged manifests so it carries both the packages/cmdk importer and
upstream's packages/shadcn. `pnpm install` also refreshed the
minimumReleaseAgeExclude pin from [email protected] to @0.1.16, which enters as a
peer of @tsrx/typescript-plugin.

Verified after the merge: cmdk + cmdk-ssr 53/53, cmdk typecheck clean,
format:check clean, and rules/inventory/parity-gaps/bindings-status/changeset/
test-markers/tsrx-decls/context-budget checks all green.
The merge brought in the repo-wide rule that every sibling edge must be
`workspace:*` (validateWorkspacePackages, gated by packages:inventory:check),
which supersedes the earlier decision to pin @octanejs/radix to the published
0.1.12. Keeping the pin now fails that gate.
…id item

Two consequences of moving ranking from DOM relocation to CSS `order`, both
found in review.

Group navigation still walked `nextElementSibling` and took each candidate's
first item with `querySelector`, which are DOM-ordered. Under an active filter
that disagrees with what is on screen, so alt+arrow could land on the wrong
group. A two-group menu hides it — the item-level fallback happens to give the
right answer when the sibling walk runs off the end — so the regression test
uses three groups whose ranked order interleaves with their source order
(Apple 0.9899 > Snap 0.1700 > Grape 0.1683 for "ap"), where the DOM-next group
exists but is the wrong one. Pre-fix it selected Grape instead of Snap.

Ranking also covered only the matches. An unranked flex child keeps the initial
`order` of 0, which sorts it AHEAD of every ranked match rather than out of the
way, so a force-mounted item — the one item that never scores and never
unmounts — jumped to the top of its container whenever the search did not match
it. Every valid item is ranked now, which puts zero-scoring items last, where
upstream's append-in-score-order leaves them too.

That exposed an older defect underneath. Force-mounted items and groups
register their value through the same `useValue` hook as items, so
`context.value` writes them a filter score — computed against whatever the
search was at registration time, and never refreshed, because `filterItems()`
walks `allItems`, which holds neither. A force-mounted item registered before
the user typed kept `commandScore(value, '')` — 0.99, higher than a genuine
prefix match — for the rest of its life. `filterItems()` now prunes scores for
ids it does not own.

`lib/dom.ts` was the sibling walk's only home and has no callers left, so it
goes with it.
…paces disjoint

Self-audit of the CSS-order ranking, after the review flagged the first of
these. All three are the same root shape: an unranked flex child keeps
`order: 0`, which sorts it AHEAD of every ranked one rather than out of the
way, so anything the ranking fails to reach jumps to the top of its container.

- Ungrouped items were numbered by their GLOBAL rank among all items while
  group hosts continued from a count of ungrouped items only. The two spaces
  overlap as soon as a grouped item outranks an ungrouped one: the ungrouped
  item's number skips ahead and can tie a group host, leaving sizer siblings to
  paint in DOM order. Sizer children are numbered densely now, so the group
  ranks that follow them stay disjoint.

- `positionedNode` resolved one wrapper level, and only inside a group
  (`closest(GROUP_ITEMS > *)`). An item wrapped directly under the list
  therefore resolved to nothing and never got a rank, so its wrapper — the
  actual flex child — paints first. It now walks up to the container's direct
  child at any depth. Upstream resolves a single level too, but its appendChild
  model tolerates that: a node it cannot resolve simply is not moved, whereas
  here it is promoted to the top.

- Group hosts had the same gap and now rank through their positioned node, and
  `getOrderedGroups` reads the rank from that node rather than the host, or a
  wrapped group would read 0 and collapse alt+arrow navigation back to DOM
  order.

Regression tests cover a group whose item outranks an ungrouped sibling, and an
item wrapped in a plain element under the list. Both selected the wrong element
before the fix.

@WebEferen WebEferen 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.

Looks good for me now, deps are clear - implementation seems solid (proper data-attributes, no code duplication).

@leonidaz / @trueadm need yours opinion as well.

@vercel

vercel Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview, Comment Jul 27, 2026 2:41am

Request Review

@vercel
vercel Bot temporarily deployed to Preview – octane-website July 27, 2026 02:41 Inactive

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit 0cb1231. Configure here.

@trueadm
trueadm merged commit 8014e81 into octanejs:main Jul 27, 2026
27 checks passed
mrdiyorbek-juraev added a commit to mrdiyorbek-juraev/octane that referenced this pull request Jul 27, 2026
MERGE — one conflict, in playground/octane/src/App.tsrx. Upstream's cmdk PR
(octanejs#210) added a Command menu demo to the flat nav this branch replaces. Resolved
to the sidebar shell, but taking it wholesale would have DROPPED the new demo:
the shell reads from catalog.ts, not from the switch statement upstream edited.
Registered it there instead, so the entry survives and gains a source view.

AUDIT — the review flagged the first of these; the rest came from looking for
its siblings.

1. Selecting a demo left the mobile sidebar open. Below the breakpoint the nav
   is a Sheet laid OVER the stage, so a selection that only changed the route
   left the sheet covering the demo it had just selected. It now closes the
   sheet on select, on mobile only.

2. `[data-slot='sidebar-menu-button']` was styled globally, reaching into a
   vendored component's internals from app CSS. No live bug — this app has one
   sidebar — but it would silently restyle any future one. Scoped to
   `.demo-sidebar`.

3. `collapsible="icon"` promises an icon rail, and these entries are text-only,
   so there was no icon to collapse to. It behaved as offcanvas regardless;
   now it says so.

4. An unresolvable route rendered the fallback demo while the URL kept the bad
   id, so sharing the link again propagated a route that does not exist. The
   URL is now rewritten to match what rendered.

Verified against the production build in headless Chromium: the mobile sheet
closes on select, deep links resolve, nav clicks update the URL, Cmd+B
collapses, search filters, the merged cmdk demo renders with its source, and
the console is clean.
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.

4 participants