fix(analytics): don't credit a pre-action merged PR as accepted - #606
Conversation
pullRequestOutcomeState's accepted fallback only required a later updatedAt, so a PR merged before the recommendation that received any post-action update (e.g. a comment) was scored as the positive accepted outcome -- inflating recommendation-quality positives with merges that causally predate the action. Guard the accepted branch against a merge that predates actionAt, mirroring the merged branch's own >= actionAt discipline.
|
reviewbot · advisory review Reviewed 2 changed file(s) — two independent AI reviewers. Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Suggestions
Worth double-checking
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
gittensory · advisory review Reviewed 2 changed file(s) — two independent AI reviewers. Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Suggestions
Worth double-checking
|
Closes #605.
pullRequestOutcomeState's"merged"branch correctly requiresmergedAt >= actionAt, but the"accepted"fallback only required a laterupdatedAt. So a PR merged before the recommendation (which fails the merged guard, and whose!pr.mergedAtshort-circuit is false) fell through to"accepted"the moment it received any post-action update (a comment, label, base bump)."accepted"is a positive state (POSITIVE_STATES), so the recommendation was credited with a merge that causally predates it — inflating the operator recommendation-quality positives.The intended semantics were already pinned:
recommendation-outcomes.test.tsasserts the same pre-action-merged PR with no post-action activity is"stale". A singleupdatedAtbump should not flip that to the positive"accepted".Change
acceptedfallback against a merge that predatesactionAt, mirroring themergedbranch's own>= actionAtdiscipline.updatedAtafter it ->"stale", not"accepted".Verification
recommendation-outcomes.test.ts12/12 (the new case fails on the old code, which returns"accepted");tsc --noEmitclean; full suite green; branch coverage holds (>= 97% gate).Same function as the closed #475 (which fixed a changes-requested PR being scored
improved); a different defect in theacceptedfallback.