codeant-ai-for-open-source[bot] commented on code in PR #41103:
URL: https://github.com/apache/superset/pull/41103#discussion_r3418581617
##########
superset/commands/report/execute.py:
##########
@@ -506,9 +509,88 @@ def _get_pdf(self) -> bytes:
return pdf
+ def _get_chart_data_request_payload(
+ self,
+ result_format: ChartDataResultFormat,
+ ) -> dict[str, Any]:
+ """
+ Build the same POST payload shape used by frontend exports.
+ """
+ try:
+ query_context =
json.loads(self._report_schedule.chart.query_context)
+ except (TypeError, json.JSONDecodeError) as ex:
+ raise ReportScheduleExecuteUnexpectedError(
+ "Chart has no valid query context saved."
+ ) from ex
+
+ if not isinstance(query_context, dict):
+ raise ReportScheduleExecuteUnexpectedError(
+ "Chart has no valid query context saved."
+ )
+
+ result_type = ChartDataResultType.POST_PROCESSED.value
+ force = bool(self._report_schedule.force_screenshot)
+ query_context["result_format"] = result_format.value
+ query_context["result_type"] = result_type
+ query_context["force"] = force
+
+ form_data = query_context.get("form_data")
+ if isinstance(form_data, dict):
+ form_data["result_format"] = result_format.value
+ form_data["result_type"] = result_type
+ form_data["force"] = force
+
+ if form_data.get("server_pagination"):
+ row_limit = form_data.get("row_limit") or 0
+ queries = query_context.get("queries")
+ if isinstance(queries, list):
+ data_query_updated = False
+ download_queries = []
+ for query in queries:
+ if isinstance(query, dict) and
query.get("is_rowcount"):
+ continue
+ if isinstance(query, dict) and not data_query_updated:
+ query = {
+ **query,
+ "row_limit": row_limit,
+ "row_offset": 0,
+ }
+ data_query_updated = True
+ download_queries.append(query)
+ query_context["queries"] = download_queries
+
+ return query_context
+
+ @staticmethod
+ def _post_chart_data(
+ chart_url: str,
+ auth_cookies: Optional[dict[str, str]],
+ request_payload: dict[str, Any],
+ ) -> Optional[bytes]:
+ if not auth_cookies:
+ return None
Review Comment:
**Suggestion:** Add a short docstring to this newly introduced method
describing its purpose, expected inputs, and returned content/error behavior.
[custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is a newly introduced method in the changed hunk, and it has no
docstring.
The custom rule requires newly added Python functions and classes to be
documented inline, so this is a real violation.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=d2334f5e3f334a69b24e697c6bc6363f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=d2334f5e3f334a69b24e697c6bc6363f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/commands/report/execute.py
**Line:** 564:571
**Comment:**
*Custom Rule: Add a short docstring to this newly introduced method
describing its purpose, expected inputs, and returned content/error behavior.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41103&comment_hash=658a4edc460a62e3b3182317e0f1a1eb38a6d2b298b7eda286b792797af75dea&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41103&comment_hash=658a4edc460a62e3b3182317e0f1a1eb38a6d2b298b7eda286b792797af75dea&reaction=dislike'>👎</a>
--
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]