Skip to content

fix(stats): restore aggregated language donut - #84

Merged
trvny merged 5 commits into
mainfrom
fix/restore-language-donut-20261113
Nov 13, 2026
Merged

trvny merged 5 commits into
mainfrom
fix/restore-language-donut-20261113

Conversation

@trvny

@trvny trvny commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Restore the original gradient donut layout for top-langs.svg.
  • Preserve cross-repository language aggregation across trvny and travnie (no forks).
  • Add renderer regression tests and run them from the existing stats workflow.

The checked-in SVG uses the latest displayed rounded percentages. Scheduled stats refresh will regenerate using the exact GitHub language byte counts.

View guided diff Turn on auto-fix

Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
@kanarek-companion

kanarek-companion Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🐤 Kanarek · 🟣 merged

main ✅

It landed in main. Kanarek closes the notebook.

Kanarek, Assets · 4 files

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-13T19:20:21.959000Z
We couldn’t complete this review. Comment @codex review to try again.
b1159df PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c97873e3-7130-4591-96e4-404b264791a4
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@mergify

mergify Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@kanarek-companion kanarek-companion 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.

🐤 Kanarek 代码审查 · DeepSeek DeepSeek · deepseek-flash

检查后发现:静态语言卡 SVG 中 "Other" 出现两次,且 MDX 行被误标为第二个 Other,与生成器输出不一致。

Comment thread assets/profile/top-langs.svg Resolved

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 4 files

View guided diff | Turn on auto-fix | Re-trigger cubic

@sourcery-ai sourcery-ai 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.

Hey - I've found 3 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/scripts/generate-contributors.cjs" line_range="530" />
<code_context>
+    const length = (bytes / total) * circumference;
+    const dashOffset = offset;
+    offset += length;
+    return `<circle class="donut-segment" cx="${cx}" cy="${cy}" r="${radius}" fill="none" stroke="${colorFor(name)}" stroke-width="16" stroke-dasharray="${length.toFixed(4)} ${circumference.toFixed(4)}" stroke-dashoffset="${(-dashOffset).toFixed(4)}" transform="rotate(-90 ${cx} ${cy})"><title>${escapeXml(name)} ${(bytes / total * 100).toFixed(1)}%</title></circle>`;
   }).join("\n");
-  const empty=total?"":`<text class="subtitle" x="22" y="103">No language bytes reported by GitHub.</text>`;
</code_context>
<issue_to_address>
**Donut slices show incorrect proportions**

When the chart contains multiple language segments, `stroke-dasharray` uses a gap equal to the full circumference, so each segment's dash pattern has a different period from the circle. The cumulative offsets therefore do not place full, adjacent arcs at their intended percentages, and the displayed donut is inaccurate.

Set the gap to `circumference - length` so each dash pattern spans one circumference and cumulative offsets align the slices.
</issue_to_address>

### Comment 2
<location path=".github/scripts/generate-contributors.cjs" line_range="513" />
<code_context>
+  const total = sorted.reduce((sum, [, bytes]) => sum + bytes, 0);
+  const top = sorted.slice(0, 10);
+  const other = sorted.slice(10).reduce((sum, [, bytes]) => sum + bytes, 0);
+  if (other > 0) top.push(["Other", other]);
+
+  const colorFor = (name) => {
</code_context>
<issue_to_address>
**Language buckets look identical**

When the top ten include a language named `Other` and additional languages fall outside the top ten, `top` appends the remainder as another `Other`, and `colorFor` assigns both buckets the same color, so readers cannot distinguish the real language from the aggregate in the legend or donut.

Give the real `Other` language and the aggregated remainder distinct labels before adding the remainder to `top`.
</issue_to_address>

### Comment 3
<location path=".github/scripts/generate-contributors.test.cjs" line_range="8" />
<code_context>
+
+test("language card keeps a real donut and aggregated percentages", () => {
+  const svg = buildLanguageSvg([["Kotlin", 50], ["TypeScript", 30], ["Python", 20]]);
+  assert.equal((svg.match(/class="donut-segment"/g) || []).length, 3);
+  assert.match(svg, /Kotlin 50\.0%/);
+  assert.match(svg, /TypeScript 30\.0%/);
</code_context>
<issue_to_address>
**Broken donut arcs go undetected**

When the renderer emits zero-length or incorrect arc dash geometry while leaving the legend unchanged, when the renderer emits zero-length or otherwise incorrect arc dash geometry but keeps the legend unchanged, `language card keeps a real donut and aggregated percentages` line 8 and `other groups languages beyond the top ten` line 21 only count circle elements. Their percentage assertions check legend text, so both tests pass with an invisible or mis-proportioned donut.

Assert the segment dash geometry against the expected proportions, including the aggregated Other arc.

Also at `.github/scripts/generate-contributors.test.cjs:22`.
</issue_to_address>

Sourcery assessment

Approval pending. 3 findings to address first.

Blocking findings: .github/scripts/generate-contributors.cjs:530, .github/scripts/generate-contributors.cjs:513, .github/scripts/generate-contributors.test.cjs:8


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

gptomek Bot and others added 2 commits November 13, 2026 19:23
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>

@sourcery-ai sourcery-ai 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.

Sourcery assessment

Approved.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 3 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>

@kanarek-companion kanarek-companion 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.

🐤 Kanarek 代码审查 · DeepSeek DeepSeek · deepseek-flash

新增的渲染器回归测试仅在 main 分支执行,PR 阶段完全不会运行,因此无法拦截本次改动引入的回归。

Comment thread .github/workflows/stats.yml Resolved
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
@trvny
trvny merged commit 0d23bc2 into main Nov 13, 2026
9 checks passed
@trvny
trvny deleted the fix/restore-language-donut-20261113 branch November 13, 2026 19:40
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