Skip to content

fix(pr-management-stats): correct contributor timeline engagement - #2016

Open
MakerFlyFly wants to merge 1 commit into
apache:mainfrom
MakerFlyFly:fix/pr-stats-contributor-engagement-upstream
Open

MakerFlyFly wants to merge 1 commit into
apache:mainfrom
MakerFlyFly:fix/pr-stats-contributor-engagement-upstream

Conversation

@MakerFlyFly

@MakerFlyFly MakerFlyFly commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Keep contributor PRs in the untriaged backlog when their only engagement is their author's own label or draft-state event.
  • Limit the filter to LabeledEvent, ReadyForReviewEvent, and ConvertToDraftEvent; preserve collaborator activity, closure actors, ready-label behavior, and label timestamps.
  • Make the reduced closed-PR fixture retain an explicitly supplied timeline and verify the dashboard metrics and written JSON sidecars. Include the identical generated dependency copy required by the plugin packaging hook.

Type of change

  • Python package (tools/pr-management/)

Test plan

  • On original upstream b6ccd434, six contributor regression cases fail and the other 30 targeted cases pass.
  • With the fix, all 116 stats tests pass.
  • Full affected package: 795 tests and 15 subtests pass on Linux with Python 3.12.12.
  • Full-package Ruff, format check, and Mypy pass.
  • The four changed file blobs match the contributor-reviewed final patch.
  • prek run --all-files --skip workspace-pytest passes, including lychee and the generated-plugin check.
  • Scoped workspace pytest passes for both affected members: tools/pr-management has 795 passed and 15 subtests; plugins has 114 passed and one container-permission probe skipped. Commit hooks were not bypassed.
  • Magpie pre-first-PR: ready, zero blocking and advisory findings.

RFC-AI-0004 compliance

This corrects deterministic classification without adding fetched fields, configuration, dependencies, or service access.

Linked issues

Closes #2015.

Notes for reviewers

The PR is one commit based on upstream main@b6ccd434.
The four reviewed source/test blobs are unchanged; a fifth file is the generated magpie-security-tools copy of the classifier, byte-for-byte identical to the reviewed source.
A currently draft PR remains outside the untriaged non-draft counts.

The label case is defensive input coverage; ordinary external authors need repository triage permission to apply labels.
Closed-PR assertions deliberately retain legacy behavior within this repair's scope; they do not endorse contributor self-closure as maintainer engagement.
Strict actor authorization and comment/review engagement policy remain unchanged.

Suggested labels: bug, family:pr-management, family:tools, capability:stats, capability:fix, substrate:analytics.

Was generative AI tooling used to co-author this PR?

  • Yes — OpenAI Codex (GPT-6) assisted with implementation, tests, and drafting.
  • The contributor reviewed the final implementation before upstream submission.
  • The commit carries Generated-by: Codex (GPT-6).

Do not treat contributors' own label and draft-state events as maintainer
engagement. Keep collaborator activity and closure signals unchanged so
existing coverage and ready-label metrics retain their behavior.

Cover the backlog counts, recommendations, closed-query shape, and written
JSON sidecars with regression tests.

Keep the generated magpie-security-tools dependency copy in sync.

Generated-by: Codex (GPT-6)

@Kaap10 Kaap10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the clean fix and thorough test coverage.

  • Accurately addresses #2015 by ensuring contributor self-events (ReadyForReviewEvent, ConvertToDraftEvent, LabeledEvent) do not falsely trigger maintainer engagement.
  • Safely handles casing discrepancies and deleted user accounts with (author or "").lower().
  • Preserves maintainer actions on contributor PRs and collaborator self-events.
  • Full test suite passes cleanly with parity across both tool locations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

family:tools tools/* substrate:analytics Tool substrate: read-only metrics / dashboards / renderers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pr-management stats counts contributor draft changes as engagement

2 participants