Skip to content

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

Merged
JSONbored merged 3 commits into
JSONbored:mainfrom
philluiz2323:fix/draft-dodge-autoclose-exempt-9294
Jul 27, 2026
Merged

fix(review): honor autoCloseExemptLogins in closeDraftDodgeAttemptIfBlocked#9375
JSONbored merged 3 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, were still draft-dodge closed even though every sibling guard honors those exemptions (#6165 pattern).

Adds both exemption checks before the close decision, matching the other five guards in src/queue/review-evasion.ts.

Test plan

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:53
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.52%. Comparing base (a58ce3d) to head (6937290).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9375      +/-   ##
==========================================
+ Coverage   75.38%   75.52%   +0.13%     
==========================================
  Files         275      277       +2     
  Lines       58023    58402     +379     
  Branches     6181     6320     +139     
==========================================
+ Hits        43739    44106     +367     
- Misses      14014    14017       +3     
- Partials      270      279       +9     
Flag Coverage Δ
backend 96.83% <100.00%> (?)

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

Files with missing lines Coverage Δ
src/queue/review-evasion.ts 95.69% <100.00%> (ø)
src/selfhost/metrics.ts 100.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

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-27 15:11:20 UTC

7 files · 1 AI reviewer · no blockers · readiness 95/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a narrow, correctly-targeted fix: closeDraftDodgeAttemptIfBlocked now calls isProtectedAutomationAuthor and isAutoCloseExempt before the close decision, matching the pattern its five sibling review-evasion guards already use (each visible later in the full file: closeRepeatedDraftCyclingIfDetected, closeDraftPrIfPolicyEnabled, closeSynchronizeAmendmentIfPolicyEnabled). The placement is correct — before the `block && ...` close-eligibility check, so an exempt author's PR is never routed into the close path at all — and is backed by both an integration regression test and a direct-unit test for each exemption arm. The diff also bundles unrelated but small metrics-registry additions and several other test files' fixes/hardening (worker-entry-boundary specifier-scoping, salvageability confidence-default correction, pg-retention regex fix) that are plausibly pre-existing branch content rather than scope creep introduced by this PR itself.

Nits — 3 non-blocking
  • src/queue/review-evasion.ts: the two new exemption checks are placed after `block` and the admin/owner checks are computed but before the `if (block && ...)` condition — consider moving them to the very top of the function (before `getGateBlockOutcome` is even awaited) to save a DB call on the common exempt-author path, though this is a minor perf nit, not correctness.
  • The metrics.ts changes (new `loopover_orb_relay_multiple_live_enrollments_total` and `loopover_private_manifest_warnings_total` entries) are unrelated to the stated PR intent and appear to be pre-existing branch content rather than part of this fix — worth confirming they're not accidental scope creep in the final diff.
  • Consider hoisting the `isProtectedAutomationAuthor`/`isAutoCloseExempt` checks in src/queue/review-evasion.ts:293-294 above the `getGateBlockOutcome` call and the `isPerTenantAdmin` DB lookup, since an exempt author should short-circuit before any DB work, matching how the pattern reads in the sibling guards further down the file.

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 both `isProtectedAutomationAuthor` and `isAutoCloseExempt` checks in `closeDraftDodgeAttemptIfBlocked` before the close decision, matching the sibling pattern, and includes new regression tests in both queue-lifecycle-guards.test.ts and review-evasion-per-repo-admin.test.ts covering the allowlist and protected-automation-author cases as required.

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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@JSONbored
JSONbored merged commit 27b44f3 into JSONbored:main Jul 27, 2026
8 checks passed
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