feat(engine): add pickTopMetadataOpportunities helper#3331
Conversation
Rank metadata discovery candidates and return the top N entries using rankMetadataOpportunities ordering. Lives in metadata-top-pick.ts so vitest patch coverage instruments every branch. Co-authored-by: Cursor <cursoragent@cursor.com>
|
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 #3331 +/- ##
=======================================
Coverage 93.87% 93.88%
=======================================
Files 277 278 +1
Lines 30522 30526 +4
Branches 11114 11116 +2
=======================================
+ Hits 28654 28658 +4
Misses 1211 1211
Partials 657 657
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-05 03:48:46 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 3 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
pickTopMetadataOpportunities(candidates, context, limit)to@jsonbored/gittensory-engine: ranks metadata discovery candidates viarankMetadataOpportunities, then returns the top N entries.limitis truncated to a non-negative integer.metadata-top-pick.ts(separate from the v8-ignored metadata heuristics module) and exported from the package barrel.Why no linked issue
Complements the merged
pickTopRankedOpportunitieshelper (#3328) for the metadata discovery path — miners fanning out issue metadata can cap results without re-slicing ranked output or reimplementing limit sanitization.Conflict avoidance
Touches only
packages/gittensory-engine/src/metadata-top-pick.ts(new file),packages/gittensory-engine/src/index.ts(one export line), andtest/unit/opportunity-metadata-signals.test.ts. No overlap with open PRs (#3314 miner CLI, #3322 enrichment, #3315/#3255 queue, #3316 signals, #3304 review holds, grafana/docs PRs).Codecov patch
Vitest covers every branch (top-N slice, miner-disabled filtering, zero/negative/non-finite limits, empty input, barrel export). Local
diff-coverreports 100% patch coverage onmetadata-top-pick.ts.Test plan
npm run build --workspace @jsonbored/gittensory-enginenpm run build:minernpx vitest run test/unit/opportunity-metadata-signals.test.ts(25 tests)diff-cover coverage/lcov.info --compare-branch=main --fail-under=99→ 100%