ShauryaaIBM commented on code in PR #43762:
URL: https://github.com/apache/superset/pull/43762#discussion_r3931793829


##########
superset/utils/screenshots.py:
##########
@@ -196,31 +178,13 @@ def is_computing_stale(self) -> bool:
             datetime.now() - datetime.fromisoformat(self.get_timestamp())
         ).total_seconds() >= computing_ttl
 
-    def should_trigger_task(
-        self, force: bool = False, expected_scope: str | None = None
-    ) -> bool:
-        """
-        :param expected_scope: The scope (e.g. "dashboard:<id>") the caller
-            requires this entry to carry. Entries written before scope
-            tracking existed -- or by a stale/mismatched caller -- deserialize
-            with no scope (or a different one) and are otherwise
-            indistinguishable from a fresh, valid ``UPDATED`` entry, which
-            would leave them permanently un-refreshed: the scope check at
-            read time rejects them, but nothing ever re-triggers computation.
-            Treat a scope mismatch on an ``UPDATED`` entry as a cache miss so
-            it gets recomputed and re-scoped.
-        """
+    def should_trigger_task(self, force: bool = False) -> bool:

Review Comment:
   Fixed in e861d0f. The scope-tracking logic was accidentally dropped from 
ScreenshotCachePayload during restructuring. Restored in full:
   
   - ScreenshotCachePayloadType now includes scope: str | None so the field 
survives to_dict()/from_dict() round-trips. from_dict uses .get("scope") so 
pre-existing cache entries without the key deserialize without KeyError.
   
   - get_scope() and set_scope() are back on the class.
   
   - should_trigger_task() accepts expected_scope again and re-triggers 
computation when an UPDATED entry carries the wrong or absent scope.
   
   - compute_and_cache() passes expected_scope=self.cache_scope and calls 
cache_payload.set_scope(self.cache_scope) before .computing().
   
   All callers — should_trigger_task(force, expected_scope=...) in 
dashboards/api.py and charts/api.py, get_scope() in both those files, and 
cache_scope = assignments in tasks/thumbnails.py — resolve without TypeError or 
AttributeError.



-- 
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