Skip to content

fix(review): elect same-issue duplicate winners by claim time - #1765

Merged
JSONbored merged 1 commit into
mainfrom
codex/linked-issue-first-linker
Jun 30, 2026
Merged

fix(review): elect same-issue duplicate winners by claim time#1765
JSONbored merged 1 commit into
mainfrom
codex/linked-issue-first-linker

Conversation

@JSONbored

@JSONbored JSONbored commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Keep same-issue duplicate winner election claim-time first, with deterministic PR-number fallback when cached rows do not have usable claim metadata.
  • Hide duplicate-only same-issue related-work evidence for the elected winner while preserving mixed scoped-overlap context.
  • Thread duplicate-winner visibility through readiness scoring, public panels, collapsibles, and queue publication.

Why

Sparse migrated PR rows can lack linkedIssueClaimedAt. Treating any missing timestamp as a hard failure leaves every sibling duplicate-blocked until all cached rows are refreshed. The elected winner also should not keep showing the same-linked duplicate PR as blocking related-work evidence, but unrelated or mixed overlap context should remain visible for maintainers.

What changed

  • Fallback to legacy PR-number election when candidate or sibling claim timestamps are missing or invalid.
  • Centralize duplicate-winner related-work visibility in the signal engine.
  • Suppress same-issue duplicate-only clusters for elected winners without dropping mixed scoped-overlap clusters.
  • Add regression coverage for sparse claim metadata, invalid claim metadata, winner/loser public verdict parity, and retained mixed-overlap context.

Validation

  • npm run typecheck
  • npx vitest run test/unit/duplicate-winner.test.ts
  • npx vitest run test/unit/signals-coverage.test.ts -t "dup-winner"
  • npx vitest run test/unit/rules.test.ts -t "dup-winner"
  • npx vitest run test/unit/queue.test.ts -t "flag ON spares the lowest open sibling"
  • npx vitest run test/unit/unified-comment-parity.test.ts
  • npm run test:coverage
  • git diff --check

Notes

  • No schema, migration, generated API, or UI artifact changes.
  • LCOV changed-line sanity check showed no edited src/** line with zero hits or zero-hit branch records.

@dosubot dosubot Bot added the size:L label Jun 29, 2026
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.61%. Comparing base (4d79298) to head (84bd7d6).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1765   +/-   ##
=======================================
  Coverage   95.61%   95.61%           
=======================================
  Files         214      214           
  Lines       23233    23249   +16     
  Branches     8393     8397    +4     
=======================================
+ Hits        22214    22230   +16     
  Misses        422      422           
  Partials      597      597           
Files with missing lines Coverage Δ
src/queue/processors.ts 88.27% <100.00%> (+<0.01%) ⬆️
src/rules/advisory.ts 97.64% <ø> (ø)
src/signals/duplicate-winner.ts 100.00% <100.00%> (ø)
src/signals/engine.ts 97.34% <100.00%> (+0.02%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb

loopover-orb Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-06-30 01:38:02 UTC

6 files · 1 AI reviewer · no blockers · readiness 86/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
The change centralizes public duplicate-winner related-work filtering and updates claim-time election to fall back to PR-number ordering when sparse metadata is present. The visible production paths now thread the filtered duplicate list into readiness, panels, and comments, so the elected winner no longer gets the duplicate blocker while still retaining mixed related-work context. I do not see a reachable correctness break in the provided diff; the main remaining concern is test coverage around the new filtering helper and exact cluster reason matching.

Nits — 6 non-blocking
  • nit: src/signals/engine.ts:4538 uses regexes over human-readable `cluster.reason` strings to identify same-issue duplicate clusters, which is brittle if the producer wording changes; prefer a structured discriminator if one exists upstream, or add a comment tying these strings to the producer.
  • nit: test/unit/signals-coverage.test.ts:822 covers the public comment and panel path, but the new `reviewContextBody` / `publicSafeNextSteps` calls only get indirect coverage; add a focused assertion that the collapsible context and next-step scoring also suppress the winner's duplicate-only evidence.
  • nit: src/signals/duplicate-winner.ts:43 falls back to PR-number election as soon as any member has invalid claim metadata, so one malformed timestamp causes the whole cluster to ignore otherwise valid claim ordering; add a short inline comment or test naming that exact all-or-nothing fallback choice.
  • In `src/signals/engine.ts:4538`, replace the `cluster.reason` regex classification with a structured cluster property or a local helper shared with the collision producer so display-copy edits cannot change gate-visible behavior.
  • In `test/unit/signals-coverage.test.ts:822`, assert the public-safe collapsible output and next-step readiness path for an elected winner, since this PR added `duplicateWinnerEnabled` to those call sites.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
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 (size label size:L; no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 2 registered-repo PR(s), 2 merged, 263 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 2 PR(s), 263 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 2 PR(s), 263 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Triage stale or unlinked PRs.
  • No action.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
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.

🟩 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.

  • Re-run Gittensory review

@JSONbored
JSONbored force-pushed the codex/linked-issue-first-linker branch from ebd8d2d to 84bd7d6 Compare June 30, 2026 01:15
@JSONbored
JSONbored merged commit 8932e98 into main Jun 30, 2026
20 checks passed
@JSONbored
JSONbored deleted the codex/linked-issue-first-linker branch June 30, 2026 01:43
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 30, 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

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant