Skip to content

fix: 6779 compose source filters into $and - #6891

Merged
Pyatakov merged 1 commit into
developfrom
fix/6779-compose-source-filters
Sep 11, 2026
Merged

fix: 6779 compose source filters into $and#6891
Pyatakov merged 1 commit into
developfrom
fix/6779-compose-source-filters

Conversation

@Pyatakov

Copy link
Copy Markdown
Contributor

Description

documentValidatorBlock built its source query by assigning each configured filter onto filter[field], so two filters on the same field overwrote each other. The surviving one decided whether the source validation admitted documents it was meant to exclude or rejected ones it was meant to admit, and nothing reported the dropped constraint.

  • Accumulate every source filter predicate into $and instead of assigning onto filter[field], so repeated fields compose
  • Keep the structural clauses (policyId, schema, owner, group, assignedTo, assignedToGroup) as direct keys, since each is emitted at most once
  • Leave $and unset when a source validation configures no filters
  • Cover the composed predicates with unit tests, including the reported range-plus-exclusion case and its reverse order

A duplicated field is deliberately not reported as a config error: with predicates composing, a range bound plus an exclusion on one field is a valid configuration.

Closes #6779

@Pyatakov
Pyatakov requested review from a team as code owners September 10, 2026 20:32
@Pyatakov Pyatakov self-assigned this Sep 10, 2026
@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown

Test Results

 33 files  ±0   66 suites  ±0   4m 18s ⏱️ -6s
 35 tests ±0   35 ✅ ±0  0 💤 ±0  0 ❌ ±0 
173 runs  ±0  173 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 133c032. ± Comparison against base commit 03dbd6b.

♻️ This comment has been updated with latest results.

@Pyatakov
Pyatakov force-pushed the fix/6779-compose-source-filters branch 2 times, most recently from c9cd314 to 2fee32a Compare September 10, 2026 20:47
Source filters were assigned onto filter[field], so two filters on
the same field overwrote each other and the dropped constraint let
the source validation fail open or closed depending on the order.
Every predicate now goes into $and, so repeated fields compose.

Signed-off-by: Alex Piatakov <alex.piatakov@hashgraph.com>
@Pyatakov
Pyatakov force-pushed the fix/6779-compose-source-filters branch from 2fee32a to 133c032 Compare September 10, 2026 20:49
@Pyatakov
Pyatakov merged commit d369618 into develop Sep 11, 2026
21 checks passed
@Pyatakov
Pyatakov deleted the fix/6779-compose-source-filters branch September 11, 2026 17:26
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