Skip to content

Fix EventFilter tag matching logic#125

Merged
greenart7c3 merged 1 commit intomasterfrom
claude/fix-tag-filter-semantics-51AnQ
May 4, 2026
Merged

Fix EventFilter tag matching logic#125
greenart7c3 merged 1 commit intomasterfrom
claude/fix-tag-filter-semantics-51AnQ

Conversation

@greenart7c3
Copy link
Copy Markdown
Owner

Summary

Fixed the tag matching logic in EventFilter to correctly validate that all tags match the event, rather than incorrectly rejecting events when any tag matches.

Key Changes

  • Changed tag validation from tags.none { testTag(it, event) } to !tags.all { testTag(it, event) }
  • This ensures the filter returns false only when NOT all tags match, rather than when no tags match
  • The logical equivalence is: !all(condition) correctly replaces none(condition) for this use case

Implementation Details

The original logic would reject an event if none of its tags passed the test. The corrected logic now properly rejects an event only if not all of its tags pass the test, which aligns with the expected filter behavior where all specified tags should match for an event to pass the filter.

https://claude.ai/code/session_011VV7JUFCP3ujUA681Sdi2V

Live subscription matching used `tags.none { testTag(...) }`, which
accepts an event when any single tag-key filter passes. NIP-01 requires
all tag-key filters to match (AND across keys, OR within values), the
same semantics already implemented in EventRepository's SQL via
per-tag `EXISTS` clauses joined with `AND`.

https://claude.ai/code/session_011VV7JUFCP3ujUA681Sdi2V
@greenart7c3 greenart7c3 merged commit df8cdd0 into master May 4, 2026
1 check passed
@greenart7c3 greenart7c3 deleted the claude/fix-tag-filter-semantics-51AnQ branch May 4, 2026 12:05
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