feat: add NIP-91 AND filter support - #44
Conversation
erskingardner
left a comment
There was a problem hiding this comment.
The NIP-91 matcher, overlap normalization, forced full-event verification, HLL omission, and limit plumbing look correct and well covered. Requesting changes for a compile break in the separate fuzz workspace; the other notes are interop/cost follow-ups.
Policy question, not a code defect: this advertises draft NIP-91 from nips#2252, which is not in the conformance pin 656cecc7…. That is a deliberate exception to “canonical NIPs it advertises.” Fine if maintainers want it, but it should be an explicit call rather than landing as if 91 were already in the pin.
|
Pushed follow-up commit
Validation completed:
The policy question about advertising draft NIP-91 remains an explicit maintainer decision; the implementation continues the PR behavior and advertises it only when |
erskingardner
left a comment
There was a problem hiding this comment.
Previous findings are fixed: fuzz depends on wok-query, query cost follows the tag/AND index, AND seed picks the smallest AND set, and outbound filters are capability-aware.
The NIP-91 matcher is still in good shape, and advertising draft 91 is an accepted maintainer call.
Requesting changes for two follow-up issues in the new NIP-11 forwarding path. After those, this looks mergeable (CI has not reported on 50227d2 yet).
erskingardner
left a comment
There was a problem hiding this comment.
Previous request-changes items are fixed on f17c044.
- Compatibility path folds each
&xset into#xinstead of dropping keys, so an&-only filter cannot become{}/ a remote firehose. Malformed&clauses still fail before the NIP-11 lookup, and filter arrays are rewritten element-wise. - NIP-11 is used only to decide NIP-91; NEG-OPEN is left to prove 77. Unreachable or malformed documents degrade to the compatibility filter.
- Historical scans seed one cursor from the smallest AND set;
estimated_costcharges that seed.nip91_and_tag_seeds_a_single_cursorcovers the cursor-count regression.
The matcher, overlap normalization, forced full-event verification, HLL omission, restricted COUNT scoping, live monitors, search does_match_without_search, and limit plumbing still look correct. Draft NIP-91 advertisement remains the accepted maintainer exception, gated on both tag-filter limits being nonzero.
GitHub has not reported checks on this head; I reviewed the diff and tests as written, not a CI run of f17c044.
Implement draft NIP-91 AND tag filters across historical queries, live subscriptions, COUNT, router forwarding, and negentropy. Add capability-aware compatibility forwarding, preserve exact local post-filtering, align query cost and cursor selection, and document and configure the filter limits. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
f17c044 to
437b8c7
Compare
Summary
&xtag filters with all-values-required semantics#xfilters so AND values do not satisfy the residual OR clausemax_and_entries/max_tags_per_filterlimits through NIP-11The implementation follows nostr-protocol/nips#2252 at
b93bda29d45998866e81c65e0693616294a78672and takes the overlap-normalization approach from hoytech/strfry#162.Safety and compatibility
#clauseTesting
cargo fmt --all --checkcargo check --workspace --all-targets --lockedcargo clippy --workspace --all-targets --locked -- -D warningscargo test -p wok-query --lockedcargo test -p wok-compat --test nip_conformance --locked(27 passed)cargo test -p wok-compat --test e2e_transports --locked -- --test-threads=1(12 passed)wok-benchpassed; one parallel LMDB allocation failure was confirmed transient by the serial E2E runIncludes unit, property, historical scan, live monitor, exact COUNT, router/sync fallback, negentropy, conformance, E2E, and fuzz coverage.