Resolve people search by pubkey and alias#1707
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f10f8424f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
From my agents...
I found two blocking correctness issues in the new directory path:
-
Deleted kind:0 profiles are resurrected from stale
usersfields. NIP-09 soft-deletes the event, buthandle_standard_deletion_eventdoes not clear the denormalized profile columns. The new stored-event lookup then finds no live event and synthesizes a kind:0 containing the old name/avatar/NIP-05. Deleted profile data therefore reappears in every people-search surface. Please make deletion update the profile cache (with ordering/republication semantics) or explicitly distinguish “never had a profile” from “profile deleted” before synthesizing, and add an integration test covering publish → delete → search. -
OFFSET paging is unstable for ties.
search_usersorders by score and a non-unique display label only. Users sharing both (for example many “Alex” rows) can move across page boundaries, causing duplicates and omissions. Add pubkey hex as a final deterministic key and test tied rows across pages.
Also, this branch is now 149 commits behind main and overlaps changed buzz-db APIs, so it must be rebased and fully revalidated. Current GitHub CI has only DCO/Semgrep/zizmor; there is no relay/Rust/Desktop run to gate the change.
Desktop member/DM/@mention typeahead only searched kind:0 content via NIP-50 FTS, so hex pubkeys never matched and aliases only hit when they appeared as content tokens. Route pure kind:0 directory queries through the users table (display_name, nip05_handle, pubkey hex), prefer real stored profiles when present, and score mid-string pubkey matches on the desktop re-ranker. Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2f10f84 to
eb58fd8
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
1 similar comment
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
ab739cd to
dbbca47
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@wesbillman Fixed in dbbca47. Rebased onto current main, added deleted-profile history detection plus publish → delete → search coverage, and made tied pagination deterministic by pubkey with a page-boundary regression test. Validation: just ci passed; both new Postgres/live-relay regressions passed explicitly; every real just test group passed. The test wrapper still exits 1 on its pre-existing buzz-auth --test * no-target probe. |
Summary
buzz_db::search_users(name / NIP-05 / pubkey) was unuseduserstable, prefer real stored kind:0 profiles when present (keeps NIP-OA agent tags), synthesize a directory-shaped kind:0 otherwise, and score mid-string pubkey matches in the desktop re-rankerTest plan
cargo test -p buzz-relay --lib people_directory/synthetic_kind0rank_matches_mid_string_pubkey_hexcargo check -p buzz-db -p buzz-relayRelated: mobile add-people surface is #1706 (separate gap). This PR is the search backend that both clients depend on.