Skip to content

fix: a first-name card beside the full card is one person, not nobody - #173

Merged
nixfred merged 2 commits into
nixfred:mainfrom
k7cfo:fix/name-prefix-duplicates
Nov 25, 2026
Merged

nixfred merged 2 commits into
nixfred:mainfrom
k7cfo:fix/name-prefix-duplicates

Conversation

@k7cfo

@k7cfo k7cfo commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Two cards in one Contacts source that share a number are treated as ambiguous unless their names match under _name_key (spacing, case, NFKC). A common duplicate fails that test: one card saved in a hurry as Alex, another saved properly as Alex Rivera. Messages.app names that conversation; Blip shows a bare number and no photo.

On a real address book this pattern (Name / Name Surname, or a full name with a trailing note) left several one-on-one conversations showing a bare number.

Change

_same_person(a, b) in bridge/mac/imsg extends the existing one-card-saved-twice rule:

  • Same _name_key: one person, first spelling stays (unchanged).
  • One name's words are the leading words of the other's: one person, and the fuller name wins.
  • Anything else stays two people. Dana Park / Dana Reyes is still nobody (existing test), and Ann / Anna Smith is nobody (words, not letters).

The longest name wins, so card order doesn't matter: Alex, Alex Rivera, Alex Lee resolves to nobody in either order. _vote (names) and _one_person (photos) share the rule, so photos still follow names. None-stays-None (Astra #2), cross-source ranking, and the exact-before-suffix rule (Astra C#2) are untouched.

Tests

bridge/mac/test_phone_match.py, OneCardSavedTwice:

  • test_a_first_name_card_beside_the_full_card_is_one_person: fails on main, passes here. Covers both card orders and photo candidates.
  • test_leading_words_not_letters: guard.
  • test_two_full_names_after_a_short_one_are_still_nobody: order-independence guard, names and photos.

test_phone_match.py is 30/30 OK. imsg_test.py, contacts_test.py, test_group_photo.py, and test_serve.py are OK. py_compile is clean.

Live check: with the patched imsg on a macOS 26 gateway, the prefix-duplicate conversations now show names and photos, and pairs with genuinely different names stay unnamed, as intended.

bridge/mac/contacts (build_lookup_index, which backs contacts lookup) has its own, stricter ambiguity rule. I left it alone because it isn't on the display-name path.

…t stall polling (nixfred#125 item 2) (nixfred#171)

WHAT: collect() used to call runReadAction (spawnSync, 180 s timeout) inline, so
one hung Mac call held the collector process for up to three minutes and every
poll, toast and refresh queued behind it in BarWidget. The due read intent is now
started by startReadAction in a detached `collector.ts --read-worker` process.
The collector writes read-action.json first (one action at a time, which also
keeps Messages' process-global selection to one user), the worker only adds
`done` to it, and the collector stays the SOLE writer of state.json, folding the
result in with settleReadAction on the poll that started it or a later one.
The starting poll waits up to BLIP_READ_GRACE_MS (default 5 s) so the common
1 to 3 s action still reports its outcome in the same poll, as before.

WHY: nixfred#125 item 2. The attempt is still persisted BEFORE the action starts, a
failed intent is never dropped, backoff is counted from when the action ended,
a worker silent past 190 s counts as a failure, and a result for an intent a
newer gesture replaced is ignored.

TESTS: a hung imsg-read no longer holds up polling (mutation: restoring the
blocking wait makes it fail), later polls start nothing while it runs, its
result is picked up by the next poll, a failure that ends after the poll left
is kept with its error, settleReadAction unit cases, grace parsing. bun test:
944 pass, 1 fail (audio-waveform, needs ffmpeg, fails on main too).
CLAUDE.md invariant amended: detached from the poll, never from its acknowledgement.

LR-T: blip, read-sync, collector, worker, hung-imsg-read
LR-D: blip
LR-K: issue-125-item-2, read-action-worker, settleReadAction
LR-L: law-9, law-10


Claude-Session: https://claude.ai/code/session_01BXN1v5rSKpVomPJvPhZCng

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
@k7cfo
k7cfo requested a review from nixfred as a code owner November 24, 2026 17:39
Two cards in ONE Contacts source sharing a number were ambiguous unless
their names matched under _name_key (spacing, case, NFKC). A common
real-world duplicate fails that test: one card saved in a hurry as
"Alex", another saved properly as "Alex Rivera". Messages.app names the
conversation; Blip showed a bare number and no photo.

_same_person() extends the one-card-saved-twice rule: when one name's
words are the leading words of the other's, it is one person and the
fuller name wins. Words, not letters ("Ann" does not lead "Anna Smith");
different words ("Dana Park" / "Dana Reyes") stay two people, as before.
Longest-wins keeps card order out of it: Alex, Alex Rivera, Alex Lee is
nobody in any order. _vote (names) and _one_person (photos) share the
rule, so photos keep following names. The None-stays-None invariant
(Astra nixfred#2) is unchanged; cross-source ranking is untouched.

Tests: test_phone_match.py OneCardSavedTwice gains the prefix case
(fails before, passes after), a letters-not-words guard, and an
order-independence guard for three cards.
@k7cfo
k7cfo force-pushed the fix/name-prefix-duplicates branch from 7d05a0c to 9d1c193 Compare November 24, 2026 17:40
@nixfred
nixfred merged commit 23dc78f into nixfred:main Nov 25, 2026
1 check passed
nixfred added a commit that referenced this pull request Nov 25, 2026
WHAT: Weekly contributor notes for the three changes landed today, with what was
verified, and the open X-handle question for Nick (@k7cfo).

LR-T: blip, weekly-notes, contributors
LR-D: blip
LR-K: w48, k7cfo, ianswope

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXN1v5rSKpVomPJvPhZCng
@nixfred

nixfred commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Merged in 23dc78f. Thank you, Nick, and welcome: for a first pull request this is a lovely one.

The problem is exactly the sort that real address books have and test fixtures do not: the same person saved once in a hurry and once properly, and Blip answering with a bare number. Your rule is narrow and easy to reason about. Words and not letters, so Ann never swallows Anna Smith; two different surnames still name nobody; card order does not matter; photos follow names through the same function. You wrote the guard tests along with the fix, left the cross-source ranking and the exact-before-suffix rule alone, and told us plainly which other path you did not touch. That made it easy to review.

What I measured on my own gateway, old bridge against new, over 3,159 handles: 2 gained a name, 0 lost one, and 1 changed, from a first name to the same name in full. That is your change doing precisely what you said it would. test_phone_match.py is 30/30, the new prefix test fails on the previous code, CI is green on main, and it is installed on my gateway now.

One limit I accepted and wrote into the CHANGELOG: John Smith and John Smith Jr sharing a number now show the Jr. It only changes what is displayed, never where a message goes. If it ever bites someone, treating generation suffixes as a different person would be a welcome follow-up.

We like to credit contributors by name when we post about Blip. I did not find an X account for you. If you have one you would like tagged, tell me the handle; "please do not tag me" is just as good an answer. Thank you again for making Blip better.


Generated by Claude Code

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.

2 participants