Skip to content

review: closeDraftDodgeAttemptIfBlocked skips the autoCloseExemptLogins allowlist its five siblings honor #9294

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

closeDraftDodgeAttemptIfBlocked in src/queue/review-evasion.ts (behind exported
maybeCloseDraftDodgeAttempt) auto-closes a PR that converts to draft to dodge a gate block. Its
exemption check (around line 284) only checks authorIsOwner and authorIsAdmin before closing.

All of its siblings in the same file additionally honor the operator-configured
autoCloseExemptLogins allowlist via isProtectedAutomationAuthor + isAutoCloseExempt:

  • closeReviewEvasionSelfCloseIfReviewed (~line 628): if (isProtectedAutomationAuthor(pr.authorLogin, env)) return; then if (isAutoCloseExempt(pr.authorLogin, settings.autoCloseExemptLogins)) return;
  • maybeCloseReviewEvasionDraftConversion
  • maybeCloseRepeatedDraftCycling
  • maybeCloseDraftPr
  • maybeCloseSynchronizeAmendment

closeDraftDodgeAttemptIfBlocked is the one remaining guard in this file that doesn't call either
check — so an author explicitly placed on the operator's autoCloseExemptLogins allowlist is
still auto-closed by this specific enforcement path, even though every other auto-close guard in
the same file honors that same allowlist.

This is the identical bug class already found and fixed in this exact file as #6165
("closeRepeatedDraftCyclingIfDetected skips the autoCloseExemptLogins allowlist its two
siblings honor" — closed, labeled gittensor:bug, help wanted). This issue is a fresh, unfixed
instance of that same pattern on the one remaining sibling that still lacks it.

Requirements

  • closeDraftDodgeAttemptIfBlocked must call both isProtectedAutomationAuthor(pr.authorLogin, env)
    and isAutoCloseExempt(pr.authorLogin, settings.autoCloseExemptLogins) and skip the auto-close
    (return early, same as its siblings) when either returns true — in the same relative position in
    the function as its siblings check them (before the close decision, alongside the existing
    authorIsOwner/authorIsAdmin checks).
  • Do not change the existing authorIsOwner/authorIsAdmin/block.overridden/block.headSha
    conditions — only add the two missing exemption checks.
  • Do not modify any other function in src/queue/review-evasion.ts — the other five guards
    already correctly honor these exemptions.

Deliverables

  • closeDraftDodgeAttemptIfBlocked in src/queue/review-evasion.ts gains the
    isProtectedAutomationAuthor and isAutoCloseExempt checks, matching the pattern used by
    closeReviewEvasionSelfCloseIfReviewed (or any of the other four exempt-checking siblings)
    in the same file.
  • A new test asserting: a PR authored by a login on settings.autoCloseExemptLogins that
    converts to draft while gate-blocked is NOT auto-closed by maybeCloseDraftDodgeAttempt
    (mirroring fix(review): closeRepeatedDraftCyclingIfDetected skips the autoCloseExemptLogins allowlist its two siblings honor #6165's regression test for the equivalent fix on
    closeRepeatedDraftCyclingIfDetected).
  • A new test asserting a protected-automation-author PR is similarly not auto-closed by this
    path.

All three deliverables are required in this single PR.

Test Coverage Requirements

This repo enforces 99%+ Codecov patch coverage, branch-counted, on every changed line/branch in
src/**. The new exemption checks and both new test cases above must be covered.

Expected Outcome

An author on autoCloseExemptLogins, or a protected automation author, converting a
gate-blocked PR to draft is no longer auto-closed by closeDraftDodgeAttemptIfBlocked — matching
the exemption behavior every other auto-close guard in src/queue/review-evasion.ts already
provides.

Links & Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions