Skip to content

PMM-15308 Trim whitespace from dashboard titles - #5767

Open
theTibi wants to merge 1 commit into
mainfrom
PMM-15308-trim-dashboard-titles
Open

PMM-15308 Trim whitespace from dashboard titles#5767
theTibi wants to merge 1 commit into
mainfrom
PMM-15308-trim-dashboard-titles

Conversation

@theTibi

@theTibi theTibi commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Ticket number: PMM-15308

Feature build: Percona-Lab/pmm-submodules#4525

Summary

  • Bug: panel and dashboard titles carried leading/trailing whitespace — the reported "InnoDB Buffer Pool Data ", plus 38 more across 14 dashboards (e.g. Nodes_Overview.json has 8 leading-space titles like " Top Disk Latency").
  • Root cause: nothing validated titles. The Dashboards → 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.
  • Fix: trim the 39 titles, and add a trim_titles cleanuper so the existing CI gate catches regressions — the trim-on-publish the reporter asked for.

Notes for reviewers

1. The --check-only reporter needed a title: case too. It hardcodes per-field comparisons, so adding trim_titles alone would have made CI exit 1 while printing no reason. walk_titles is shared by the cleanuper and the reporter so the two cannot drift.

2. Titles were trimmed in place, not via cleanup-dash.py write mode. --check-only compares parsed objects, while write mode re-serialises with sort_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.json panels[0] is a text spacer whose title is literally " "; it becomes "". Confirmed as intended.

4. First Python tests in the repo. test_cleanup_dash.py is stdlib unittest — 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-only fails on exactly 14 dashboards before the trim, passes on all 76 after
  • All 76 dashboards still parse as JSON; 0 untrimmed titles remain
  • Diff is title-only — 0 changed dashboard lines that are not "title":
  • 18 new tests pass in a clean ubuntu:24.04 / Python 3.12.3 container (mirrors CI runner), no pip installs
  • Negative-tested: reverting the tool → 12 errors + 2 failures; reverting the dashboards → fails listing all 39 titles
  • Write-mode round-trip clean; plugin.json's 68 dashboard paths all resolve
  • Not run: live PMM server render check — change is a pure whitespace trim with no query or schema impact

Related

  • Follow-up candidate: normalise the 6 reformat-prone dashboards so cleanup-dash.py <file> is safe to run as CI suggests.

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>
@theTibi
theTibi requested review from a team and Nailya as code owners August 12, 2026 16:15
@theTibi
theTibi requested review from 4nte, matejkubinec, mattiasimonato and maxkondr and removed request for a team August 12, 2026 16:15
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.45%. Comparing base (31318c7) to head (456d8fb).
⚠️ Report is 111 commits behind head on main.

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     
Flag Coverage Δ
admin 34.93% <ø> (+0.15%) ⬆️
agent 51.41% <ø> (+2.37%) ⬆️
managed 45.23% <ø> (+2.24%) ⬆️
unittests 41.68% <ø> (?)
vmproxy 72.22% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e1c8632a-b4b0-4a48-a0a9-66bbcd28ce8e

📥 Commits

Reviewing files that changed from the base of the PR and between a807f56 and 456d8fb.

📒 Files selected for processing (18)
  • .github/workflows/dashboards.yml
  • .gitignore
  • dashboards/dashboards/Insight/Home_Dashboard.json
  • dashboards/dashboards/Kubernetes (experimental)/Databases_on_Kubernetes.json
  • dashboards/dashboards/MongoDB/MongoDB_Instances_Compare.json
  • dashboards/dashboards/MySQL/HAProxy_Instance_Summary.json
  • dashboards/dashboards/MySQL/MySQL_Group_Replication_Summary.json
  • dashboards/dashboards/MySQL/MySQL_InnoDB_Compression_Details.json
  • dashboards/dashboards/MySQL/MySQL_InnoDB_Details.json
  • dashboards/dashboards/MySQL/MySQL_User_Details.json
  • dashboards/dashboards/OS/Node_Temperature_Details.json
  • dashboards/dashboards/OS/Nodes_Overview.json
  • dashboards/dashboards/OS/Processes_Details.json
  • dashboards/dashboards/PMM Health/PMM_Health.json
  • dashboards/dashboards/PostgreSQL/PostgreSQL_Overview_Extended.json
  • dashboards/dashboards/Valkey/Valkey_PersistenceDetails.json
  • dashboards/misc/cleanup-dash.py
  • dashboards/misc/test_cleanup_dash.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • percona/pmm-qa (manual)
  • percona/pmm (manual)

Walkthrough

The 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.

Changes

Dashboard title cleanup

Layer / File(s) Summary
Title traversal and cleanup
dashboards/misc/cleanup-dash.py
The cleanup pipeline recursively trims string values in title fields and reports title changes in check-only mode.
Dashboard title normalization
dashboards/dashboards/*
Dashboard panel and row titles no longer contain leading or trailing whitespace.
Cleanup test and CI validation
dashboards/misc/test_cleanup_dash.py, .github/workflows/dashboards.yml, .gitignore
Tests cover traversal, CLI behavior, repository dashboards, JSON validity, and workflow execution. Python cache files are ignored.】【。
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the primary change: trimming whitespace from dashboard titles.
Description check ✅ Passed The description includes the required ticket and feature build, plus a detailed summary, rationale, and test plan.

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant