Skip to content

feat(qa): top QA contributors ranking - #246

Merged
Progi1984 merged 7 commits into
PrestaShop:masterfrom
PrestaEdit:feat/top-qa-ranking
Aug 29, 2026
Merged

Progi1984 merged 7 commits into
PrestaShop:masterfrom
PrestaEdit:feat/top-qa-ranking

Conversation

@PrestaEdit

Copy link
Copy Markdown
Contributor

Summary

Adds a QA contributors leaderboard to the pipeline, on the same model as top_security.

  • traces:fetch:qaevents — for each repository in gh_repositories.json, searches merged PRs carrying the labels QA ✔️ and QA ✔️ by Community, records the LabeledEvent.actor (i.e. the person who set the QA label), and writes deduplicated events to gh_qa_events.json.
  • traces:generate:topqa — aggregates events per actor into top_qa.json with the fields {rank, login, name, avatar_url, html_url, count, qa, qa_community}. Same shape as top_security.json, with two separate counters kept so the front can split later.
  • Bot exclusions reuse the shared configExclusions mechanism. Actors absent from contributors_prs.json (QA-ers who never contributed code) are resolved via github.getUser(login) and cached per run.

Design decisions

  • Search segmented per repo (not org-wide). GitHub's search API caps results at 1000 per query; a single org:PrestaShop search silently truncated ~9827 matching PRs to ~627 events on a first run. Iterating over gh_repositories.json keeps every module well under the cap. Verified on PrestaShop/PrestaShop: 577 events for QA ✔️, well under the ceiling.
  • Exact label strings: QA ✔️ (U+2714 heavy check mark, not U+2705 white check mark) and QA ✔️ by Community. Confirmed by inspecting /repos/PrestaShop/ps_emailsubscription/labels.
  • Actor = person who set the label, not the PR author. This is what we want per the initial discussion.
  • Dedup on (repo, pr_number, actor, label) with earliest createdAt kept — a label posed/removed/re-posed counts once.

Dry-run results

  • 2857 unique events across 55 QA contributors, ~5 min end-to-end.
  • Top 5: AureRita (345), sarahdib (337), Progi1984 (322), florine2623 (320), SiraDIOP (225).
  • qa_community populated where expected (kpodemski 28, jf-viguier 2, etc.).

Companion PR

Front-end consumption of top_qa.json (new Wall of Fame tab + contributor page + SVG card) will land in a separate PR on PrestaShop/TopContributors once this one is merged and the JSONs are released.

Test plan

  • php -l clean on both new commands and bin/console.
  • traces:fetch:qaevents completes without error against the live API.
  • traces:generate:topqa produces a top_qa.json with contiguous ranks and plausible ordering.
  • PrestaShop/PrestaShop event count stays under the 1000 per-repo search cap.

Two fixes surfaced during first dry-run:
- Actual labels are "QA ✔️" and "QA ✔️ by Community" (U+2714 heavy
  check mark), not "QA ✅" / "QA by community ✅" (U+2705).
- GitHub search API caps results at 1000 per query; a single org-wide
  search silently truncated 9827 matching PRs to ~627 events. Iterate
  over gh_repositories.json and search per-repo instead — each module
  stays well under the cap.

Dry-run now yields 2857 unique events across 55 QA contributors.
@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard Aug 28, 2026
Two refinements after a first end-to-end dry-run against the live API:

1. Broaden label coverage.
   Scanning every repo's labels surfaced eight more variants beyond the
   two original ones — including plain-text emoji codes (":heavy_check_mark:"),
   the U+2713 check mark, "QA by Dev", "QA by Community", "QA with AI",
   and "QA approved". They now all feed the same events stream.
   Result: 3146 unique events (vs 656 initially) across ~55 QA-ers.

2. Time-aware internal/community bucketing.
   The original label-based split fell apart on modules, where the same
   neutral label (`QA ✔️` etc.) is used by both team members and
   community reviewers. The fix hybridises the rule:
   - Labels that explicitly declare their origin (Community / Dev) win.
   - Neutral labels fall back to whether the actor was a PrestaShop
     employee AT THE TIME of the event, via the employees map in
     var/data/companies.json (login -> [{startDate, endDate}]).
   Historic events stay attributed to `qa` even for people who have
   since left the company, and events after someone's endDate cross
   over to `qa_community` — visible on Progi1984 (328 internal for the
   Jul 2019 - Aug 2026 stint, 3 community after that).
   Employees missing from the map still fall through to `qa_community`
   — that's a data gap in companies.json, not something this command
   can fix.

Also emit countByYear / qaByYear / qaCommunityByYear on each item,
mirroring the byYear convention of top_security.json so the front can
plot per-year contributions.
@Progi1984

Copy link
Copy Markdown
Member

CI is red

- Import Throwable and drop the leading backslash (CS Fixer's global_namespace_import rule).
- Loosen the docblock types on rows coming from json_decode to `array<string, mixed>` and validate the shape inline; strict `array{...}` types were tripping "always exists / always evaluates to true" phpstan errors that reflected the docblock's optimism rather than runtime reality.
- Add a proper docblock to FetchQaEventsCommand::dedup() (no value type in iterable).
@Progi1984
Progi1984 merged commit c091798 into PrestaShop:master Aug 29, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for review to Merged in PR Dashboard Aug 29, 2026
@ps-jarvis ps-jarvis moved this from Merged to Ready for review in PR Dashboard Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants