3.A Filter-engine correctness (scoping, ON ACCOUNT, non-ASCII offsets, NOT IN) #177

Closed
opened 2026-07-27 13:11:52 +00:00 by KofTwentyTwo · 1 comment
KofTwentyTwo commented 2026-07-27 13:11:52 +00:00 (Migrated from github.com)

Phase 3 — Feature completeness (behind the API). Crate: nuncio-filter.

The NSQL filter engine is the strongest subsystem but has known correctness
defects surfaced in the 2026-07-26 assessment. Fix them, each with a regression
test, keeping the engine offline-testable.

Scope / acceptance criteria

  • Account scoping — filter evaluation respects the owning account; a rule
    created for account A does not match messages of account B. Regression test.
  • ON ACCOUNT clause — the NSQL ON ACCOUNT <id> predicate parses,
    validates, and constrains evaluation to that account. Parser + engine tests.
  • Non-ASCII offset bug — string offsets/spans are computed on char
    boundaries (not raw bytes) so rules over non-ASCII subjects/bodies match at
    the correct positions. Test with a multi-byte UTF-8 fixture.
  • NOT IN operator — NOT IN (...) evaluates as the complement of IN,
    including correct handling of the empty-set and NULL cases. Parser + engine tests.
  • cargo verify green; no new clippy waivers; comments state intent only.

Definition of done: engine + (if the surface changes) proto + CLI + offline test.

**Phase 3 — Feature completeness (behind the API).** Crate: `nuncio-filter`. The NSQL filter engine is the strongest subsystem but has known correctness defects surfaced in the 2026-07-26 assessment. Fix them, each with a regression test, keeping the engine offline-testable. ### Scope / acceptance criteria - [ ] **Account scoping** — filter evaluation respects the owning account; a rule created for account A does not match messages of account B. Regression test. - [ ] **`ON ACCOUNT` clause** — the NSQL `ON ACCOUNT <id>` predicate parses, validates, and constrains evaluation to that account. Parser + engine tests. - [ ] **Non-ASCII offset bug** — string offsets/spans are computed on `char` boundaries (not raw bytes) so rules over non-ASCII subjects/bodies match at the correct positions. Test with a multi-byte UTF-8 fixture. - [ ] **`NOT IN` operator** — `NOT IN (...)` evaluates as the complement of `IN`, including correct handling of the empty-set and NULL cases. Parser + engine tests. - [ ] `cargo verify` green; no new clippy waivers; comments state intent only. Definition of done: engine + (if the surface changes) proto + CLI + offline test.
KofTwentyTwo commented 2026-07-27 13:30:20 +00:00 (Migrated from github.com)

Delivered on dev (fdb5a3f): account scoping enforced in evaluate/evaluate_with_timeout/preview; find_keyword_outside_quotes returns true byte offsets (UTF-8 fix); NOT IN implemented as complement of IN via new NotIn operator. 26 tests, reviewed clean.

Delivered on dev (fdb5a3f): account scoping enforced in evaluate/evaluate_with_timeout/preview; find_keyword_outside_quotes returns true byte offsets (UTF-8 fix); NOT IN implemented as complement of IN via new NotIn operator. 26 tests, reviewed clean.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KofTwentyTwo/nuncio#177