Repository navigation
fix(conn-server): pass 9 search fixes: agent search by linked PR, accent-folded message search, as T3 - #285
Merged
Merged
Conversation
…, as T3 conn_thread_search matched title, branch and project only, so an agent given #7483, example/fixture#7483 or the PR URL could not find the active thread that owns the PR. The candidate filter now reads the thread's visible PRs as threadSearchPullRequests does: the number after a pr/pull/# prefix, the newest three titles, and owner/repo#N, the URL and the thread id by matchReference's whole-query rule. Dismissed stack members stay out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…too, as T3 A search for "ecole fermee" or "fermée éc" missed a message that reads "École fermée à Lyon": the trigram index and the short-word check folded ASCII case only. The index now stores text folded as T3's foldCharacter does (NFKD, marks dropped, lower case), queries fold the same way, and the short-word check reads the folded index text. Snippets still show the original text. An existing index is refolded once, in batches inside one transaction, under a meta mark rather than a schema version (PR #260 also adds version 5). A T3 import folds what it indexes. New dependency: unicode-normalization 0.1.26 (unicode-rs, MIT/Apache-2.0 and Unicode-3.0, both allowed), with tinyvec. Measured cost: +113 KiB in a stripped LTO release binary, static tables only, no heap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he refold Gate findings 9.4 and 9.5 on #285. - conn-mcp: the query folds as `foldSearchQuery` (wrapping quotes, NFC, case and accents), and so do titles, branches and projects. A PR's `#N` and searched title match word by word at word starts (`matchToken`), so "resume" finds "Résumé indexing" and a quoted "example/fixture#7483" finds its thread. - conn-engine: the index folds as SQLite's `trigram remove_diacritics 1`, now the public `conn_engine::fold`: Latin diacritics go, but dakuten, Hangul and other letters stay apart. Queries are NFC first. The `message_search_folded` mark is 2, so a store folded by the first fold is folded again once, from message text. - conn-engine: a query word shorter than four characters must start a word in the message (`messageMatcher`), so "marker me" no longer finds "marker fermé". - conn-engine: the refold prints T3's migration lines (start, every 10,000 messages, finished), now generated into conn-contract from `databaseMigrationLog.ts`, so the desktop keeps waiting past its readiness limit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Round-2 gate findings on pass 9 search:
- conn_thread_search matched a project name and a PR only as one
substring, so "lakebed #7483" missed a thread of project Lakebed linked
to #7483. It now matches word by word across title, PR number and
titles, branch and project, as scoreThreadSearch, and keeps matchHint's
rule that a field explains the words left after the project's name.
- The index fold used Rust's Unicode tables and differed from SQLite on
461 code points (it took both marks off "ǡ", and kept "ſ"). It now reads
a table generated from the bundled SQLite's trigram tokenizer
(sqlite-fold.txt); a test fails when SQLite folds differently. The fold
mark goes to 3, so stores at 2 refold.
- The matcher ports findMessageToken: word length counts before the
index fold ("İce" finds "service"), hits inside a hex id do not count,
and the snippet starts at the accepted occurrence.
- A refold batch ends at 4 MiB of text or 500 rows, read in rowid order
without a sort.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…atcher
Round 3 of the gate on pass 9 (audit 9.4, 9.5):
- Message queries are lowercased before the index fold, as messageSearchTokens:
uppercase Georgian finds lowercase, though SQLite's fold leaves Mtavruli alone.
- Words follow T3's general categories (\p{L}, \p{N}, \p{Ll}, \p{Lu}, \p{So}, from
regex-syntax, already in the binary): a symbol starts a word only where a letter
would, in fields and in messages. Messages read in UTF-16 units, so an emoji above
U+FFFF still brings its own boundary, as in T3.
- messageMatcher's snippet offset: the lowercase pass first, the accent-folded pass
only without a whole word; words side by side as typed first, then the shortest
stretch, all in UTF-16 units; the snippet reads the offset back.
- A refold batch never passes its byte budget: a row that would is read again as
the next batch's first, and a row larger than the budget is folded alone.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The snippet started 80 characters before the match. It now follows buildSearchSnippet in ThreadSearch.ts, in UTF-16 units: from the next word start within 24 units before the match, never inside a surrogate pair, emphasis and code marks dropped, whitespace collapsed, at most 240 units with ellipses where the text was cut. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A thread titled as the query dropped out under a small limit when a newer thread only linked a PR of that title. Hits now rank whole title, then title, then other fields, before the limit; recency breaks ties. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…as T3 The matcher saw the link address, so 'quartz' found a message that only shows 'release notes'. Links reduce to their label before matching and the snippet, like ThreadSearch.ts's MARKDOWN_LINK. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # apps/conn-server/Cargo.lock # apps/conn-server/crates/conn-contract/src/lib.rs # apps/conn-server/crates/conn-contract/src/upstream.rs # apps/conn-server/crates/conn-engine/Cargo.toml # apps/conn-server/crates/conn-engine/src/store.rs # apps/conn-server/tools/gen-upstream.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pass 9, findings 9.4 (
conn-mcp) and 9.5 (conn-engine), with the gate findings on them fixed.9.4: An agent can't find an active thread from its linked PR.
conn_thread_searchmatched title, branch and project only. It now reads the thread's PRs as T3'sthreadSearchPullRequestsandscoreThreadSearchdo:linkedPullRequest;foldSearchQuery: wrapping quotes stripped, NFC, case and accents folded. Titles, branches and project names fold the same way (foldInPlace);#Nand, for the newest three, its title: every query word must start a word there (matchTokenwithout mid-word hits; filler words optional), after apr,pullor#prefix. "resume" and "indexing resume" find "Résumé indexing"; "sume" doesn't;owner/repo#N, the PR URL and the thread id, bymatchReference's rule. A quoted"example/fixture#7483"now matches too.Test (
pull_request_watches.rs): link, sync a snapshot titled "Résumé indexing", search, unlink, all over MCP. Fails onmainand on2d5a8beb94(resumeand the quoted reference).9.5: A search without accents misses an accented message.
message_searchstores text folded as T3's index tokenizer (trigram remove_diacritics 1) folds it, as the publicconn_engine::fold(text) -> String(src/fold.rs): lower case, Latin letters lose their diacritics (SQLite'sremove_diacriticsmark set), and other scripts' marks stay. "かかく" doesn't find "かがく"; "ß", "ø" and "fi" stay distinct. Ordinary writes (index_message) and the T3 import both fold what they index.messageSearchTokens): decomposed "한글" finds composed "한글".messageMatcher,MESSAGE_WORD_START_LENGTH): "marker me" no longer finds "marker fermé", and "fts" no longer finds "drafts".metamarkmessage_search_foldedis now 2. A store with no mark or mark 1 is folded again once, from the message texts, in batches of 500 inside one transaction. It stays a mark, not a schema version, so it composes with fix(conn-server): an undone settle keeps the thread's place in Active #260 (user_version = 5) and fix(conn-server): preview tunnel, peer tool names, thread chips, orphaned subagents, resumed Claude MCP #256 (v6, whose citation re-index can callconn_engine::fold).databaseMigrationLog.ts): started, a progress line every 10,000 messages, then finished. The desktop's readiness check (DesktopBackendManager.ts,isRunningDatabaseMigrations) keeps waiting past its 3-minute limit while they run. The three messages are now generated intoconn-contractbytools/gen-upstream.mjs, not copied by hand.Depends on #261: moving
SqliteEngine::open(and so this refold) off the runtime thread ontospawn_blockingis #261's change. This PR doesn't duplicate it. Until #261 lands, a large refold still runs on the runtime thread during start, before the server listens. Merge order: #260, this PR, then #256.Tests (
engine_tests.rs,store.rs,t3_import/tests.rs,fold.rs):search_folds_latin_accents_only_and_normalizes_the_query: kana, Hangul, French andß/ø/fi; a mark-1 store refolds once from the message text.search_short_words_must_start_a_word: "marker me", "marker ke" and "fts" find nothing; "marker fe", "dra" and "afts" still match.a_refold_reports_its_start_progress_and_end_once: 10,001 messages give started, one progress line and finished, and nothing on a second open.search_folds_case_and_accents_before_and_after_the_upgradestill passes.New dependency:
unicode-normalization0.1.26 (unicode-rs; MIT/Apache-2.0 and Unicode-3.0), withtinyvec. Measured on the first commit: +113 KiB in a stripped LTO release binary. Static tables only.Checks.
cargo fmt --check,cargo clippy -p conn-engine -p conn-mcp -p conn-contract --all-targets -D warnings, and all conn-engine (217), conn-mcp (104) and conn-contract tests pass.gen-upstream.mjs --checkpasses.tools/check.shwas not run locally (disk); CI runs it. Theserve.rsT3 import still keeps its own copy of the three messages; switching it to the generated constants is left out, becauseconn-serverwas not built here.🤖 Generated with Claude Code (Claude Opus 5.5)