Repository navigation
fix: preserve sender-aware self echoes in search - #126
Conversation
Reuse the thread loader's echo deduplication before shaping search hits. This preserves distinct group senders and attributes self echoes to the user regardless of bridge row order, including empty outgoing rows. Message content still stays in memory and travels to the bridge on stdin.
WHAT: shapeResults hands outgoing rows to dedupeSelfEcho first. One regression test in search.test.ts: two incoming copies, the sent row, its echo, in the newest-first order the bridge answers, must be one hit from me. WHY: a self-thread message that Messages in iCloud re-synced sits in chat.db as one sent row plus 3 or 4 incoming copies with the same second and text. `imsg search` answers newest first, and dedupeSelfEcho folds a copy only into a row of the OPPOSITE direction, so two incoming copies ahead of the sent row left one behind as an incoming hit. The same four rows oldest first fold to one (checked both tie orders). Found while checking #126 against live rows; #126 itself is correct. MEASURED on the live Mac, 400 rows per query, query "test": 340 hits on old main, 286 with #126, 196 with this; self-thread hits shown as incoming 96 -> 6. "yes" 11 -> 1, "ok" 3 -> 0, "thanks" 5 -> 1. Hits in every other conversation identical (372, 388, 130, 389). VERIFIED: the new test fails on #126 alone and passes here. NOT CHANGED: dedupeSelfEcho. The collector and the thread loader keep their exact behaviour; only search's input order moves. LR-T: blip, search, self-thread, dedupeSelfEcho, icloud-resync, duplicate-hits LR-D: blip LR-R: #126 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011cTWkcA3ontxAAbXqmkfKE
|
Merged in 584aa07, thank you, and welcome to Blip. This was a good catch: search kept its own echo key with no sender in it, so a "yes" from me and a "yes" from someone else in the same second quietly became one hit. Reusing What I checked before merging:
That comparison turned up one more thing, which is not a fault in your PR. My self-thread holds 3 or 4 incoming copies of each note (same second, same text, apparently iCloud re-sync). One small thing: I thank contributors by name in a weekly post on X. Your GitHub profile lists @GreyforgeLabs, so I will tag that unless you would rather not be tagged, which is an equally good answer. |
Searching a group conversation can hide a real reply: an outgoing "yes" and another member's "yes" in the same second collapse to one hit because search's echo key omits the sender. Search also keeps whichever self-echo row arrives first, so your own message can appear as incoming.
Use the existing
dedupeSelfEcho()shared by the collector and thread loader before search discards empty bodies. This preserves distinct group senders, makes self-echo direction independent of row order, and lets an empty outgoing row identify its decoded incoming twin. Ranking and limits stay in the search layer; message text stays in memory and travels to the bridge on stdin.Validation:
bun test: 676 pass, zero failures.