Skip to content

feat(fetcher): add git_churn and enforce single-shape renderers - #166

Merged
unhappychoice merged 6 commits into
mainfrom
feat/git-churn
Apr 27, 2026
Merged

unhappychoice merged 6 commits into
mainfrom
feat/git-churn

Conversation

@unhappychoice

Copy link
Copy Markdown
Owner

Summary

  • Adds git_churn fetcher — top files by change count over the last N days (default 30, override via format = \"N\"), capped at top 10. Shapes: Entries (default) / Bars / TextBlock / Text. Walks the gix rev-walk diff with the same MAX_COMMITS = 500 safety cap as git_blame_heatmap. Ticks the people-and-churn slot of feat(templates): add project_codebase preset — repo personality / analytics #164.
  • Tightens the renderer contract to single-shape per primary renderer. text_plain narrowed to Text only; list_plain is the TextBlock counterpart and now uses Paragraph so align = \"center\" centres each line individually (the project_splash subtitle's MIT-under-hero behaviour). default_renderer_for(TextBlock) now points at list_plain.
  • Migrates 6 template widgets that paired text_plain with TextBlock-emitting fetchers (random_quote in home_daily; random_fortune in home_feed; github_user in home_github; github_repo in project_github + project_splash) to list_plain. Animated post-process wrappers stay ALL_SHAPES — they delegate to an inner renderer.
  • Tightens the Text contract ("exactly one string") in three fetchers that leaked newlines: random_fortune joins multi-line cookies with ·; basic_static and read_store text-format collapse \n to spaces.
  • Documents the single-shape rule in AGENTS.md, and the full-Shape-enumeration step in the add-fetcher-renderer skill.

Reference

Fetcher git_churn

Test plan

  • `cargo test` (867 passed)
  • `cargo clippy --all-targets -- -D warnings` (clean)
  • `cargo fmt --all -- --check`
  • Local smoke test via .splashboard/dashboard.toml covering all 4 shapes (Entries / Bars / TextBlock / Text), one renderer each
  • Tick the git_churn checkbox in meta: fetcher roadmap - VCS / Forge #63 after merge

Closes part of #164.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Apr 27, 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 35 minutes and 43 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ 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: 632bbf13-2ff5-4cfe-8549-afd8820b835e

📥 Commits

Reviewing files that changed from the base of the PR and between 458928e and bc74d07.

📒 Files selected for processing (16)
  • .claude/skills/add-fetcher-renderer/SKILL.md
  • AGENTS.md
  • src/fetcher/git/churn.rs
  • src/fetcher/git/mod.rs
  • src/fetcher/random_fortune/mod.rs
  • src/fetcher/read_store.rs
  • src/fetcher/static_text.rs
  • src/render/list_plain.rs
  • src/render/mod.rs
  • src/render/text_plain.rs
  • src/runtime.rs
  • src/templates/home_daily.toml
  • src/templates/home_feed.toml
  • src/templates/home_github.toml
  • src/templates/project_github.toml
  • src/templates/project_splash.toml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/git-churn

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 force-pushed the feat/git-churn branch 2 times, most recently from 30a76df to cf9838b Compare April 27, 2026 01:33
@codecov

codecov Bot commented Apr 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.65693% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.06%. Comparing base (458928e) to head (bc74d07).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/fetcher/git/churn.rs 78.13% 47 Missing ⚠️
src/fetcher/random_fortune/mod.rs 88.23% 2 Missing ⚠️
src/fetcher/read_store.rs 0.00% 1 Missing ⚠️
src/fetcher/static_text.rs 66.66% 1 Missing ⚠️
src/render/list_plain.rs 96.77% 1 Missing ⚠️
src/render/text_plain.rs 75.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #166      +/-   ##
==========================================
- Coverage   78.06%   78.06%   -0.01%     
==========================================
  Files         123      124       +1     
  Lines       23578    23783     +205     
==========================================
+ Hits        18407    18567     +160     
- Misses       5171     5216      +45     
Files with missing lines Coverage Δ
src/fetcher/git/mod.rs 86.53% <100.00%> (+0.26%) ⬆️
src/render/mod.rs 90.59% <100.00%> (ø)
src/runtime.rs 80.28% <100.00%> (ø)
src/fetcher/read_store.rs 70.61% <0.00%> (ø)
src/fetcher/static_text.rs 84.61% <66.66%> (ø)
src/render/list_plain.rs 88.59% <96.77%> (+1.09%) ⬆️
src/render/text_plain.rs 87.34% <75.00%> (-2.38%) ⬇️
src/fetcher/random_fortune/mod.rs 92.30% <88.23%> (+0.12%) ⬆️
src/fetcher/git/churn.rs 78.13% <78.13%> (ø)

... and 1 file with indirect coverage changes

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

unhappychoice and others added 6 commits April 27, 2026 10:36
Caches up to MAX_COMMITS=500 of HEAD's diff-walk and ranks files by
modification count, capped at top 10. Default 30-day window via
`format = "N"`. Shapes: Entries (default) / Bars / TextBlock / Text.
Mirrors `git_blame_heatmap`'s diff iteration but flattens the per-week
grid to plain totals — pairs with `code_largest_files` for the
"where's the action vs where's the mass" framing called out in #164.

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

`Text` is "exactly one string" per AGENTS.md. Three fetchers were leaking
newlines through:

- `random_fortune` — multi-line cookies (haikus, short verses) preserved
  verbatim; now joined with ` · ` for Text, still split for TextBlock.
- `basic_static` — user-provided `format = "..."` with embedded `\n`
  passed through; now collapsed to spaces for Text.
- `read_store` (text format) — file content pushed through verbatim;
  now collapsed to spaces for Text.

`TextBlock` paths are unchanged and remain the right shape for multi-line
output.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`Paragraph` honours `align = "center"` per line — short rows like a 3-char
license sit under their block's centreline instead of hugging the longest
line's left edge (the project_splash subtitle pattern). Adds
`natural_height` so `height = "auto"` rows size to the entry count, and
keeps the bullet / max_items semantics intact. No call-site changes; this
is an internal swap that preserves `accepts() = [TextBlock]`.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Six widgets paired `text_plain` with fetchers whose primary shape is
TextBlock (random_quote in home_daily, random_fortune in home_feed,
github_user in home_github, github_repo in project_github + project_splash).
Switching to `list_plain` aligns each widget with the single-shape-per-
renderer rule that lands next; per-line center alignment is preserved by
the Paragraph-backed list_plain.

`home_minimal::quote` already pins `shape = "text"` on random_quote and
stays on text_plain — the single-line case is intentional there.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Each primary renderer should accept exactly one shape — overlapping
acceptance forces shape negotiation at the runtime boundary, which
previously made `text_plain` ambiguously render either a Text one-liner or
a TextBlock paragraph depending on fetcher shape order. Now `text_plain`
is `accepts() = [Text]` only, and `default_renderer_for(TextBlock)` points
at `list_plain` (its sibling). The runtime negotiation test is reframed
around the single-accept invariant.

All template usages of `text_plain` were migrated in the previous commit,
so no in-tree widget breaks. Animated post-process wrappers stay
`ALL_SHAPES` because they delegate to an inner renderer rather than
drawing payload data themselves.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
AGENTS.md elevates "primary renderer = single shape" from soft guidance
("usually one") to a contract, with the `text_plain` / `list_plain` pair
as the canonical sibling pattern and animated post-process wrappers as
the only ALL_SHAPES exception.

The `add-fetcher-renderer` skill mirrors the rule and adds an explicit
Phase 1 step: enumerate every Shape variant and accept-or-reject each one
(the bar is "can the data be meaningfully expressed in this form?", not
"is this the most natural form?"). Caught in the git_churn spec round
where TextBlock was almost dropped on the strength of a catalog blurb
that only mentioned Entries.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@unhappychoice
unhappychoice merged commit a7f0445 into main Apr 27, 2026
7 checks passed
@unhappychoice
unhappychoice deleted the feat/git-churn branch April 27, 2026 01:41
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