feat(miner-foundation): extract duplicate-winner adjudication into gittensory-engine (#2278) - #3870
Conversation
…ttensory-engine (JSONbored#2278) Ports the duplicate-cluster election logic (isDuplicateClusterWinner, isDuplicateClusterWinnerByClaim, resolveDuplicateClusterWinnerNumber) into packages/gittensory-engine/src/duplicate-winner.ts so the maintainer gate and the miner's own soft-claim adjudication share one versioned election rule instead of drifting apart. src/signals/duplicate-winner.ts is now a thin re-export shim; the existing 41-test suite passes unmodified against it. Adds a dedicated engine-package test file mirroring the package's own node:test convention.
|
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 #3870 +/- ##
=======================================
Coverage 93.53% 93.53%
=======================================
Files 336 336
Lines 33281 33281
Branches 12175 12175
=======================================
Hits 31128 31128
Misses 1528 1528
Partials 625 625
🚀 New features to boost your workflow:
|
…urce path CI's fresh npm ci does not link @jsonbored/gittensory-engine into root node_modules since root package.json never declares it as a dependency (matching the JSONbored#2282 scoring-preview extraction, which deliberately avoids that edge by importing the engine module via its relative source path instead of the published package specifier). Switches the shim to the same pattern so typecheck and ui:build resolve the module on a clean checkout instead of only via a locally stale workspace symlink.
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-06 21:51:44 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 4 non-blocking
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.
|
Summary
isDuplicateClusterWinner,isDuplicateClusterWinnerByClaim,resolveDuplicateClusterWinnerNumber,DuplicateClaimMember) fromsrc/signals/duplicate-winner.tsintopackages/gittensory-engine/src/duplicate-winner.ts, following the same extraction pattern already established by feat(miner-foundation): extract scoring preview/model into gittensory-engine (#2282) #3849 (scoring preview/model) and otherminer-foundationengine extractions.src/signals/duplicate-winner.tsis now a thin re-export shim over@jsonbored/gittensory-engine, so the maintainer gate and the miner's own soft-claim adjudication (a later Phase-0 issue) share one versioned election rule instead of drifting apart.test/unit/duplicate-winner.test.ts) passes unmodified against the new shim.packages/gittensory-engine/test/duplicate-winner.test.ts, mirroring the engine package's ownnode:testconvention, covering the barrel re-export and the full election-order logic (claim-time precedence, PR-number tie-break, fail-closed on missing/invalid timestamps,createdAtprecedence,resolveDuplicateClusterWinnerNumber's winner/loser/empty/null cases).package.jsonchange needed: like feat(miner-foundation): extract scoring preview/model into gittensory-engine (#2282) #3849, rootsrc/resolves@jsonbored/gittensory-enginethrough the existing npm workspace symlink without adding it as an explicit dependency.Closes #2278
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥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:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
test/unit/duplicate-winner.test.ts(41/41) andtest/unit/queue.test.ts(606/606, the heaviest consumer of this module viasrc/queue/processors.ts) pass in full. The unshardednpm run test:coveragerun surfaces 95 pre-existing failures across 35 files (e.g.selfhost-image-deploy.test.ts,workflow-runner-labels.test.ts) that are local-Windows-only artifacts (CRLF checkout line endings, Windows shell/Docker-CLI behavior differences) — verified by reproducing them identically on the commit immediately before this one, before any of this PR's changes existed. None touchduplicate-winner,signals,queue, or the engine package.npm run test:mcp-pack,npm run ui:lint,npm run ui:typecheck,npm run ui:buildfail locally for the same reason (WindowsspawnSync("npm", ...)PATH resolution withoutshell: true, and repo-wide CRLF-vs-LF prettier/eslint noise acrossapps/gittensory-ui/**) — none of which this PR touches. These run on Linux in CI where the underlying scripts resolve normally.src/signals/duplicate-winner.tsis now a pure re-export with 0 coverable lines/branches percoverage/lcov.info, so it trivially satisfiescodecov/patch. The new logic inpackages/gittensory-engine/src/duplicate-winner.tsis outsidesrc/**and therefore outside the Codecov patch-coverage scope (pervitest.config.ts'scoverage.include), but is fully covered by the new dedicated engine-package test file regardless.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots. (N/A — no visible UI changes.)Notes
feat(miner-foundation): extract scoring preview/model into gittensory-engine (#2282)): pure logic moves intopackages/gittensory-engine/src/, the originalsrc/module becomes a re-export shim, and the pre-existing test suite is left unmodified to prove behavioral equivalence.