Repository navigation
Conversation
Code Review Agent Run #9bc9d3Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
The flagged issue is correct. The new validator in To implement this fix, update the @validates_schema
def validate_slack_recipients(self, data: dict[str, Any], **kwargs: Any) -> None:
if data.get("type") != ReportRecipientType.SLACKV2.value:
return
target = ((data.get("recipient_config_json") or {}).get("target") or "").strip()
# ... (rest of the validation logic)Would you like me to fetch all other comments on this PR to validate and implement fixes for them as well? superset/reports/schemas.py |
Code Review Agent Run #fa5f18Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #42850 +/- ##
==========================================
- Coverage 81.22% 81.21% -0.01%
==========================================
Files 2968 2968
Lines 179399 179343 -56
Branches 41601 41558 -43
==========================================
- Hits 145715 145660 -55
+ Misses 30974 30973 -1
Partials 2710 2710
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:
|
|
Addressed the coverage report as well. Patch coverage was 33% because the flags Codecov aggregates ( Added
That last case is worth having in the integration suite specifically, since three existing tests in this file already create v1 recipients with The unit tests stay as they are — they cover the branch logic cheaply; the integration test covers the wiring and the coverage flags. |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #9d490bActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
9100f62 to
c58965d
Compare
|
hi @eschutho , PTAL and take appropriate action. all checks have passed. |
Code Review Agent Run #3f6b28Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
EnxDev's Review Agent — #42850 · HEAD e78ff93comment — the fix is sound and the v1 carve-out is correct and load-bearing, but the "a name never delivers" premise only holds for attachment-bearing sends, so this narrows the API contract further than the description says. 🔴 Functional
🟡 Should-fix
🙌 Praise
|
|
Any thoughts on the review comments from @EnxDev? Looks pretty approvable to me otherwise. |
EnxDev
left a comment
There was a problem hiding this comment.
I traced recipient validation into the Slack v1 and SlackV2 delivery paths. Requiring C/G/D IDs only for SlackV2 preserves the legacy channel-name behavior, and the tests cover separators, missing recipients, and malformed IDs. I didn’t find a correctness issue in this pass.
eschutho
left a comment
There was a problem hiding this comment.
Posting on Elizabeth's behalf — this is her PR reviewer agent. Forward any pushback to her and she'll loop me back in.
This looks good overall — just a few optional suggestions below, none of which block merge. All line numbers verified against HEAD e78ff937b6.
superset/reports/schemas.py:136,204
The id-shape regex (^[CGD][A-Z0-9]{6,}$) would also accept an uppercase token that isn't a real channel id, e.g. CHANNEL1. It correctly rejects real (lowercase) channel names, so this would only let deliberately-or-typo'd uppercase junk through, and that would still fail at send time.
Totally optional — happy to keep as-is.
superset/reports/schemas.py:198
The target-splitting logic here is reimplemented inline; parse_slack_recipient_targets / recipients_string_to_list already do this for the send path.
Would it be worth reusing the existing helper, so validation tokenization can't drift from delivery tokenization over time?
superset/reports/schemas.py:187-191
Small nit on the comment — it says skipping v1 avoids breaking the v1→v2 upgrade path, but that upgrade command writes recipients via the DAO with already-resolved ids and never goes through this schema. The actual reasons to skip v1 (its send contract + existing v1 tests) are solid; the comment just describes a mechanism that isn't quite what's happening.
WDYT — worth a quick reword?
superset/reports/schemas.py:201,210
The new validator messages are wrapped in _() while the adjacent email-validator messages in the same class aren't, so the two now handle i18n inconsistently. Separately, the longer message hardcodes Slack's current UI wording ("View channel details…"), which could go stale if Slack changes it.
Small suggestion, not required.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Bito Automatic Review Skipped – PR Already Merged |
Co-authored-by: Enzo Martellucci <[email protected]> Co-authored-by: Enzo Martellucci <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit d130742)
SUMMARY
A report or alert saved with a Slack channel name rather than a channel id validates cleanly, runs on schedule, and then never delivers.
ReportRecipientConfigJSONSchema.targetis a barefields.String(), and the only validator onReportRecipientSchemabegins:So email addresses are regex-checked and Slack targets are not checked at all.
POST /api/v1/report/accepts{"type": "SlackV2", "recipient_config_json": {"target": "data-alerts"}}and returns 201.But
SlackV2Notification.send()passes the target straight tofiles_upload_v2(channel=...), which requires a channel id and answersinvalid_argumentsfor a name. The only signal is an error notification to the report's owner, long after the alert was created, and only if someone reads it.The UI is unaffected because its picker submits ids from
/api/v1/report/slack_channels/. The gap is the API.This is not theoretical. On one instance 46 recipients had accumulated a channel name, 21 of them on active alerts, the oldest from 2023. Of the 19 distinct names, 5 still matched a live channel, 2 matched archived ones and the rest matched nothing at all, so most could not be repaired even by hand and 15 alerts had to be switched off.
FIX
Validate SlackV2 targets the way Email targets are already validated: every comma, semicolon or whitespace separated part must look like a channel id (
^[CGD][A-Z0-9]{6,}$). The error names the offending part and says where to find the id.The deprecated Slack v1 type is deliberately left alone. v1 sends with
files_upload/chat_postMessage, both of which resolve a channel name, andslack.pynotes that existing v1 recipients are auto-upgraded to SlackV2 on first send viaupdate_report_schedule_slack_v2. Rejecting names for v1 would break that upgrade path and the v1 contract, and it would fail existing tests that create v1 recipients with names. Since v1 is removed next major, the validation applies only to the type that survives.The message is deliberately explicit about why, because "invalid channel" reads like a typo when the real cause is that names work with Slack's older
chat.postMessageand not with the upload API used for attachments.TESTING INSTRUCTIONS
Six unit tests in
tests/unit_tests/reports/schemas_test.py, following the existing email cases: a single id and multiple ids are accepted; a name, a mixed id-and-name target, and an empty target are rejected; and legacySlackwith a channel name is asserted accepted, pinning the carve-out. The mixed case asserts the message names the bad part and not the good one.Verified against the schema loaded in a running instance:
C08CSCSDCSYdata-alertsC08CSCSDCSY,data-alerts#generalchannel[email protected]Manually:
POST /api/v1/report/with a SlackV2 recipient whose target is a channel name now returns 400 instead of 201.ADDITIONAL INFORMATION