Skip to content

feat(editor): grid-health pill in the transport LCD — Map Health at a glance, click to fix - #268

Merged
byrongamatos merged 4 commits into
mainfrom
feat/editor-maphealth-pill
Jul 14, 2026
Merged

byrongamatos merged 4 commits into
mainfrom
feat/editor-maphealth-pill

Conversation

@ChrisBeWithYou

@ChrisBeWithYou ChrisBeWithYou commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What

The Map Health polish pack's first half, built to Christian's calls ("percent + color, click to fix", "toggleable from the menu bar"):

  • While Tempo/Grid ▸ Map Health is on, the transport LCD gains a Grid cell showing the percent of the song's judgeable bars that agree with the recording, coloured by the worst state present (green / amber / red). One switch controls the whole lens — ruler wash + pill; toggling it off tucks the cell away entirely. The transport's Customize row can additionally hide the cell on its own.
  • Grey bars never count for or against the score (the wash's no-crying-wolf rule: silence and sustains aren't evidence), and a song with nothing judgeable shows a neutral dash — never a fake 100%.
  • Clicking the percent jumps to the worst drifting bar with the fix armed — any red outranks any amber, biggest drift wins — via _mapHealthGotoMeasure, factored out of the wash click-through so both surfaces share one motion (and the pill works even when the strip is scrolled out of view). Nothing drifting? The click says so instead of jumping.
  • Perf: _mapHealthResults() is already memoized on editGen + the onset cache, so a visible pill costs a map lookup per LCD tick; the O(bars × beats) scan only reruns after an actual edit.

Tests

tests/map_health_pill.test.mjs (4, fail on main): judgeable-only percent (grey neither dilutes nor inflates), worst-band colouring, the no-verdict dash, and the worst-bar ranking (red > amber, drift tiebreak, null when clean). count_lcd.test.mjs's cell-order pin deliberately updated for the new cell (the prefs helper already keeps cells added after a saved pref visible by default — pinned there). Full suite 147 green, lint 0 errors, routes.py untouched.

Live-verified

Real project: lens off → cell hidden; lens on → "29%" in red (this pak's grid genuinely disagrees — it's the drift-diagnosis project); click → "Bar 39 drifts 39% from the recording — Tempo Map opened; press G to fit the barlines from here" with the anchor set on that bar. Zero page errors.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EBQCHCNA81E9tHmSDHSe2Q

Summary by CodeRabbit

  • New Features

    • Added a Grid health readout to the transport display when Map Health is enabled.
    • Shows the percentage of aligned, judgeable bars with green, amber, or red status indicators.
    • Clicking the readout navigates to the worst drifting bar and prepares the recommended fix.
    • The readout can be hidden independently through the transport’s Customize menu.
  • Bug Fixes

    • Silent and sustained bars are excluded from Grid health calculations.
    • Displays a neutral dash when no bars can be evaluated.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@byrongamatos, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 35b7510c-0e05-46cb-a5c9-747554fa8c7d

📥 Commits

Reviewing files that changed from the base of the PR and between 7d1090e and f333833.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • src/map-health.js
  • src/ruler.js
  • src/transport-bar.js
  • tests/count_lcd.test.mjs
  • tests/map_health_pill.test.mjs
📝 Walkthrough

Walkthrough

Adds a configurable Grid health LCD cell that summarizes judgeable Map Health bars, hides when Map Health is disabled, and navigates to the worst drifting bar. Shared navigation logic and pure selector tests support the feature.

Changes

Grid health transport integration

