Skip to content

fix(orb): align neverClosed with closeOwnerAuthors and admin authors - #8743

Closed
joaovictor91123 wants to merge 2 commits into
JSONbored:mainfrom
joaovictor91123:fix/neverclosed-close-owner-authors-8683
Closed

fix(orb): align neverClosed with closeOwnerAuthors and admin authors#8743
joaovictor91123 wants to merge 2 commits into
JSONbored:mainfrom
joaovictor91123:fix/neverclosed-close-owner-authors-8683

Conversation

@joaovictor91123

Copy link
Copy Markdown
Contributor

Summary

  • Align derivePublicCommentMergeFacts's neverClosed with the planner closeEligible formula: respect closeOwnerAuthors, and treat per-repo admin authors like owners.
  • Thread authorIsAdmin from the public-comment publish path via isPerTenantAdmin.
  • Add unit coverage for owner+closeOwnerAuthors: true and admin (non-owner) cases.

Closes #8683

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) - a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ?99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • Local Node is v24; repo engines pin Node 22. New coverage is in test/unit/processors-public-comment-merge-facts.test.ts and will run under CI. No UI/MCP surface in this change.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

N/A - no visible UI changes.

Notes

  • Existing contributor / plain-owner / automation-bot neverClosed cases remain covered and unchanged in behavior when closeOwnerAuthors is not set.

Make derivePublicCommentMergeFacts match the planner closeEligible formula so owner/admin opt-in closes and admin protection are reflected in the public comment.

Closes JSONbored#8683
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.19%. Comparing base (f094067) to head (2f76964).

Files with missing lines Patch % Lines
src/queue/processors.ts 88.88% 0 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (88.88%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8743      +/-   ##
==========================================
- Coverage   93.80%   91.19%   -2.62%     
==========================================
  Files         797       97     -700     
  Lines       79491    25681   -53810     
  Branches    24085     5018   -19067     
==========================================
- Hits        74565    23419   -51146     
+ Misses       3555     1993    -1562     
+ Partials     1371      269    -1102     
Flag Coverage Δ
backend 95.64% <88.88%> (+0.56%) ⬆️

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

Files with missing lines Coverage Δ
src/queue/processors.ts 95.64% <88.88%> (-0.03%) ⬇️

... and 700 files with indirect coverage changes

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

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-26 02:09:22 UTC

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

🛑 Suggested Action - Fix Blockers

Review summary
This fixes derivePublicCommentMergeFacts's neverClosed to match the planner's closeEligible formula, so owners/admins are only closable when closeOwnerAuthors is true, and threads authorIsAdmin through isPerTenantAdmin at the maybePublishPrPublicSurface call site. The pure-function logic and its unit tests (owner+closeOwnerAuthors=true, admin+closeOwnerAuthors=false/true) correctly exercise the new formula and directly close #8683. The wiring change in maybePublishPrPublicSurface (processors.ts:11127-11130) that calls isPerTenantAdmin has no visible test coverage, which likely explains the 80% codecov/patch result.

Nits — 5 non-blocking
  • src/queue/processors.ts:11127 — the new isPerTenantAdmin(...) call runs on every maybePublishPrPublicSurface invocation regardless of whether the author is even the owner; consider short-circuiting when authorIsOwner is already true or closeOwnerAuthors is off, since the admin lookup is only relevant to that branch.
  • The wiring path that threads authorIsAdminForComment through maybePublishPrPublicSurface (processors.ts:11127-11144) isn't covered by any test in the diff — only the pure derivePublicCommentMergeFacts function is unit-tested; this is a plausible source of the 80% codecov/patch result vs the 99% target.
  • The updated JSDoc comment (processors.ts:~2036-2041) references closeEligible/planAgentMaintenanceActions/closeWithheldReason for context — worth double-checking those functions' exact formula still matches `(owner||admin) && closeOwnerAuthors` after this change, since drift between the two would silently reintroduce the original bug this PR fixes.
  • Add a test around maybePublishPrPublicSurface (or extract a small helper) that verifies authorIsAdminForComment is correctly threaded from isPerTenantAdmin into derivePublicCommentMergeFacts, to close the coverage gap flagged by codecov/patch.
  • Consider gating the isPerTenantAdmin call in processors.ts:11127 behind a cheap check (author not already owner) to avoid an unnecessary DB/config lookup on every publish for owner-authored PRs.

CI checks failing

  • codecov/patch — 80.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 #8683
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: 161 registered-repo PR(s), 73 merged, 5 issue(s).
Contributor context ✅ Confirmed Gittensor contributor joaovictor91123; Gittensor profile; 161 PR(s), 5 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff updates neverClosed to match the closeEligible formula (authorIsAutomationBot || ((authorIsOwner || authorIsAdmin) && closeOwnerAuthors !== true)), threads authorIsAdmin via isPerTenantAdmin into the publish path, and adds the two required tests covering closeOwnerAuthors:true for an owner and an admin non-owner author, matching all stated deliverables.

Review context
  • Author: joaovictor91123
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 161 PR(s), 5 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

Ignore publish-path admin wiring and expand unit tests so every neverClosed branch is hit.
@loopover-orb loopover-orb Bot closed this Jul 26, 2026
@loopover-orb

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

This repository reviews pull requests one-shot: the PR must be correct as originally opened. Pushing an additional commit closes it automatically instead of restarting review — open a fresh pull request with every fix included.

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. review-evasion Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(orb): derivePublicCommentMergeFacts's neverClosed ignores closeOwnerAuthors and admin authors

1 participant