Skip to content

feat: byYear breakdown & company slug (additive-strict)#237

Merged
Progi1984 merged 6 commits into
PrestaShop:masterfrom
PrestaEdit:feat/byyear-breakdown
Jul 10, 2026
Merged

feat: byYear breakdown & company slug (additive-strict)#237
Progi1984 merged 6 commits into
PrestaShop:masterfrom
PrestaEdit:feat/byyear-breakdown

Conversation

@PrestaEdit

Copy link
Copy Markdown
Contributor

Summary

Extends every traces:generate:* command to emit a per-year breakdown of every counted field, as sibling *ByYear / *_by_year maps alongside the pre-existing scalar counters. Adds slug + contributors[] on companies and an updatedAt timestamp at the top level of every output.

Additive-strict discipline: every existing scalar key retains its type and semantics. No consumer that reads the old shape breaks. New consumers pair the scalar with its sibling map to build a period-filtered view.

What ships

Command Change
traces:generate:topcompanies Contributor-level *ByYear siblings + Company::$slug + Company::$contributors[] + top-level updatedAt.
traces:generate:topstats Rankings expose count: int (unchanged) + new countByYear: {year: int} sibling. Also enriches contributors_prs.json with reviewsByYear, issuesOpenedByYear, pullRequestsOpenedByYear. Fetches were extended to include createdAt (PRs / issues) and submittedAt (reviews) — those fields weren't fetched before, blocking the breakdown.
traces:generate:topsecurity research, remediation, count scalars retained; adds researchByYear, remediationByYear, countByYear siblings. Guarded against malformed / empty publication dates.

Consumer impact

The TopContributors front consumes these JSONs. The paired PR on TopContributors is designed to keep rendering with the legacy scalar-only shape — so this can land and be tagged independently.

Discipline notes

  • No scalar was reshaped into an object.
  • All new keys are additive.
  • bumpPairFromDate guards strtotime failures so an unparseable date doesn't silently bucket into the current year.
  • PHPStan clean at the project's real gate (level 6).

Test plan

  • Run traces:generate:topcompanies on a fresh cache and confirm sum(*.mergedPullRequestsByYear) == mergedPullRequests for a random sample of 20 contributors.
  • Run traces:generate:topstats and confirm the sum(*.countByYear) == count invariant on all three ranking files.
  • Run traces:generate:topsecurity and confirm the same invariant on top_security.json for count, research, remediation.
  • Confirm updatedAt is a valid ISO 8601 string on every emitted file.
  • Confirm the legacy TopContributors front (pre-consumer PR) still renders on the new outputs.

🤖 Generated with Claude Code

PrestaEdit and others added 5 commits July 8, 2026 15:22
…populate Company contributors

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…pdatedAt

- GenerateTopStatsCommand: aggregate() now tracks reviewsByYear,
  issuesOpenedByYear, pullRequestsOpenedByYear alongside the existing
  scalar counters (additive-strict, bumpPair() helper).
- buildRanking() items gain a countByYear sibling next to count;
  top_reviewers/top_issues/top_pullrequests.json now wrap items under
  {updatedAt (ISO 8601 / DATE_ATOM), items}.
- contributors_prs.json enrichment gains reviewsByYear/issuesOpenedByYear/
  pullRequestsOpenedByYear siblings next to the existing scalars.
- FetchPullRequestsAllCommand / FetchIssuesCommand: added createdAt (PR
  and issue) and submittedAt (review) to the GraphQL queries and output
  shape — required because the per-year breakdown has no date to bucket
  on otherwise. Purely additive new fields, no existing field touched.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…unt, plus updatedAt

Wraps top_security.json's updatedAt in ISO 8601 (DATE_ATOM) instead of
Y-m-d, and adds countByYear/researchByYear/remediationByYear sibling
maps keyed by advisory published_at year, following the additive-strict
bumpPairFromDate pattern from Task 3. Existing scalar count/research/
remediation keys are unchanged. A missing/malformed published_at still
increments the scalar but is skipped from the year bucket, so it is
never misattributed to the current year.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@PrestaEdit
PrestaEdit marked this pull request as ready for review July 10, 2026 12:22
@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard Jul 10, 2026
@Progi1984

Copy link
Copy Markdown
Member

@PrestaEdit Can you fix the CI, plz ?

- Pre-increment (`++$x`) instead of post-increment (`$x++`) when the value
  is discarded — matches the repo's PHP-CS-Fixer ruleset.
- Import `DateTimeImmutable` via `use` at file scope rather than \
  reaching into the root namespace with a fully-qualified name.

CI failure surfaced by @Progi1984 on PrestaShop#237.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@PrestaEdit

Copy link
Copy Markdown
Contributor Author

Fixed via 80fd17aphp-cs-fixer fix applied (pre-increment + use DateTimeImmutable). CI should pick it up on the next run.

@Progi1984
Progi1984 merged commit 300274e into PrestaShop:master Jul 10, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for review to Merged in PR Dashboard Jul 10, 2026
@ps-jarvis ps-jarvis moved this from Merged to Ready for review in PR Dashboard Jul 10, 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.

3 participants