Layer / File(s) Summary
Map Health selectors and validation
src/map-health.js, tests/map_health_pill.test.mjs
Pure helpers calculate judgeable-bar agreement, worst-state coloring, and worst-bar selection; tests cover empty, mixed, and drifting results.
Shared Map Health navigation
src/ruler.js
Click-through navigation is extracted into _mapHealthGotoMeasure, which arms Tempo Map fitting, seeks to the measure, and updates status text.
Grid health LCD wiring
src/transport-bar.js, tests/count_lcd.test.mjs, CHANGELOG.md
The transport adds and updates the configurable Grid health cell, handles navigation and disabled states, updates LCD ordering tests, and documents the behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant TransportBar
  participant MapHealth
  participant Ruler
  participant Editor
  TransportBar->>MapHealth: Calculate Grid health pill
  TransportBar->>MapHealth: Select worst drifting measure
  TransportBar->>Ruler: Request measure navigation
  Ruler->>Editor: Arm fitting and seek to measure
  Editor-->>TransportBar: Refresh status and transport display
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: a Grid-health pill in the transport LCD with click-to-fix behavior under Map Health.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/editor-maphealth-pill

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

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

Inline comments:
In `@src/transport-bar.js`:
- Around line 473-482: Update the editor-lcd-grid handler around
_mapHealthWorstPure and _mapHealthResults to distinguish a neutral no-verdict
result from all judgeable bars agreeing. When every measure is grey, show a
no-verdict status message; reserve the existing “every judgeable bar agrees”
message for the case where judgeable measures exist and none need fixing, while
preserving navigation to _mapHealthGotoMeasure for a returned worst measure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b9004d87-1ad0-4503-a842-22276906a417

📥 Commits

Reviewing files that changed from the base of the PR and between c85b7de and 7d1090e.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • src/map-health.js
  • src/ruler.js
  • src/transport-bar.js
  • tests/count_lcd.test.mjs
  • tests/map_health_pill.test.mjs

Comment thread src/transport-bar.js
@byrongamatos
byrongamatos force-pushed the feat/editor-maphealth-pill branch from 7d1090e to 43a111e Compare July 14, 2026 18:02
@byrongamatos

Copy link
Copy Markdown
Collaborator

Applied in 64c6c83 — good catch: _mapHealthWorstPure() returns null for two different reasons (nothing drifting vs nothing judgeable), and the click's status line conflated them while the pill itself already showed a dash. Split on the pill verdict.

Also fixed in 43a111e (my own review, not yours): the pill's colour write guarded on gridEl.style.color !== color, which never matches — the DOM normalizes an assigned #ef4444 back to rgb(239, 68, 68), so the skip-if-unchanged guard was always true and re-wrote the inline style on every transport tick. Now guarded on the band string.

@byrongamatos

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@byrongamatos

Copy link
Copy Markdown
Collaborator

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 30 minutes.

ChrisBeWithYou and others added 4 commits July 14, 2026 21:06
Map Health polish: while the Tempo/Grid Map Health toggle is on, a new
Grid LCD cell shows the percent of judgeable bars agreeing with the
recording (grey never counts either way; no verdict = dash, never a
fake 100%), coloured by the worst band present. Clicking it jumps to
the worst drifting bar with the fix armed via the factored
_mapHealthGotoMeasure (shared with the wash click-through). Cell hides
with the lens off; Customize row can hide it independently.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EBQCHCNA81E9tHmSDHSe2Q
`gridEl.style.color !== color` never matched: the DOM normalizes an assigned
'#ef4444' back to 'rgb(239, 68, 68)', so the skip-if-unchanged guard was always
true and the inline style got re-written on every transport tick — the exact
per-frame churn the _set() guards elsewhere in the tick exist to avoid. Compare
the band string instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
_mapHealthWorstPure() returns null for two different reasons — nothing is
drifting, or nothing is judgeable at all. The pill already tells them apart (a
dash, never a fake 100%); the click's status line did not, and told a
nothing-to-judge song that every bar agrees with the recording. Split the two
on the pill verdict. (CodeRabbit)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
An agent worktree symlinked node_modules; .gitignore only lists
node_modules/ (trailing slash), which matches a directory but not a
symlink, so git add -A tracked it. The symlink pointed at a local
absolute path and would break any other checkout.
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.

2 participants