Repository navigation
Enforce model required filters across query clients - #430
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc4affd9d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| required_filters: list[str] = Field(default_factory=list, description="Fields callers must filter") | ||
| required_filters_or_groups: list[str] = Field( | ||
| default_factory=list, description="Fields callers must filter or group by, independently for each field" |
There was a problem hiding this comment.
Invalidate cached SQL when required policies change
These mutable policy lists can be changed after a model is added, but such mutation does not increment SemanticGraph._version, which is the only graph state included in SemanticLayer.sql()'s rewrite-cache key. If an SQL query is cached before required_filters is assigned or appended—or after it is changed to require another field—the next identical layer.sql() call reuses the cached rewrite without invoking validate_required_filters_sql, allowing the new obligation to be bypassed. Include these policies in cache invalidation or prevent untracked mutation.
Useful? React with 👍 / 👎.
Add model-level
required_filtersandrequired_filters_or_groupsso queries fail clearly when a participating model's required fields are neither filtered nor, where allowed, grouped. Structural field matching covers time grains, segments, Explore filters, metric dependencies, intermediate joins, and SQL aliases/scopes before Python or Rust dispatch.Preserve the policies through YAML round trips and inheritance. CLI, HTTP, MCP, and standard semantic SQL share enforcement; raw bypasses and Yardstick SQL are rejected for policy graphs. Standalone native runtimes remain unsupported and exported definitions retain the policies.
Fixes #422.