Repository navigation
fix(stats): restore aggregated language donut - #84
Conversation
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
🐤 Kanarek · 🟣 merged
Kanarek, Assets · 4 files |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
This pull request is merged. |
There was a problem hiding this comment.
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
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>
There was a problem hiding this comment.
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>
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Summary
top-langs.svg.trvnyandtravnie(no forks).The checked-in SVG uses the latest displayed rounded percentages. Scheduled stats refresh will regenerate using the exact GitHub language byte counts.