codeant-ai-for-open-source[bot] commented on code in PR #44653:
URL: https://github.com/apache/superset/pull/44653#discussion_r4121889532
##########
superset/common/query_context_processor.py:
##########
@@ -206,6 +207,11 @@ def _resolve_forced_query(
self._force_marker_key(nonce, cache_key)
)
except Exception: # noqa: BLE001 pylint: disable=broad-except
+ # Under `SupersetMetastoreCache` this read is a metadata-DB SELECT,
+ # so roll back before degrading to "absent": this runs before any
+ # engine is built, and leaving db.session in "pending rollback"
+ # state would fail the recompute we are about to force.
+ db.session.rollback() # pylint: disable=consider-using-transaction
Review Comment:
✅ **CodeAnt verified this suggestion was addressed in subsequent commits and
marked this thread resolved** as of `43c79b2`.
Marker reads are wrapped in a broad exception handler that logs the failure
and returns `True` to force recomputation without rolling back the session.
<sub>If that's not right, unresolve this thread and CodeAnt will leave it
open.</sub>
<!-- codeant-auto-resolve-reply -->
##########
superset/jinja_context.py:
##########
@@ -295,6 +295,11 @@ def current_user_roles(self, add_to_cache_keys: bool =
True) -> list[str] | None
self.cache_key_wrapper(json.dumps(user_roles))
return user_roles
except Exception: # pylint: disable=broad-except
+ # `get_user_roles()` lazy-loads roles from db.session, so a caught
+ # DB error can leave it in "pending rollback" state. This runs
+ # during SQL templating, upstream of the engine build that would
+ # otherwise inherit the failed transaction.
+ db.session.rollback() # pylint: disable=consider-using-transaction
Review Comment:
✅ **CodeAnt verified this suggestion was addressed in subsequent commits and
marked this thread resolved** as of `43c79b2`.
Database errors from role loading are handled separately with a session
rollback, while cache-key and other non-database exceptions return `None`
without rolling back pending work.
<sub>If that's not right, unresolve this thread and CodeAnt will leave it
open.</sub>
<!-- codeant-auto-resolve-reply -->
--
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]