Fix: context-free filters cover all contexts under strict#7
Merged
Conversation
Context-free filters already apply to all contexts during query composition, but the strict coverage check treated them as covering nothing. That was inconsistent: "applies to all" and "covers all" should align. Now a context-free filter short-circuits the coverage check — strict only denies when every filter declares a context and some active non-ambient context isn't listed. For strict mode to be meaningful, every filter should declare a `context:` array.
Adds explicit test that a context-free filter placed first under FirstMatch short-circuits all subsequent filters. This has been the behavior since FirstMatch was introduced — the test makes it a regression guard against silent drift.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an inconsistency between how context-free filters are handled during query composition vs the strict coverage check.
A filter with no `context:` array is documented as "applies to all contexts" — and that's exactly how matching strategies treat it. But the strict coverage check was treating context-free filters as contributing no coverage. That meant adding a base `company_id = X` filter (a very common pattern) silently made strict mode deny all real contexts.
Now context-free filters cover all contexts for the strict check too. "Applies to all" and "covers all" align.
Behavior changes
Tests
All 49 tests pass.