mikebridge opened a new pull request, #45288:
URL: https://github.com/apache/superset/pull/45288

   ### SUMMARY
   
   **TL;DR:** Setting a datasource cache timeout to `-1` also disables caching 
for filter-value suggestions and compatible-field lists.
   
   **Background:** These endpoints cache their results to avoid repeating 
datasource work.
   
   **Problem:** They read existing entries before checking the timeout and pass 
`-1` to the cache backend when writing. This can return stale suggestions and 
retain new entries without expiry despite caching being disabled.
   
   **What this changes:**
   
   - Skip both reads and writes when the effective timeout is 
`CACHE_DISABLED_TIMEOUT`.
   - Fetch fresh values and compatibility results, even when an old entry 
exists.
   - Preserve enabled-cache timeouts, search caps, force-refresh behavior and 
cache keys.
   
   The detailed design follows.
   
   Resolve the existing datasource/default timeout before the first cache 
lookup and guard both cache operations. The shared column-values helper covers 
its endpoint and existing callers; `/compatible` applies the same guard. No 
chart-data caching, identity format or cache-version change. Disabled entries 
are ignored rather than deleted. These endpoints retain their existing fallback 
to the top-level `CACHE_DEFAULT_TIMEOUT`; setting only 
`DATA_CACHE_CONFIG["CACHE_DEFAULT_TIMEOUT"]=-1` does not disable them. Aligning 
that fallback chain is a separate follow-up, recorded in the conductor handoff.
   
   When disabled, each request intentionally fetches fresh results and 
increases source work. Earlier versions could leave Redis entries without 
expiry: before re-enabling caching, invalidate the affected `col_values:` and 
`compatible:` entries through your deployment's cache tooling, including the 
configured key prefix.
   
   [SC-126717](https://app.shortcut.com/preset/story/126717)
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Not applicable: backend cache behavior only. Before, `-1` can still 
serve/write cached results; after, both endpoints bypass the cache.
   
   ### TESTING INSTRUCTIONS
   
   1. Set a semantic view's cache timeout to `-1`, or leave it unset with 
`CACHE_DEFAULT_TIMEOUT=-1`.
   2. Call `/api/v1/datasource/semantic_view/<id>/column/<column>/values/` and 
`/api/v1/datasource/semantic_view/<id>/compatible` (POST).
   3. Verify fresh results and no `data_cache.get`/`data_cache.set`, including 
with old entries, value searches and forced value requests.
   4. Restore a positive timeout and verify the first call writes an entry and 
the second reads it.
   
   Automated evidence: 20 disabled-cache cases failed before the production 
fix; 8 enabled-cache controls passed. The complete endpoint test module passes 
(54 tests). Changed-file pre-commit, including MyPy, passes. Whole service-free 
unit suite at `f4a98d3b47`: 11 failed, 27299 passed, 49 skipped, 2 xfailed in 
1300.10s (0:21:40). All 11 failures are accepted pre-existing environment 
baselines; no failing test file is changed by this branch:
   
   - Two ARM longdouble failures: `dataframe_test.py` and 
`common/test_query_context_processor.py`.
   - One translation-fixture PATH failure: 
`scripts/translations/babel_update_test.py`.
   - Eight MCP dateutil/DST failures reproduced on base `0ce9b6ca46` and 
tracked in [SC-126726](https://app.shortcut.com/preset/story/126726): 
`mcp_service/chart/test_bullet_chart.py` (2), 
`mcp_service/chart/test_bullet_tool_paths.py` (3), 
`mcp_service/chart/tool/test_get_chart_data.py` (1), 
`mcp_service/dataset/tool/test_query_dataset.py` (1), and 
`mcp_service/semantic_layer/tool/test_get_table.py` (1). Paths are relative to 
`tests/unit_tests/`.
   
   The full suite completed its summary; its process lingered during shutdown 
and was stopped afterward. No live Redis, browser or integration suite was run.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: 
[SC-126717](https://app.shortcut.com/preset/story/126717)
   - [x] Required feature flags: `SEMANTIC_LAYERS` for semantic-view use
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   Implementation by Codex; independent review by Claude. Draft for review; no 
merge readiness claim.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to