Skip to content

fix(review): trust a linked issue closed by this PR's own merge for label propagation - #4534

Merged
JSONbored merged 1 commit into
mainfrom
fix/label-propagation-merge-close-race
Jul 9, 2026
Merged

fix(review): trust a linked issue closed by this PR's own merge for label propagation#4534
JSONbored merged 1 commit into
mainfrom
fix/label-propagation-merge-close-race

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Merging a PR with Closes #N auto-closes issue #N as an immediate side effect of the merge. resolveIssueLabelsForPropagation (src/review/linked-issue-label-propagation-fetch.ts) only trusted an open linked issue, so the next time the type-label decision ran for that PR (a near-simultaneous webhook, or the periodic sweep), it found the issue closed, propagation returned no labels, and the code fell back to a blunt title-regex guess — actively removing the correct gittensor:feature/gittensor:priority labels it had just applied seconds earlier and replacing them with gittensor:bug.
  • Extends the trust condition (isLinkedIssueTrustworthy) to also accept a closed issue when it was closed at or after this PR's own merge — i.e. closed as a byproduct of this exact PR's "Closes #N" merge, GitHub's standard auto-close. An issue closed before this PR merged still doesn't count, preserving the original anti-gaming intent (a PR can't borrow a label from some unrelated, already-resolved issue).
  • Adds closedAt to the linked-issue facts fetch (src/github/backfill.ts) — same REST payload, no new API call — and threads prMergedAt from the PR's own mergedAt through the propagation fetch call site (src/queue/processors.ts).

Closes #4528

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • 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.

Validation

  • git diff --check
  • npm run typecheck
  • Targeted unit/integration coverage: test/unit/backfill.test.ts, test/unit/linked-issue-label-propagation-fetch.test.ts, test/unit/linked-issue-hard-rules.test.ts, test/unit/queue.test.ts — 1175/1175 passing, including a full webhook-simulation regression test reproducing the exact PR feat(miner-manage-ui): fold run-state into the manage-status panel #4494 incident.
  • npm audit --audit-level=moderate — 0 vulnerabilities
  • New/changed behavior has unit/integration tests for new branches (open issue / closed-by-this-merge / closed-before-this-merge / closed-with-no-closed_at fallback) and a named regression test for the bug.
  • npm run actionlint, 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 — not run locally; this diff is scoped entirely to src/github/backfill.ts, src/review/linked-issue-label-propagation-fetch.ts, and src/queue/processors.ts (no UI/MCP/OpenAPI/wrangler/workers surface touched), so CI's full test:ci gate covers these.
  • npm run test:coverage (full unsharded) — kicked off locally but not confirmed complete before pushing; Codecov's codecov/patch check on this PR is the authoritative signal.

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.
  • No auth/cookie/CORS/GitHub App/Cloudflare/session changes.
  • No API/OpenAPI/MCP surface changed.
  • No UI changes.
  • No public docs/changelog changes needed.

Notes

Root-caused via a live-audit-log investigation: 87 real label downgrades across gittensory + metagraphed in a 49-hour window, 79 still wrong on GitHub at time of filing, 39 with the gittensor:priority reward multiplier permanently lost. Backfill of the currently-mislabeled PRs is a separate follow-up, tracked outside this PR.

…abel propagation (#4528)

Merging a PR with "Closes #N" auto-closes issue #N as an immediate side effect
of the merge, which defeated the propagation lookup's open-issue-only check
seconds later and stripped the just-applied gittensor:feature/priority labels
back down to a title-guessed gittensor:bug. Extends the trust condition to
accept a closed issue when it was closed at or after this PR's own merge,
while still rejecting an issue closed before the PR merged (the anti-gaming
case the open-only check originally existed to block).
@JSONbored JSONbored self-assigned this Jul 9, 2026
@JSONbored JSONbored added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 9, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@JSONbored
JSONbored merged commit 86eeea0 into main Jul 9, 2026
7 checks passed
@JSONbored
JSONbored deleted the fix/label-propagation-merge-close-race branch July 9, 2026 23:13
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.04%. Comparing base (23693c3) to head (4a390b0).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4534   +/-   ##
=======================================
  Coverage   94.04%   94.04%           
=======================================
  Files         422      422           
  Lines       37574    37579    +5     
  Branches    13724    13729    +5     
=======================================
+ Hits        35335    35340    +5     
  Misses       1583     1583           
  Partials      656      656           
Files with missing lines Coverage Δ
src/github/backfill.ts 97.07% <100.00%> (+<0.01%) ⬆️
src/queue/processors.ts 95.39% <100.00%> (+<0.01%) ⬆️
src/review/linked-issue-label-propagation-fetch.ts 100.00% <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.

fix(review): merging a PR strips its propagated gittensor:priority/feature labels

1 participant