Skip to content

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

Draft
MakerFlyFly wants to merge 3 commits into
mainfrom
fix/pr-stats-author-timeline-events
Draft

MakerFlyFly wants to merge 3 commits into
mainfrom
fix/pr-stats-author-timeline-events

Conversation

@MakerFlyFly

@MakerFlyFly MakerFlyFly commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Exclude contributors' own LabeledEvent, ReadyForReviewEvent, and ConvertToDraftEvent from engagement; a currently non-draft PR with no ready label or other engagement remains in the untriaged backlog.
  • Preserve all closure actors, including contributor self-closes, collaborator activity, other engagement signals, and ready-label timestamps.
  • Model the reduced closed-query timeline accurately and verify coverage and both written JSON sidecars.

Type of change

  • Python package (tools/pr-management/)

Test plan

Previously validated behavior repair (088be38c)

  • Six contributor cases fail on the original code; 19 preservation cases fail on the first repair; all 36 targeted cases pass after this revision.
  • Linux, Python 3.12.12: 687 tests pass on the patched fork, plus 15 subtests.
  • The full patch applies cleanly to upstream 17abc4c8 and passes 780 tests, plus 15 subtests.
  • Full affected-package Ruff, format check, and Mypy pass on both bases.
  • Four synthetic closed PRs retain 100% coverage; two collaborator open PRs retain defacto=2 and engaged_count=2.
  • Reference and dashboard sidecar files are written and read back in the regression test.
  • Whole-repo non-test hooks, including lychee, pass.
  • Commit hooks and scoped workspace pytest pass; no hook was bypassed.
  • Magpie pre-first-PR: ready, zero blocking and advisory findings.
  • GitHub CI for revised head 088be38c: nine successful checks, including pytest, tests-ok, prek, RAT, Zizmor, and Python analysis; the aggregate CodeQL entry is neutral.

Final re-review

The supplied re-review reports no blocking findings.
Final follow-up 7a5f1bb3 adds four comment lines to the two closed-PR tests; their executable AST and all assertions are unchanged from 088be38c.

Suggestion Resolution
Labeling requires repository permissions Clarify that triage or greater access is required; draft-state changes are the normal external-author case. Keep LabeledEvent as defensive input coverage. The proposed token/private-membership explanation remains unverified.
Closure tests could look like permanent policy Add comments that these are compatibility assertions for this limited repair. A separate policy fix may change contributor self-closure behavior.
Squash the final merge Recommend squash for the final merge, preserving the published branch history during audit.
Author COMMENTED reviews Keep outside this change pending real API verification; no new issue is filed on that hypothesis.

A PR currently in draft still does not enter the untriaged non-draft counts.
Excluding an author's engagement event does not change that eligibility rule.

  • UTF-8 stats tests: 116 pass; test AST equals 088be38c.
  • Full affected-package Ruff, format check, and Mypy pass.
  • The complete patch applies cleanly to upstream snapshot b6ccd434, checked on 2026-11-06; no stats files changed since the previously tested upstream base.
  • Whole-repo non-test hooks, commit hooks, and scoped workspace pytest pass without bypasses.
  • Magpie pre-first-PR for the complete branch: ready, zero blocking and advisory findings.
  • GitHub CI for final head 7a5f1bb3: nine successful checks; the aggregate CodeQL entry is neutral and Python analysis succeeds.

RFC-AI-0004 compliance

This repairs deterministic classification.
It adds no service access, configuration, dependency, or fetched fields.

Linked issues

Closes #37.

Review follow-up

Finding Resolution
ClosedEvent changed closed-PR coverage Accepted. Preserve every closure actor as before, including contributor self-closes; restricting only by contributor identity would still exceed the intended event scope.
Collaborator authors lost de-facto/engaged counts Accepted. Apply author exclusion only on contributor PRs; cover OWNER, MEMBER, and COLLABORATOR across the three open event types.
Reduced fixtures missed the closure signal Accepted. Honor an explicit timeline without adding the absent review/commit collections. Existing attribution tests had independent maintainer comments masking this regression.
Case-variant input is synthetic Partially accepted. Keep the agreed defensive comparison and label the test accordingly; do not change other author comparisons.
Comments described a narrower effect than the code Accepted. Correct the reduced-schema description and document the bounded filter.
Recommendation assertion depended on exact title and position Accepted. Locate the action and assert priority/count.

The three-version synthetic reproducer confirms closed coverage 100% -> 25% -> 100% and collaborator counts 2 -> 1 -> 2.
Only the closed-PR and collaborator contributions are preserved: the intended correction to open contributor engagement still affects aggregate coverage.

The first repair remains in history as dfc050de; this revision is an additional commit.
All changes stay in this fork's Draft PR. Re-review feedback reports no blockers; the final merge decision remains with the user.
The fork base remains main@30ee18c2; the affected stats sources at that base and upstream 17abc4c8 match before this patch.

Strict authorization of other actors and author COMMENTED reviews remain outside this PR.
Live API reachability of the latter has not been verified.

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

  • Yes — OpenAI Codex (GPT-6) assisted with reproduction, implementation, tests, and drafting.
  • Commits carry Generated-by: Codex (GPT-6).

Upstream publication

The contributor completed review of the audited implementation 7a5f1bb3.

The four audited source/test blobs are unchanged.
The upstream packaging hook additionally requires an identical generated classifier copy in magpie-security-tools.
This fork audit record and its published history are retained; the upstream PR is the formal review target.

Keep contributor PRs awaiting triage when their only activity is their
own label or draft-state change. Preserve ready-label detection and
label timestamps, and cover the dashboard counts and recommendations.

Generated-by: Codex (GPT-6)
@MakerFlyFly MakerFlyFly added bug Something isn't working capability:fix Implement code change to resolve an issue capability:stats Read-only dashboards, metrics, governance evidence family:pr-management pr-management-* skills substrate:analytics labels Nov 5, 2026 — with ChatGPT Codex Connector
Limit author exclusion to contributors' label and draft-state events so
closed-PR coverage and collaborator counts retain their prior behavior.
Keep reduced fixtures faithful to closure actors and verify written
sidecars as well as the dashboard metrics.

Generated-by: Codex (GPT-6)
@MakerFlyFly MakerFlyFly changed the title fix(pr-management-stats): ignore author timeline events fix(pr-management-stats): correct contributor timeline engagement Nov 5, 2026
Explain that the closed-PR assertions preserve prior behavior within
this repair's scope. A separate policy change may revise contributor
self-closure expectations without being a regression in this repair.

Generated-by: Codex (GPT-6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working capability:fix Implement code change to resolve an issue capability:stats Read-only dashboards, metrics, governance evidence family:pr-management pr-management-* skills family:tools substrate:analytics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pr-management stats counts contributor activity as maintainer engagement

1 participant