feat(engine): add pickTopRankedOpportunities ranker helper#3328
Conversation
Expose a pure top-N wrapper over rankOpportunities so miners and tools can cap discovery output without reimplementing ordering or tie-breaks. Co-authored-by: Cursor <cursoragent@cursor.com>
The pickTopRankedOpportunities change dropped the type import while OpportunityRankInput is still used by the ranker test helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-05 03:05:00 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 5 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.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3328 +/- ##
=======================================
Coverage 93.87% 93.87%
=======================================
Files 277 277
Lines 30518 30522 +4
Branches 11112 11114 +2
=======================================
+ Hits 28650 28654 +4
Misses 1211 1211
Partials 657 657
🚀 New features to boost your workflow:
|
Summary
pickTopRankedOpportunities(candidates, limit)to@jsonbored/gittensory-engine: ranks with the existingrankOpportunitiesordering/tie-break rules, then returns the top N entries.limitis truncated to a non-negative integer.Why no linked issue
Small, self-contained engine helper — avoids every caller re-slicing
rankOpportunitiesand duplicating limit sanitization. Pure data path; no CLI or hosted review wiring.Conflict avoidance
Touches only
packages/gittensory-engine/src/opportunity-ranker.ts,packages/gittensory-engine/src/index.ts(ranker export block), and ranker tests. Does not overlap open PRs touching miner CLI, enrichment analyzers,src/queue/processors, signals, or docs/grafana.Codecov patch
Vitest exercises every new branch (top-N slice, empty input, zero/negative/non-finite limits, tie-break preservation, barrel export). Local
diff-coverreports 100% patch coverage on the ranker diff.Test plan
npm run build --workspace @jsonbored/gittensory-enginenpm run build:minernpx vitest run test/unit/opportunity-ranker.test.ts(52 tests)OpportunityRankInputimport in ranker testdiff-cover coverage/lcov.info --compare-branch=main --fail-under=99→ 100%Made with Cursor