Skip to content

test(CommandPalette): cover the b24ui-only useTokenSearch argument - #369

Open
IgorShevchik wants to merge 1 commit into
mainfrom
claude/search-mark-boundary
Open

test(CommandPalette): cover the b24ui-only useTokenSearch argument#369
IgorShevchik wants to merge 1 commit into
mainfrom
claude/search-mark-boundary

Conversation

@IgorShevchik

@IgorShevchik IgorShevchik commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Linked issue

Closes #363.

Rescoped. This PR previously also fixed #362. @arsalan507 has since sent #379 for that, smaller and covering #375 as well, so the overlapping work has been dropped from here. What remains touches no src/ at all.

Type of change

  • Documentation (updates to the documentation or readme)
  • Bug fix (a non-breaking change that fixes an issue)
  • Enhancement (improving an existing functionality)
  • New feature (a non-breaking change that adds functionality)
  • Chore (updates to the build process or auxiliary tools and libraries)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

highlight() takes a fifth parameter, useTokenSearch, that upstream does not have — and it had no test at all.

Where it came from. c502157b added the tokens / minTokenLength pair and 6743f793 the parameter itself, both against the file's old name src/runtime/utils/fuse.ts; both shipped in v2.8.0. Immediately before c502157b the function took four parameters and computed no minTokenLength, which is what establishes it as locally authored — not the absence of an Upstream: trailer, which is too sparse a convention here to carry an inference (16 of ~3200 commits).

Why nobody noticed. The port 557a5178 renamed fuse.ts to search.ts and carried the divergence across, so git log -S useTokenSearch -- src/runtime/utils/search.ts returns exactly one commit — that port, which does carry a trailer. --follow is needed to see the two that introduced it.

Why it matters. Replaying upstream's four-parameter signature would drop a feature shipped in v2.8.0 and nothing would go red.

Unit cases pin the threshold the argument moves: the whole term's length when off, the shortest word's when on, and the fallback to the whole term when the tokenizer matches nothing — an emoji-only query matches no \p{L} token, and the threshold must stay the term's length rather than collapsing to zero and marking everything.

Component cases cover the wiring, which the unit tests cannot reach. matches is only populated when includeMatches is set, which CommandPalette leaves to the caller — so no existing case in CommandPalette.spec.ts reached highlight() at all, and the with searchTerm snapshot contains no <mark>. These fail if the fifth argument stops being forwarded from processGroupItems.

Recorded as a §2 invariant in .sync/PORTING.md, stating plainly that upstream itself was not re-inspected — the divergence is established from b24ui's own history.

Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Verified failing against a revert to upstream's four-parameter signature, and against dropping the fifth argument at the call site. eslint and vue-tsc --noEmit clean.

@IgorShevchik
IgorShevchik force-pushed the claude/search-mark-boundary branch from 8d757c7 to e1b1968 Compare August 13, 2026 06:37
@IgorShevchik IgorShevchik changed the title fix(CommandPalette): keep astral characters intact when inserting the highlight mark test(CommandPalette): cover the b24ui-only useTokenSearch argument Aug 13, 2026
`highlight()` takes a fifth parameter that upstream does not have, and it had no
test at all. `c502157b` added `tokens`/`minTokenLength` and `6743f793` the
parameter itself, both against the file's old name `src/runtime/utils/fuse.ts`;
both shipped in v2.8.0. The later port `557a5178` renamed the file to
`search.ts` and carried the divergence across, so a pickaxe on the current path
returns only that port — `--follow` is needed to see the two commits that
introduced it. Replaying upstream's four-parameter signature would therefore
have dropped a shipped feature with nothing going red.

The unit cases pin the threshold the argument moves: the whole term's length
when off, the shortest word's when on, with the fallback to the whole term when
the tokenizer matches nothing — an emoji-only query matches no `\p{L}`, and the
threshold must stay the term's length rather than collapsing to zero and marking
everything. They fail against a revert to upstream's signature.

The component cases cover the wiring, which the unit tests cannot: `matches` is
only populated when `includeMatches` is set, which `CommandPalette` leaves to
the caller, so no existing case in that file reached `highlight()` at all — the
`with searchTerm` snapshot contains no `<mark>`. They fail if the fifth argument
stops being forwarded from `processGroupItems`.

No `src/` change. Recorded as a §2 invariant in `.sync/PORTING.md`, with the
note that upstream itself was not re-inspected — the divergence is established
from b24ui's own history.

Closes #363

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LWWrBHgfqGSbeU3V6UuMF8
@IgorShevchik
IgorShevchik force-pushed the claude/search-mark-boundary branch from e1b1968 to bd740b9 Compare August 13, 2026 08:01
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.

test(search): highlight()'s b24ui-only useTokenSearch argument has no coverage bug(search): highlight() inserts <mark> inside astral characters

2 participants