Skip to content

Return no matches for contradictory query filters - #66

Merged
HexDecimal merged 2 commits into
HexDecimal:mainfrom
antonsoo:fix/contradictory-query-filters
Oct 19, 2026
Merged

HexDecimal merged 2 commits into
HexDecimal:mainfrom
antonsoo:fix/contradictory-query-filters

Conversation

@antonsoo

Copy link
Copy Markdown
Contributor

registry.Q.all_of(tags=["actor"]).none_of(tags=["actor"]) raises an internal AssertionError while constructing the query. This makes dynamically composed filters fail when a required condition is also excluded, instead of producing an empty result.

Remove the disjointness assertion. The existing intersection/difference compiler already evaluates these conjunctions correctly, including normal cache invalidation.

Validation:

  • All six component, tag and relation regression cases fail before the fix, in either builder order.
  • Full suite on Python 3.10 and 3.12: 112 passed, 2 non-strict xpasses. Configured Mypy and Ruff pass.
  • A game-state workload compares 720 filter evaluations with independent SQLite/set predicates, continues through 120 turns and save/load, and preserves all 12 final world states. All 720 formerly failing constructions now return the expected empty result.

This is independent of #65's cache ownership change.

OpenAI Codex assisted with investigation, implementation and validation.

@HexDecimal

Copy link
Copy Markdown
Owner

It is a contradictory state. It makes sense to remove the assertion error, but I wonder if at least a warning should be raised. Or is this state so obvious that it warrants no runtime warnings at all?

@antonsoo

Copy link
Copy Markdown
Contributor Author

Overlap can be an expected empty result when independent filters are combined, for example a required actor filter plus a user-selected exclusion of actor. A warning would flag that valid use too. This patch returns no matches quietly, matching the existing intersection/difference semantics.

@HexDecimal HexDecimal left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right. It was a mistake for me to give this case special attention.

@HexDecimal
HexDecimal merged commit c9510dd into HexDecimal:main Oct 19, 2026
14 checks passed
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