Skip to content

fix(render): draw tail window when sparkline data exceeds area width - #84

Merged
unhappychoice merged 5 commits into
mainfrom
fix/sparkline-tail-window
Apr 22, 2026
Merged

unhappychoice merged 5 commits into
mainfrom
fix/sparkline-tail-window

Conversation

@unhappychoice

@unhappychoice unhappychoice commented Apr 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #83.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test (all 346 tests pass, including new tail_window_is_rendered_when_data_exceeds_width)
  • Manually cargo run in this repo — sparkline inputs now visibly render; dogfood splash renders in the new layout

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Redesigned dashboard layout with animated hero banner and centered subtitle
    • Streamlined GitHub activity section featuring recent commits, CI status, open PRs/issues, and releases
  • Bug Fixes

    • Sparkline charts now correctly display the most recent data within the available space

unhappychoice and others added 2 commits April 23, 2026 03:31
ratatui's Sparkline widget renders `data.iter().take(min(area.width, data.len()))`,
i.e. the head of the series. Fetchers like `git_commits_activity` that emit a
long time-anchored series (364 daily values) paired with a narrow widget would
silently drop everything after the leading cells — for sparse "recent activity"
data (this repo's commits land in the last few days out of a year) that reads
as an empty widget.

Slice the tail to `area.width` before handing off so the most-recent cells are
what actually get drawn. Regression test pins the behaviour.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Previous dogfood was a "one of every fetcher" showcase (~500 lines). When
someone cd's into this repo the per-dir splash should instead match the
project_github_activity preset we plan to ship (#77): hero (animated_postfx
hsl_shift over text_ascii quadrant) → subtitle → section dividers → body
(recent commits / CI / open PRs & issues / releases).

Rough edges explicitly traded for now — follow-up lands post #79 / #81:
  - hero uses `static "splashboard"` (will become `project_name` fetcher)
  - subtitle is hand-written (will become `project` Entries fetcher)
  - hero uses text_ascii blocks quadrant (will pick up figlet banner font)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@unhappychoice has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 25 minutes and 14 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 25 minutes and 14 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ccc7809f-14b4-46cd-baca-644a57d6ff4f

📥 Commits

Reviewing files that changed from the base of the PR and between c7b5cf7 and fbf9324.

📒 Files selected for processing (2)
  • .splashboard/config.toml
  • src/render/chart_sparkline.rs
📝 Walkthrough

Walkthrough

This pull request restructures the dogfood showcase configuration, replacing numerous widget types with a focused "project_github_activity" layout featuring hero/subtitle/divider/body sections. Additionally, it fixes a sparkline rendering bug where data beyond widget width was not displayed correctly.

Changes

Cohort / File(s) Summary
Configuration Redesign
.splashboard/config.toml
Complete widget set replacement: removed ~25 widget ids (greeting_text, clock, multiple postfx variants, GitHub metrics, system gauges, scratch, etc.) and introduced 10 new ids (hero, subtitle, five divider widgets, recent_commits, ci_status, repo_prs, repo_issues, releases). Layout restructured with updated row heights and background styling.
Sparkline Rendering Fix
src/render/chart_sparkline.rs
Changed render_sparkline to slice data to the tail window matching widget width instead of taking leading elements. Added regression test verifying that when data exceeds render width, the rightmost (most recent) values are displayed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 The splashboard hops to a fresher beat,
Old widgets fade, new ones greet,
Sparklines shimmer with recent data bright,
The hero shines—no more blank in sight! ✨

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The config.toml reshaping into project_github_activity layout is out of scope relative to the linked issue #83, which only concerns the sparkline rendering bug fix and regression test. Move the config.toml layout restructuring to a separate pull request focused on dogfood config updates, or clarify in the issue if it is intended as part of this fix.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main fix in the changeset: addressing a sparkline rendering bug where the tail (most recent data points) should be drawn instead of the head when data exceeds available width.
Linked Issues check ✅ Passed The pull request successfully addresses all coding requirements from issue #83: fixes the sparkline tail-window rendering logic in chart_sparkline.rs, adds the required regression test, and updates the config to demonstrate the fix.
Description check ✅ Passed The PR objectives provide comprehensive context linking the bug (sparse sparkline output), root cause (head vs tail slicing), fix implementation, and test coverage, fully supporting the described changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sparkline-tail-window

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.

@unhappychoice unhappychoice mentioned this pull request Apr 22, 2026
9 tasks done
unhappychoice and others added 3 commits April 23, 2026 03:57
…stay legible

ratatui's `Sparkline` renders a 0-value column as an empty cell. A sparse
series like `git_commits_activity` (hundreds of days with zero activity,
spikes at the tail) ends up reading as "mostly no data" instead of "mostly
no commits" — the gap between a zero day and a padding cell is gone.

Post-draw, paint `▁` styled with `text_dim` on the bottom row at every zero
column in the visible window. Every datum now leaves a tick, so spikes are
clearly "peaks above a baseline" rather than "lone bars in a void".

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
… from small bars

The prior baseline glyph was `▁`, which is also ratatui's smallest non-empty
bar glyph — the one a tiny value like 1 out of max=74 naturally lands on. A
day with "no commits" ended up visually identical to a day with "a handful
of commits", defeating the point of the baseline.

Swap to the middle-dot `·` so zero columns read as axis ticks rather than
tiny bars. Test updated to pin the new glyph.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…s, baseline-friendly sparkline rows

- Swap hero effect from `hsl_shift` to `coalesce` and extend duration to
  2500ms; wrap subtitle in `sweep_in_down` for a follow-through reveal.
- Restore the commits / CI-history sparkline row so the baseline-tick fix
  from this branch has a dogfood showcase.
- Set explicit `length` widths on every row.child with `flex = "center"`:
  70 for body / divider, 35 × 2 for paired columns, 30 for the CI badge.
  Percentages stretched past the divider dash counts; fixed length keeps
  everything aligned until #79 lands row-level `border = "top"`.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@unhappychoice
unhappychoice merged commit e4f632c into main Apr 22, 2026
5 checks passed
@unhappychoice
unhappychoice deleted the fix/sparkline-tail-window branch April 22, 2026 19:10
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.

bug(render): chart_sparkline + git_commits_activity produces sparse/uninformative output

1 participant