fix(review): scope draft-cycle counting to the author's own conversions#3979
Merged
Conversation
The counter previously incremented on EVERY converted_to_draft event regardless of actor, while enforcement only checked the actor at close-time -- so a maintainer's one-off draft toggle plus the author's own first-ever (legitimate) conversion could reach count>=2 and wrongly close that first conversion. Only count conversions performed by the PR's own author. Also moves the cheap settings/count checks ahead of the actuation-lock claim to avoid contending with the two sibling guards on repos that never enabled this feature.
Contributor
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 Gittensory is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3979 +/- ##
=======================================
Coverage 93.70% 93.70%
=======================================
Files 373 373
Lines 35076 35076
Branches 12862 12863 +1
=======================================
Hits 32868 32868
Misses 1584 1584
Partials 624 624
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
draft_conversion_countincremented on EVERYconverted_to_draftwebhook regardless of actor, while enforcement only checked the actor at close-time. A maintainer's one-off draft toggle followed by the author's own first-ever (legitimate) conversion could reach count>=2 and wrongly close that first conversion as "repeated cycling."reviewEvasionProtection/count checks ahead of the actuation-lock claim (a non-blocking nit from the same review) to avoid contending with the two sibling guards on repos that never enabled this feature.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.md.Validation
npm run typechecknpx vitest run test/unit/queue.test.ts -t "repeated ready<->draft cycling|bumpPullRequestDraftConversionCount"-- 26/26 pass, including the new maintainer-then-author regression.v8 ignorecomment.Safety