Skip to content

fix(review): honor autoCloseExemptLogins in closeDraftDodgeAttemptIfBlocked - #9369

Closed
philluiz2323 wants to merge 2 commits into
JSONbored:mainfrom
philluiz2323:fix/draft-dodge-autoclose-exempt-9294
Closed

fix(review): honor autoCloseExemptLogins in closeDraftDodgeAttemptIfBlocked#9369
philluiz2323 wants to merge 2 commits into
JSONbored:mainfrom
philluiz2323:fix/draft-dodge-autoclose-exempt-9294

Conversation

@philluiz2323

Copy link
Copy Markdown
Contributor

Summary

closeDraftDodgeAttemptIfBlocked was the one remaining review-evasion auto-close guard that did not call isProtectedAutomationAuthor or isAutoCloseExempt. Authors on the operator's autoCloseExemptLogins allowlist, or protected automation bots (dependabot[bot], etc.), were therefore still draft-dodge closed even though every sibling guard in src/queue/review-evasion.ts honors those exemptions — the same bug class fixed in #6165 on a different sibling.

Adds both exemption checks before the close decision, matching closeReviewEvasionSelfCloseIfReviewed and the other four guards.

Test plan

  • test/unit/queue-lifecycle-guards.test.ts: gate-blocked PR converted to draft by an autoCloseExemptLogins author is NOT closed
  • test/unit/queue-lifecycle-guards.test.ts: gate-blocked PR converted to draft by dependabot[bot] is NOT closed
  • Targeted vitest run passes (2/2 new regression cases)

Closes #9294

JSONbored and others added 2 commits July 27, 2026 04:51
Follows JSONbored#9276, which fixed 8 files / 12 cases and left these 4 files / 5 cases
still red on main (and therefore red on every open PR). Each diagnosed to its
introducing commit; two are real source gaps, two are stale sibling tests a
deliberate behavior change never updated.

SOURCE fixes:
- selfhost/metrics.ts: register two counters emitted since JSONbored#9243 and JSONbored#9245 but
  never added to DEFAULT_METRIC_META, so renderMetrics() emitted them as bare
  undocumented samples with no HELP/TYPE — exactly what that drift guard exists
  to catch. Both commits even name the counter in their own body text; a pure
  registration miss, not a behavior decision.

TEST fixes (source verified correct in both cases):
- selfhost-pg-retention: the fake Postgres still matched the pre-JSONbored#9083 ctid
  semi-join, so every DELETE fell through to rowCount 0. JSONbored#9083 deliberately
  moved retention to an index-backed PK range delete with ORDER BY (the fix for
  prune-retention blowing its timeout and stalling permanently); it updated the
  SQLite twin but not the Postgres one. Regex now captures whichever key column
  is in play, keeping BOTH the mapped-PK and ctid-fallback paths exercised.
- salvageability: JSONbored#9085 made an absent blocker confidence degrade to
  CONFIDENCE_WHEN_UNSTATED (0.5) instead of 1.0, so it is sub-floor against the
  0.93 default and the low-confidence hold owns the case. It renamed both
  sibling assertions in rules.test.ts but missed this third consumption site.
  Both calls kept — they are the only coverage of the default-floor arm and the
  nullish-confidence arm respectively.
- worker-entry-boundary: false positive, not a real dependency leak. The check
  grepped whole-file text, so JSONbored#9230's user-facing string "crossed the
  visual-diff threshold" failed a green tree over a sentence, in a file
  worker-reachable since JSONbored#4120 that imports none of these deps. Narrowed to scan
  module specifiers (reusing the file's own parseImportSpecifiers) — the only
  way a Node-only dep can actually reach the bundle. Added a discriminating test
  so it cannot pass vacuously; verified by injecting a real `import sharp` and
  confirming it fails, naming the file and specifier.
…locked

closeDraftDodgeAttemptIfBlocked was the one remaining review-evasion auto-close
guard that skipped isProtectedAutomationAuthor and isAutoCloseExempt, so authors
on the operator allowlist or protected automation bots were still draft-dodge
closed despite every sibling guard honoring those exemptions (JSONbored#6165 pattern).

Closes JSONbored#9294
@philluiz2323
philluiz2323 requested a review from JSONbored as a code owner July 27, 2026 14:37
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.51%. Comparing base (f7dda79) to head (6cdc4e1).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
src/queue/review-evasion.ts 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9369      +/-   ##
==========================================
+ Coverage   75.38%   75.51%   +0.13%     
==========================================
  Files         275      277       +2     
  Lines       58023    58402     +379     
  Branches     6181     8330    +2149     
==========================================
+ Hits        43739    44105     +366     
- Misses      14014    14017       +3     
- Partials      270      280      +10     
Flag Coverage Δ
backend 96.56% <50.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/selfhost/metrics.ts 100.00% <ø> (ø)
src/queue/review-evasion.ts 95.34% <50.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 27, 2026
@loopover-orb

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-27 14:51:19 UTC

6 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
The core fix at src/queue/review-evasion.ts:293-294 adds the same isProtectedAutomationAuthor/isAutoCloseExempt early-return pair that every sibling review-evasion guard already has (closeRepeatedDraftCyclingIfDetected, closeDraftPrIfPolicyEnabled, closeSynchronizeAmendmentIfPolicyEnabled all use the identical `if (isProtectedAutomationAuthor(pr.authorLogin, env)) return;` / `if (isAutoCloseExempt(pr.authorLogin, settings.autoCloseExemptLogins)) return;` pattern), placed correctly before the close-decision `if (block && ...)` block so it short-circuits before any GitHub mutation. The two new regression tests in queue-lifecycle-guards.test.ts exercise both exemption arms end-to-end (allowlisted contributor, dependabot[bot]) and assert no PATCH close call and zero audit rows, which is a real test of the fixed path, not a fabricated one. The diff also bundles unrelated hunks (a new metrics entry in selfhost/metrics.ts, and test-only changes to worker-entry-boundary.test.ts, salvageability.test.ts, selfhost-pg-retention.test.ts) that reference issues #9150/#9065/#9230/#9085/#9237/#9083 with no connection to #9294 — given this branch is 14 commits behind default, these are very likely already-merged changes from other PRs surfacing in the diff view rather than scope creep introduced by this contributor, but it's worth confirming the actual PR diff on GitHub is scoped to review-evasion.ts + its own test before merging.

Nits — 4 non-blocking

CI checks failing

  • codecov/patch — 50.00% of diff hit (target 99.00%)

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9294
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 986 registered-repo PR(s), 563 merged, 125 issue(s).
Contributor context ✅ Confirmed Gittensor contributor philluiz2323; Gittensor profile; 986 PR(s), 125 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff adds the isProtectedAutomationAuthor and isAutoCloseExempt checks to closeDraftDodgeAttemptIfBlocked in the same relative position as sibling guards, without touching the existing owner/admin/headSha conditions, and includes two new regression tests covering an autoCloseExemptLogins author and a protected automation author.

Review context
  • Author: philluiz2323
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, JavaScript, MDX, TypeScript, CSS, Cuda, HTML, Kotlin
  • Official Gittensor activity: 986 PR(s), 125 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 27, 2026
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

review: closeDraftDodgeAttemptIfBlocked skips the autoCloseExemptLogins allowlist its five siblings honor

2 participants