refactor(queue): extract duplicate-cluster adjudication into its own module - #4823
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4823 +/- ##
=======================================
Coverage 94.24% 94.25%
=======================================
Files 445 446 +1
Lines 38880 38878 -2
Branches 14160 14160
=======================================
- Hits 36644 36643 -1
+ Misses 1577 1576 -1
Partials 659 659
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-11 02:55:38 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 5 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
…module Part of #4013's module-split sequence (step 3, after transient-locks.ts and signal-snapshot.ts): dupWinnerLinkedDuplicateCount, dupWinnerLinkedDuplicateWinnerNumber, reconcileLiveDuplicateSiblings, linkedIssueDuplicatePullRequestsForGate, and linkedIssueDuplicatePullRequestRecordsForGate move to src/queue/duplicate-detection.ts. Pure mechanical move, no behavior change -- a re-export shim keeps processors.ts's own internal callers and the existing test/unit/duplicate-winner.test.ts and test/unit/reconcile-live-duplicate-siblings.test.ts imports working unchanged.
cb3b6ad to
bc1ad90
Compare
Summary
src/queue/processors.ts. Step 3, aftertransient-locks.ts(refactor(queue): extract transient-lock primitives into their own module #4157) andsignal-snapshot.ts(refactor(queue): extract signal-snapshot generation into its own module #4820).src/queue/duplicate-detection.ts:dupWinnerLinkedDuplicateCount,dupWinnerLinkedDuplicateWinnerNumber,reconcileLiveDuplicateSiblings,linkedIssueDuplicatePullRequestsForGate,linkedIssueDuplicatePullRequestRecordsForGate. Pure mechanical move — no behavior change.processors.ts's own localgithubAdmissionKeyForTokenwrapper (used at ~13 other call sites there, so it stays put) is not imported back into the new file — that single call site instead uses the wrapper's own underlyinggithubRateLimitAdmissionKeyForToken(env, token, installationId)directly (a documented one-line arg-reorder with no logic of its own), keeping the dependency one-directional instead of making the two files circularly import each other.import { ... } from "./duplicate-detection"; export { ... } from "./duplicate-detection";) keeps this file's own internal callers andtest/unit/duplicate-winner.test.ts/test/unit/reconcile-live-duplicate-siblings.test.ts's existingimport { ... } from "../../src/queue/processors"working unchanged..catch(() => undefined)inreconcileLiveDuplicateSiblingswas flagged as newly-uncovered once isolated in its own small file (previously invisible insideprocessors.ts's overall coverage). Traced it to the source:fetchLivePullRequestState(src/github/backfill.ts) already catches its own errors internally and never rejects, so the wrapping.catchis provably unreachable defense-in-depth. Marked with/* v8 ignore next */, matching this file's own established convention for the same shape (e.g.processors.ts'sinvalidatePrStateCache(...).catch(() => undefined)at the webhook handler).Part of #4013 (more extraction steps remain in the sequence — not closing the tracking issue).
Test plan
npx tsc --noEmit -p .— zero errorsnpx vitest run test/unit test/integration— 695/696 files passed (1 skipped, pre-existing)npm run test:coverage(unsharded) — 94.43% statements / 93.4% branches / 93.6% functions / 95.02% lines, no threshold failures;duplicate-detection.tsitself is 100% line + branch + function coverednpm run docs:drift-check,npm run manifest:drift-check,npm run engine-parity:drift-check— all oknpm audit --audit-level=moderate— 0 vulnerabilities