~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

Mention suggestions match handles from their start

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:web/mention-prefix

What changes

Typing @ in a comment now suggests only accounts whose handle starts with what follows it. Before, people in the thread and accounts the viewer follows were suggested when their handle held the text anywhere, and listed ahead of everyone else: @c put johnandersen777.bsky.social first, for the "c" in "social". The owners dev.knotless.searchOwners finds, which can also match mid-handle, are held to the same rule.

Why

A mention is typed from the start of a handle, as GitHub's suggestions take it. A match in the middle, often in the host part every Bluesky handle shares, buries the account meant. The search already puts handles that start with the text first, so its first SUGGESTED answers still hold every owner that can show.

How it was checked

just look pull-files --signed-in --set 'getThread.item.state="open"' --click 'details.review-menu>summary' --type '.review-menu textarea=@t' now suggests no one (before, bob.test, for its "t"), and @b still suggests bob.test. No recorded page has the suggestions showing, so no shots move.

Shortcomings

A handle is matched only at its start, not at each dot-separated part: @social finds no *.bsky.social account.

Changeset: none

🤖 Generated with Claude Code

Approved

This makes the @ suggestions in MarkdownField.svelte keep only accounts whose handle starts with the typed text. It applies the same filter to thread people, follows and searchOwners results, in one pass before the dedupe and the SUGGESTED cut. I read the whole change and the surrounding code; I did not run anything.

  • Empty query: a bare @ still suggests thread people and follows, because startsWith('') is true. This matches the old behaviour.
  • Lowercasing: q is already lowercased and the handle is lowercased in the filter, so the comparison is consistent.
  • Dedupe: the prefix test comes before the seen.add side effect, so non-matching accounts don't use up a seen slot.
  • SUGGESTED cut: the search ranks prefix matches first, so the owner list it returns at the limit still holds every owner that can show. That is the PR's claim, and I found nothing against it.
  • Changeset and docs: Changeset: none fits, since this is a web-only change. No docs page appears to describe the suggestion rule.
Merged as 0b54e22