feat: collect issues, reviews and opened-PR contribution stats#232
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Aggregates issues + all-state PRs into per-contributor counters (reviews = distinct PRs reviewed with self-review excluded, issuesOpened, pullRequestsOpened), enriches contributors_prs.json, and writes the three ranking files. Reviews count on every PR regardless of (possibly null) author; only PR/issue author counts skip null authors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3 tasks
Progi1984
reviewed
Jun 29, 2026
| ]; | ||
| } | ||
|
|
||
| file_put_contents(self::FILE_ISSUES, json_encode($issues, JSON_PRETTY_PRINT)); |
Member
There was a problem hiding this comment.
you can write the file after the while
Contributor
Author
There was a problem hiding this comment.
Done in 8901525 — the file is now written once after the pagination loop.
Progi1984
reviewed
Jun 29, 2026
| ]; | ||
| } | ||
|
|
||
| file_put_contents(self::FILE_PULLREQUESTS_ALL, json_encode($pullRequests, JSON_PRETTY_PRINT)); |
Contributor
Author
There was a problem hiding this comment.
Done in 8901525 — same here, written after the loop.
Progi1984
reviewed
Jun 29, 2026
Comment on lines
+34
to
+39
| $requiredFiles = [ | ||
| self::FILE_PULLREQUESTS_ALL => 'traces:fetch:pullrequests:all', | ||
| self::FILE_ISSUES => 'traces:fetch:issues', | ||
| self::FILE_CONTRIBUTORS_PRS => 'traces:generate:topcompanies', | ||
| ]; | ||
| foreach ($requiredFiles as $required => $command) { |
Member
There was a problem hiding this comment.
Suggested change
| $requiredFiles = [ | |
| self::FILE_PULLREQUESTS_ALL => 'traces:fetch:pullrequests:all', | |
| self::FILE_ISSUES => 'traces:fetch:issues', | |
| self::FILE_CONTRIBUTORS_PRS => 'traces:generate:topcompanies', | |
| ]; | |
| foreach ($requiredFiles as $required => $command) { | |
| foreach ([ | |
| self::FILE_PULLREQUESTS_ALL => 'traces:fetch:pullrequests:all', | |
| self::FILE_ISSUES => 'traces:fetch:issues', | |
| self::FILE_CONTRIBUTORS_PRS => 'traces:generate:topcompanies', | |
| ] as $required => $command) { |
Contributor
Author
There was a problem hiding this comment.
Done in 8901525 — inlined the map directly in the foreach.
Progi1984
reviewed
Jun 29, 2026
| /** @var array<string, mixed> $contributors */ | ||
| $contributors = json_decode(file_get_contents(self::FILE_CONTRIBUTORS_PRS) ?: '', true); | ||
|
|
||
| $aggregate = self::aggregate($pullRequests, $issues); |
Member
There was a problem hiding this comment.
Doesn't need to have a static function
Contributor
Author
There was a problem hiding this comment.
Done in 8901525 — aggregate() is now a plain (non-static) method.
Progi1984
reviewed
Jun 29, 2026
Comment on lines
+26
to
+28
|
|
||
| # Superpowers workflow docs (kept local only) | ||
| docs/superpowers/ |
Member
There was a problem hiding this comment.
Suggested change
| # Superpowers workflow docs (kept local only) | |
| docs/superpowers/ |
- fetch:issues / fetch:pullrequests:all: write the output file once after the pagination loop instead of on every page - generate:topstats: inline the required-files map in the foreach - generate:topstats: aggregate() is a plain (non-static) method - drop the docs/superpowers gitignore entry Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Progi1984
approved these changes
Jun 29, 2026
Progi1984
pushed a commit
to PrestaShop/TopContributors
that referenced
this pull request
Jun 30, 2026
Add three new "Top" leaderboards (reviewers, issue reporters, PR authors) alongside the existing contributors/companies sections, driven by a shared ranking data contract. - types: RankingEntry / Ranking + reviews / issuesOpened / pullRequestsOpened counters on Contributor - TopRankingView: reusable leaderboard card built on the existing TopCard (rank medal, avatar, name, count column, GitHub profile link) - app.vue / TopSectionView: fetch the three ranking files and render a card per metric, hidden when its ranking is empty - deterministic mock-data generator (scripts/generate-mock-stats.mjs) so the UI can be reviewed before the data pipeline lands - vitest coverage for the new components Note: ranking data is currently mocked. Real data comes from the Traces pipeline — see PrestaShop/traces#232. 🤖 Generated with Claude Code
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds collection of three new contribution metrics to feed the TopContributors site (which already has the UI ready to display them):
traces:fetch:issues→gh_issues.json— every org repo's issues (GraphQLissuesconnection, which natively excludes pull requests).traces:fetch:pullrequests:all→gh_pullrequests_all.json— all pull requests (any state) with their reviewers, in a single pass (page size 25 to stay under GraphQL node limits given thereviewssub-query). Reviewers are de-duplicated per PR.traces:generate:topstats— aggregates the two raw files, enrichescontributors_prs.jsonwith three per-contributor counters, and writes three pre-sorted leaderboard files (top_reviewers.json,top_issues.json,top_pullrequests.json).Metric definitions
reviews= number of distinct PRs a person reviewed (self-reviews excluded; counted even when the PR author is a deleted/null account).pullRequestsOpened= all PRs the person authored, any state.issuesOpened= all issues the person authored (PRs excluded).Identity for reviewers/reporters not already in
contributors_prs.jsonis resolved viagetUser(cached). Bot exclusions (config) and null authors are respected. Aggregation runs over all org repos, all history — consistent with the existing stats.The aggregation core is a pure static method (
GenerateTopStatsCommand::aggregate) so it can be verified without hitting the API.Test Plan
phpstan analyse—[OK] No errors(level 6)php-cs-fixer fix --dry-run --diff— no diffbin/console;Makefilegenerate/cleanandREADMEupdated-r decimal), then fullmake generate🤖 Generated with Claude Code