Skip to content

fix(review): scope draft-cycle counting to the author's own conversions#3979

Merged
JSONbored merged 1 commit into
mainfrom
fix/draft-cycle-author-scoping
Jul 7, 2026
Merged

fix(review): scope draft-cycle counting to the author's own conversions#3979
JSONbored merged 1 commit into
mainfrom
fix/draft-cycle-author-scoping

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Follow-up to fix(review): close repeated ready<->draft cycling as review evasion #3962 (merged before this fix landed -- gittensory-orb flagged a real defect after CI/mergeable state had already gone clean, and the gate merges owner PRs on that state regardless of the AI review's advisory blockers).
  • The bug: draft_conversion_count incremented on EVERY converted_to_draft webhook 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."
  • Fix: only increment the counter when the converter IS the PR's own author. Also moved the cheap 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.
  • Added a regression test proving a maintainer-then-author conversion sequence is never enforced, and that the counter itself only reflects the author's own conversions.

Scope

Validation

  • npm run typecheck
  • Targeted test run: npx vitest run test/unit/queue.test.ts -t "repeated ready<->draft cycling|bumpPullRequestDraftConversionCount" -- 26/26 pass, including the new maintainer-then-author regression.
  • 100% branch coverage on the changed lines (verified via lcov branch inspection); the one now-provably-unreachable defensive branch is marked with a justified v8 ignore comment.

Safety

  • No secrets/private data exposed.
  • No auth/CORS/session changes.
  • No API/UI changes.

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.
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 7, 2026
@loopover-orb

loopover-orb Bot commented Jul 7, 2026

Copy link
Copy Markdown
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

@JSONbored
JSONbored merged commit 61dac56 into main Jul 7, 2026
8 checks passed
@JSONbored
JSONbored deleted the fix/draft-cycle-author-scoping branch July 7, 2026 08:41
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.70%. Comparing base (583e7b2) to head (3469661).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

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           
Files with missing lines Coverage Δ
src/queue/processors.ts 94.71% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Development

Successfully merging this pull request may close these issues.

1 participant