Skip to content

fix(search): exclude archived identities from profile search - #7368

Open
clawilution wants to merge 1 commit into
block:mainfrom
clawilution:fix/search-exclude-archived-profiles
Open

clawilution wants to merge 1 commit into
block:mainfrom
clawilution:fix/search-exclude-archived-profiles

Conversation

@clawilution

Copy link
Copy Markdown

Summary

Archived identities (NIP-IA archived_identities) kept appearing in kind-0 profile search results — the add-members picker, mention typeahead, invite search, and the CLI users get --name lane all surface FTS profile hits. On a self-hosted relay that retired several duplicate identities, all of the retired ones kept showing up in every people picker, one misclick away from re-adding or re-tagging an identity that no longer exists.

This is the server-side complement to the existing client-side fixes: the FTS layer in buzz-search now excludes events authored by an archived pubkey when the query targets kind 0 only. Message-history search is intentionally untouched — archiving is a visibility hint, not a ban, and per NIP-IA history remains searchable.

Related issue

None found for the relay/search layer. Closest existing work is client-side: #5034 and #6548 (mobile mention autocomplete), which hide archived identities in the app's candidate list. Those remain valuable; this PR covers the shared server-side lane so every client benefits without per-app filtering.

Testing

  • New Postgres integration test profile_search_excludes_archived_identities: an archived identity's kind-0 profile disappears from prefix search, an active control profile still matches, and the archived identity's kind-9 messages remain searchable.
  • Full buzz-search suite against Postgres 17: 3 unit + 20 integration tests pass (cargo test -p buzz-search --tests -- --include-ignored).
  • cargo fmt --all -- --check and cargo clippy -p buzz-search --all-targets --all-features -- -D warnings clean on current main (f038cbb).
  • Manually verified on a live self-hosted relay: profile-name searches that previously returned retired duplicates now return exactly the active identities, while the same archived identities' message history remains findable.

NIP-IA archived identities kept surfacing in kind-0 profile typeahead —
add-member pickers, mention candidates, and invites listed retired
duplicate identities alongside (and ahead of) their replacements. The
archived_identities record is a community-local UI visibility hint, and
the people directory is the UI it must hide.

The FTS layer now excludes events authored by an archived pubkey when
the query targets kind 0 only. Message-history search is untouched:
archiving is not a ban, and per NIP-IA history remains searchable.

Add a Postgres integration test: an archived identity's kind-0 profile
disappears from prefix search, an active control profile stays, and the
archived identity's kind-9 messages remain searchable.

Signed-off-by: Fizz <264668191+clawilution@users.noreply.github.com>
@clawilution
clawilution requested a review from a team as a code owner September 5, 2026 06:47
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is f038cbbb0d4092a72ffd93f17916f84d2b39bb43...7b1b7f69f8586c4619ba952e8cba0c17571df180.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review 7b1b7f69f8586c4619ba952e8cba0c17571df180 to authorize a new review.
Any previous review applies only to its recorded range.

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.

1 participant