Skip to content

feat(brainbar): add sparkline hover tooltips#334

Merged
EtanHey merged 2 commits into
mainfrom
feat/brainbar-dashboard-truth-E
May 26, 2026
Merged

feat(brainbar): add sparkline hover tooltips#334
EtanHey merged 2 commits into
mainfrom
feat/brainbar-dashboard-truth-E

Conversation

@EtanHey
Copy link
Copy Markdown
Owner

@EtanHey EtanHey commented May 26, 2026

Summary

  • Add Swift Charts hover overlay for BrainBar sparklines using chartOverlay and ChartProxy.
  • Show floating tooltip text with exact bucket label and count.
  • Carry dashboard activity window metadata into flow-lane sparklines so labels match the live dashboard window.

Mandate / Evidence

  • Implements Item E from /tmp/codex-mandate-brainbar-dashboard-truth.md.
  • Related research: Brain Drive/BrainBar Design Audit - April 2026/R1-brainbar-ux-research.md and BrainBar UX Dashboard Research doc id 1vEBaiP51EuK23kM0f1ak0edFj3CrDp23bH4razLD1ew.
  • This completes the dashboard truth work after Items A-D: exact chart buckets reduce ambiguity in the live dashboard during the Wed demo.

Test Plan

  • Red/green: swift test --package-path brain-bar --filter DashboardTests/testSparklineChartPresentationCarriesBucketsAndVoiceOverMetadata
  • swift test --package-path brain-bar --filter DashboardTests
  • swift test --package-path brain-bar
  • git diff --check
  • cr review --plain
  • pre-push scripts/run_tests.sh gate: passed

Note

Low Risk
Dashboard sparkline labeling and tooltip presentation only; no data pipeline or persistence changes.

Overview
Refines sparkline hover tooltips so bucket time ranges match how the dashboard divides the activity window across buckets, including uneven splits (e.g. 31 minutes into 12 buckets).

SparklineChartPresentation now computes bucket boundaries in seconds (window × 60 ÷ bucket count) instead of rounding to whole minutes per bucket. Labels use a new durationLabel(seconds:) helper so ranges can show minutes only, seconds only, or mixed values (e.g. 31m-28m 25s ago, last 2m 35s). tooltipText(forBucket:) takes a bucket index and reads the count from values rather than a chart point struct.

SparklineChart hover state tracks a bucket index (hoveredBucket) end-to-end; nearestBucket returns that index for the tooltip overlay.

Tests update expectations for the new label format and add testSparklineChartPresentationLabelsPartialMinuteBucketsLikeDatabase for the partial-minute case.

Reviewed by Cursor Bugbot for commit 63afc1a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add hover tooltips to BrainBar sparkline charts

  • Adds interactive hover tooltips to SparklineChart (non-compact mode) showing the time range and value for the bucket nearest the pointer, tracked via a chart overlay.
  • Extends SparklineChartPresentation with activityWindowMinutes, bucketLabel(for:), and tooltipText(forBucket:) to compute human-readable time-range labels per bucket.
  • Threads activityWindowMinutes from DashboardFlowLane through BrainBarHeroSparkline and StatusPopoverView so tooltips reflect the actual configured activity window.
  • Adds tests for bucket label and tooltip text behavior, including a partial-minute case for a 31-minute window over 12 buckets.

Macroscope summarized 63afc1a.

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@EtanHey
Copy link
Copy Markdown
Owner Author

EtanHey commented May 26, 2026

@codex review

@EtanHey
Copy link
Copy Markdown
Owner Author

EtanHey commented May 26, 2026

@macroscope-app review

@EtanHey
Copy link
Copy Markdown
Owner Author

EtanHey commented May 26, 2026

@coderabbitai review

@EtanHey
Copy link
Copy Markdown
Owner Author

EtanHey commented May 26, 2026

@cursor @BugBot review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Warning

Review limit reached

@EtanHey, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 13 minutes and 55 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 415ab040-8cea-48cc-b735-f33451da9048

📥 Commits

Reviewing files that changed from the base of the PR and between 5955479 and 63afc1a.

📒 Files selected for processing (5)
  • brain-bar/Sources/BrainBar/BrainBarWindowRootView.swift
  • brain-bar/Sources/BrainBar/Dashboard/PipelineState.swift
  • brain-bar/Sources/BrainBar/Dashboard/SparklineRenderer.swift
  • brain-bar/Sources/BrainBar/Dashboard/StatusPopoverView.swift
  • brain-bar/Tests/BrainBarTests/DashboardTests.swift
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/brainbar-dashboard-truth-E

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.

❤️ Share

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

@cursor
Copy link
Copy Markdown

cursor Bot commented May 26, 2026

You need to increase your spend limit or enable usage-based billing to run background agents. Go to Cursor

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

✅ Actions performed

Review triggered.

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.

@macroscopeapp
Copy link
Copy Markdown

macroscopeapp Bot commented May 26, 2026

Review in progress. Results will be posted as check runs when complete.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 092c866. Configure here.

Comment thread brain-bar/Sources/BrainBar/Dashboard/SparklineRenderer.swift Outdated
Comment thread brain-bar/Sources/BrainBar/Dashboard/SparklineRenderer.swift Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 092c866c08

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +52 to +54
let bucketWidth = max(1, Int(ceil(Double(activityWindowMinutes) / Double(values.count))))
let newerMinutesAgo = max(values.count - 1 - clampedBucket, 0) * bucketWidth
let olderMinutesAgo = min(newerMinutesAgo + bucketWidth, activityWindowMinutes)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Derive tooltip ranges from true bucket width

Use of ceil(activityWindowMinutes / values.count) can generate impossible time ranges for older buckets, so tooltip labels no longer match the buckets being charted. With the default dashboard settings (activityWindowMinutes = 30, values.count = 12), bucketWidth becomes 3, which yields labels like 30-33m ago for bucket 0 even though the window is only 30 minutes. This is user-visible and contradicts the actual bucketing logic in BrainDatabase (which uses fractional bucket widths via Double(activityWindowMinutes * 60) / Double(bucketCount)), so the hover tooltip can report incorrect intervals on normal production data.

Useful? React with 👍 / 👎.

@macroscopeapp
Copy link
Copy Markdown

macroscopeapp Bot commented May 26, 2026

Approvability

Verdict: Would Approve

Self-contained UI feature adding hover tooltips to sparkline charts. All files are owned by the PR author, includes unit tests, and the unresolved review comment references code that doesn't match the actual implementation (which correctly uses fractional bucket widths).

Macroscope would have approved this PR. Enable approvability here.

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@EtanHey
Copy link
Copy Markdown
Owner Author

EtanHey commented May 26, 2026

@cursor @BugBot re-review

@EtanHey
Copy link
Copy Markdown
Owner Author

EtanHey commented May 26, 2026

@macroscope-app review

@EtanHey
Copy link
Copy Markdown
Owner Author

EtanHey commented May 26, 2026

@codex review

@EtanHey
Copy link
Copy Markdown
Owner Author

EtanHey commented May 26, 2026

@coderabbitai review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 26, 2026

You need to increase your spend limit or enable usage-based billing to run background agents. Go to Cursor

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

✅ Actions performed

Review triggered.

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.

@macroscopeapp
Copy link
Copy Markdown

macroscopeapp Bot commented May 26, 2026

Review in progress. Results will be posted as check runs when complete.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@EtanHey EtanHey merged commit 9437fe7 into main May 26, 2026
8 checks passed
@EtanHey EtanHey deleted the feat/brainbar-dashboard-truth-E branch May 26, 2026 17:32
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