PMM-15308 Trim whitespace from dashboard titles - #5767
Conversation
Panel and dashboard titles carried leading or trailing whitespace in 14 dashboards (39 titles), including the reported "InnoDB Buffer Pool Data " in MySQL_InnoDB_Details. Nothing validated titles: the dashboards.yml check job already runs cleanup-dash.py --check-only, but its CLEANUPERS list only normalised editable/time/timezone/refresh/id, so untrimmed titles always passed. Add a trim_titles cleanuper and report title differences in --check-only so that gate catches regressions. The reporter hardcodes per-field comparisons, so without the new title case CI would exit 1 without printing a reason. Titles are trimmed in place rather than by running cleanup-dash.py in write mode, which re-serialises with sort_keys/indent=4 and would reformat 6 unrelated dashboards wholesale. Also add stdlib unittest coverage for the script and wire it into the check job. Signed-off-by: theTibi <tkorocz@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5767 +/- ##
==========================================
+ Coverage 43.59% 45.45% +1.86%
==========================================
Files 415 548 +133
Lines 43134 45768 +2634
Branches 0 591 +591
==========================================
+ Hits 18804 20804 +2000
- Misses 22454 22919 +465
- Partials 1876 2045 +169
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:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (18)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
WalkthroughThe cleanup script now trims nested dashboard titles and reports title changes. Dashboard JSON titles were normalized. Unit, CLI, repository, and workflow checks validate the cleanup behavior. ChangesDashboard title cleanup
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
Ticket number: PMM-15308
Feature build: Percona-Lab/pmm-submodules#4525
Summary
"InnoDB Buffer Pool Data ", plus 38 more across 14 dashboards (e.g.Nodes_Overview.jsonhas 8 leading-space titles like" Top Disk Latency").Dashboards → Checkjob already runscleanup-dash.py --check-only, but itsCLEANUPERSlist only normalisededitable/time/timezone/refresh/id, so untrimmed titles always passed.trim_titlescleanuper so the existing CI gate catches regressions — the trim-on-publish the reporter asked for.Notes for reviewers
1. The
--check-onlyreporter needed atitle:case too. It hardcodes per-field comparisons, so addingtrim_titlesalone would have made CI exit 1 while printing no reason.walk_titlesis shared by the cleanuper and the reporter so the two cannot drift.2. Titles were trimmed in place, not via
cleanup-dash.pywrite mode.--check-onlycompares parsed objects, while write mode re-serialises withsort_keys/indent=4. Running it over the tree would reformat 6 unrelated dashboards wholesale (~26k lines of indentation churn):MongoDB_Cluster_Summary,MongoDB_Collections_Overview,MongoDB_ReplSet_Summary,PMM_Health,PostgreSQL_Instance_Summary,PostgreSQL_Top_Queries. That drift is pre-existing and left alone here — worth its own ticket, since the CI error message points devs at exactly that command.3. One behaviour-visible change.
MySQL_User_Details.jsonpanels[0]is atextspacer whose title is literally" "; it becomes"". Confirmed as intended.4. First Python tests in the repo.
test_cleanup_dash.pyis stdlibunittest— no new dependency. Happy to drop it and the CI step if you'd rather not set the precedent.Test plan
cleanup-dash.py --check-onlyfails on exactly 14 dashboards before the trim, passes on all 76 after"title":ubuntu:24.04/ Python 3.12.3 container (mirrors CI runner), no pip installsplugin.json's 68 dashboard paths all resolveRelated
cleanup-dash.py <file>is safe to run as CI suggests.