Repository navigation
fix(query-object): exclude force_query from the chart cache key - #41825
mikebridge wants to merge 2 commits into
Conversation
force_query was added to QueryObject (for the semantic-layer cache's bypass check) and included in to_dict() — which cache_key() hashes. An execution-control flag in the identity hash means a forced refresh writes its fresh result under a DIFFERENT cache key while every subsequent ordinary request keeps reading the stale entry under the old one: force-refresh becomes ineffective for all other viewers of the chart, and cache storage doubles per chart. Affects every chart on the legacy path, not just semantic layers. Strip it in cache_key() alongside the existing execution-control exclusions (from_dttm/to_dttm, conditional apply_fetch_values_predicate). Verified surfaced by the codeant architect scan on apache#40221 (2026-05-19, unaddressed). Test pins that forced and unforced requests share a cache key; validated to fail without the fix.
|
Bito Automatic Review Skipped - Branch Excluded |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…gration block Review-panel finding (3/4 lenses): the exclusion sat inside the block whose TODO says everything below it should eventually move INTO to_dict() and be hashed — the exact opposite of force_query's contract. Grouped with the from_dttm/to_dttm deletions instead, under an explicit PERMANENT-exclusions comment. Test strengthened with a discrimination guard (identity fields must still vary the key) and its docstring deduplicated against the production comment.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## sl-cache #41825 +/- ##
==========================================
Coverage 63.43% 63.43%
==========================================
Files 2592 2591 -1
Lines 138780 138646 -134
Branches 32235 32214 -21
==========================================
- Hits 88038 87955 -83
+ Misses 49212 49170 -42
+ Partials 1530 1521 -9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rusackas
left a comment
There was a problem hiding this comment.
LGTM, nice catch. force_query still gets checked directly in mapper.py for the semantic-cache bypass, so this only tightens the classic QueryObject.cache_key() hash without touching that path.
Red CI here is just the semantic_layers coverage gap, looks like #41856's already got it covered.
|
Supersession note to prevent accidental merge: #42760 is the consolidated replacement under review and explicitly carries forward the still-valid work and attribution from this PR stack. This does not mean #42760 has been accepted for adoption yet; that decision remains pending. Please do not merge this stacked PR while the consolidation decision is open; a maintainer or PR owner can close it and reopen later if the direction changes. |
|
This has been idle since the supersession note was posted three weeks back. Has the call been made on #42760's consolidation? |
|
Closing: this was a contribution into #40221's Closed by Claude (AI) on behalf of @mikebridge. |
SUMMARY
Second contribution into #40221's branch (
sl-cache), fixing the unaddressed codeant architect finding onquery_object.py(2026-05-19) — verified real:force_querywas added toQueryObjectfor the semantic cache's bypass check (legitimate), but it also landed into_dict(), whichcache_key()hashes. An execution-control flag inside the identity hash means:force_query=Truehashed in).force_query=False→ keeps serving the stale entry under the old key. Force-refresh silently stops refreshing what other viewers see, and cache storage doubles per chart.This affects every chart on the legacy path, not just semantic layers.
The fix: strip
force_queryincache_key(), exactly like the existing execution-control exclusions two lines above (from_dttm/to_dttm, conditionalapply_fetch_values_predicate).TESTING INSTRUCTIONS
test_cache_key_ignores_force_querypins that forced and unforced requests share a cache key — validated to fail without the fix.The flag's bypass behaviour (as opposed to key identity) is separately pinned upstream in the stack: the semantic path reads the attribute directly (
mapper.py) and is covered bytest_force_query_bypasses_semantic_cacheincache_integration_test.py; the classic chart-cache bypass is likewise attribute-driven viaQueryCacheManager.pytest tests/unit_tests/queries/query_object_test.py -q # 13 passedADDITIONAL INFORMATION
🤖 Generated with Claude Code