fix(alerts): route test alert deep links to the cold-load-safe test-results route (#2283)#2296
Conversation
…afe) Test alert deep links point at #/report/test-runs/<id>. On a cold page load (opening the link from a Slack alert in a fresh tab) the detail route's redirect guard fires while report data is still fetching (empty array) and navigates to the parent Test Performance list, so the alert never opens the specific failing test. Pasting the same URL into an already-open report tab works, which is why this only reproduces from alerts. The test-results/<id> route does not hit this guard and cold-loads to the correct test (it also surfaces the run history), so reroute test alert deep links there. This is a link-layer fix for the symptom; the underlying redirect-guard bug lives in the report UI. Fixing the guard directly (e.g. gating the redirect useEffect on isFetching, or falling back to embedded report data during fetch) would let test-runs/<id> keep working — maintainers may prefer that. Refs elementary-data#2283 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
👋 @niccoloalexander |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTest run report links now use the ChangesReport link path update
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
elementary/monitor/data_monitoring/alerts/integrations/utils/report_link.py (1)
17-19: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider renaming the enum member to match its new value.
The member
TEST_RUNSnow maps to"test-results", creating a name/value mismatch that could confuse future developers. The comment helps, but renaming toTEST_RESULTSwould be self-documenting. This would require updating references inslack.pyand any other consumers, so it's best deferred if the rename touches many files.♻️ Optional rename for consistency
class ReportPath(Enum): # test-runs/<id> cold-loads to the parent list, not the test (see `#2283`) - TEST_RUNS = "test-results" + TEST_RESULTS = "test-results" MODEL_RUNS = "model-runs"All references to
ReportPath.TEST_RUNS(e.g., line 39, and inslack.py) would need to be updated accordingly.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@elementary/monitor/data_monitoring/alerts/integrations/utils/report_link.py` around lines 17 - 19, Rename the ReportPath enum member TEST_RUNS to TEST_RESULTS to match its "test-results" value, then update every reference to ReportPath.TEST_RUNS, including usages in slack.py and other consumers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@elementary/monitor/data_monitoring/alerts/integrations/utils/report_link.py`:
- Around line 17-19: Rename the ReportPath enum member TEST_RUNS to TEST_RESULTS
to match its "test-results" value, then update every reference to
ReportPath.TEST_RUNS, including usages in slack.py and other consumers.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3b266e64-8676-4c3c-b3f6-59777f1486b5
📒 Files selected for processing (1)
elementary/monitor/data_monitoring/alerts/integrations/utils/report_link.py
Assert test alert deep links resolve to /report/test-results/<id>/ (the cold-load-safe route, elementary-data#2283) and never /report/test-runs/, that the button label is unchanged, that model-run links are untouched, and the None cases. Refs elementary-data#2283 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Added tests in No docs changes: this is a bug fix to the destination of an existing deep link (not a new user-facing feature or config), and the docs don't reference the report route paths. Happy to add a note somewhere if you'd prefer. |
|
Thanks @coderabbitai. On the This is an interim reroute. The intended end-state is fixing the report-UI redirect guard (#2283), after which Happy to do the rename if a maintainer would rather treat this as the permanent behaviour. |
|
Tip For best results, initiate chat on the files or code changes.
(=^・ω・^=) ~ noted with a nod ✏️ Learnings added
|
Fixes the broken cold-load behaviour reported in #2283.
Problem
Test alert deep links (
edr monitor --report-url ...) point at#/report/test-runs/<id>. Opening one from a Slack alert is always a cold page load (fresh tab), and on a cold load the detail route's redirect guard fires while report data is still fetching (empty array) and navigates to the parent Test Performance list — so the alert never opens the specific failing test. Pasting the same URL into an already-open report tab works, which is why it only reproduces from alerts. Affects 0.23.1 → currentmaster.Change
Reroute test alert deep links to
#/report/test-results/<id>, which does not hit the guard and cold-loads to the correct test (it also surfaces that test's run history). One-line change inreport_link.py.Caveat (maintainers' call)
This is a link-layer fix for the symptom. The underlying bug is the redirect guard in the report UI; fixing it directly (e.g. gating the redirect
useEffectonisFetching, or falling back to embedded report data during fetch) would lettest-runs/<id>keep working, and might be your preferred fix. I don't have access to the report UI source (this repo ships the compiledindex.html), so this is the fix I can offer from the public repo. Happy to adjust — e.g. also retext the "View test runs" button so its label matches the results destination — if you'd like.Verified: with this change,
edr monitorregenerates the workingtest-results/<id>link and the alert opens the specific failing test on a cold load.Summary by CodeRabbit
test-resultspath for test runs.