Skip to content

fix(review): fail closed on sparse duplicate claims - #1843

Merged
JSONbored merged 1 commit into
mainfrom
codex/assess-and-propose-fix-for-duplicate-claim-issue
Jun 30, 2026
Merged

fix(review): fail closed on sparse duplicate claims#1843
JSONbored merged 1 commit into
mainfrom
codex/assess-and-propose-fix-for-duplicate-claim-issue

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • Prevent sparse or invalid linkedIssueClaimedAt metadata from arbitrarily electing a low-number PR as the duplicate-winner via PR-number fallback, which can suppress duplicate evidence and alter gate/agent outcomes.
  • Preserve integrity of duplicate-gate decisions by treating unknown/invalid claim-time ordering as a fail-closed condition so duplicate findings remain visible until claim-time ordering is known.

Description

  • Change isDuplicateClusterWinnerByClaim so a null or unparsable linkedIssueClaimedAt on the subject PR or any open sibling returns false (fail closed) instead of falling back to isDuplicateClusterWinner by PR number, leaving tie-by-claim behavior intact for equal-known timestamps. (file: src/signals/duplicate-winner.ts)
  • Update related call sites and explanatory comments to reflect that sparse legacy rows now fail closed, including advisory generation, agent maintenance wiring, and public panel text. (files: src/rules/advisory.ts, src/queue/processors.ts, src/signals/engine.ts)
  • Refresh unit tests in test/unit/duplicate-winner.test.ts to assert that missing or invalid claim timestamps cause the cluster election to fail closed while preserving PR-number tie-break behavior for equal known timestamps.

Testing

  • Ran targeted unit tests with vitest: test/unit/duplicate-winner.test.ts, test/unit/rules.test.ts, and test/unit/agent-actions.test.ts (pattern "dup-winner|duplicate risk|duplicate cause") and the selected tests passed.
  • Ran typecheck with npm run typecheck which completed successfully.
  • Attempted npm run test:coverage and npm audit --audit-level=moderate in this environment, but the full coverage run did not complete due to unrelated long-running test shards/timeouts and npm audit returned 403 Forbidden from the registry; these are environmental and unrelated to the focused unit/regression tests exercised above.

Codex Task

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.62%. Comparing base (0924f23) to head (6148fad).
⚠️ Report is 18 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1843   +/-   ##
=======================================
  Coverage   95.62%   95.62%           
=======================================
  Files         214      214           
  Lines       23274    23274           
  Branches     8402     8404    +2     
=======================================
  Hits        22255    22255           
  Misses        422      422           
  Partials      597      597           
Files with missing lines Coverage Δ
src/queue/processors.ts 88.27% <ø> (ø)
src/rules/advisory.ts 97.64% <ø> (ø)
src/signals/duplicate-winner.ts 100.00% <100.00%> (ø)
src/signals/engine.ts 97.34% <ø> (ø)
🚀 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 30, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-06-30 08:30:30 UTC

5 files · 1 AI reviewer · no blockers · readiness 80/100 · CI green · unknown

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
The change makes duplicate-cluster winner election fail closed whenever the subject PR or any open sibling has missing/unparseable claim timing, and the visible call-site comment updates match that behavior. The core comparison still preserves the known-timestamp ordering and PR-number tie-break for equal known timestamps, so the changed logic is internally consistent. The notable remaining issue is documentation drift in the provided current context for the feature flag description, not a runtime defect in this diff.

Nits — 3 non-blocking
  • nit: src/env.d.ts still documents GITTENSORY_DUPLICATE_WINNER as selecting the lowest open PR number, but this diff relies on earliest known linked-issue claim timing and fail-closed sparse rows.
  • Update the GITTENSORY_DUPLICATE_WINNER comment in src/env.d.ts to match src/signals/duplicate-winner.ts, including the fail-closed behavior for missing or invalid linkedIssueClaimedAt values.
  • 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 ✅ No-issue rationale PR body explains why no issue is linked.
Related work ⚠️ 1 scoped overlap Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (size label size:S; 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, 273 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 2 PR(s), 273 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), 273 issue(s).
  • Related work: Titles/paths share 6 meaningful terms. (PR #1818)
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Review top overlaps.
  • Add a concise scope and risk note.
  • No action.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
  • Check active issues and PRs before submitting.
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

@loopover-orb loopover-orb Bot added gittensor gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. labels Jun 30, 2026
@JSONbored
JSONbored merged commit f28fb9d into main Jun 30, 2026
17 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 30, 2026
@JSONbored
JSONbored deleted the codex/assess-and-propose-fix-for-duplicate-claim-issue branch June 30, 2026 08:09
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