Skip to content

feat(engine): add pickTopRankedOpportunities ranker helper#3328

Merged
gittensory-orb[bot] merged 3 commits into
JSONbored:mainfrom
kiannidev:feat/engine-pick-top-ranked-opportunities
Jul 5, 2026
Merged

feat(engine): add pickTopRankedOpportunities ranker helper#3328
gittensory-orb[bot] merged 3 commits into
JSONbored:mainfrom
kiannidev:feat/engine-pick-top-ranked-opportunities

Conversation

@kiannidev

Copy link
Copy Markdown
Contributor

Summary

  • Add pickTopRankedOpportunities(candidates, limit) to @jsonbored/gittensory-engine: ranks with the existing rankOpportunities ordering/tie-break rules, then returns the top N entries.
  • Non-finite or negative limits fail closed to an empty list; limit is truncated to a non-negative integer.
  • Export from the package barrel for miner/tool callers that need capped discovery output.

Why no linked issue

Small, self-contained engine helper — avoids every caller re-slicing rankOpportunities and 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-cover reports 100% patch coverage on the ranker diff.

Test plan

  • npm run build --workspace @jsonbored/gittensory-engine
  • npm run build:miner
  • npx vitest run test/unit/opportunity-ranker.test.ts (52 tests)
  • Typecheck fix: restored OpportunityRankInput import in ranker test
  • diff-cover coverage/lcov.info --compare-branch=main --fail-under=99 → 100%
  • CI validate / validate-code / codecov patch+project / orb review agent

Made with Cursor

kiannidev and others added 3 commits July 5, 2026 04:47
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>
@kiannidev kiannidev requested a review from JSONbored as a code owner July 5, 2026 03:00
@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@gittensory-orb gittensory-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 1.25x multiplier. label Jul 5, 2026
@gittensory-orb

gittensory-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-05 03:05:00 UTC

4 files · 1 AI reviewer · no blockers · readiness 55/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
The AI review returned non-blocking notes for this change but did not include a separate narrative summary. Review the nits below before deciding this PR.

Nits — 5 non-blocking
  • nit: test/unit/opportunity-ranker.test.ts:179 covers zero, negative, NaN, and positive infinity limits, but it does not pin the documented fractional truncation behavior such as limit 2.9 returning exactly two entries.
  • nit: packages/gittensory-engine/test/opportunity-ranker.test.ts:118 only checks non-finite limits against NaN and positive infinity; adding negative infinity would make the dist-level contract match the fail-closed wording more completely.
  • Add a focused assertion in test/unit/opportunity-ranker.test.ts:179 for pickTopRankedOpportunities(candidates, 2.9) returning the same two entries as limit 2.
  • Add Number.NEGATIVE_INFINITY to the non-finite limit checks in packages/gittensory-engine/test/opportunity-ranker.test.ts:118.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (no linked issue context).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 1313 registered-repo PR(s), 629 merged, 49 issue(s).
Contributor context ✅ Confirmed Gittensor contributor kiannidev; Gittensor profile; 1313 PR(s), 49 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: kiannidev
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: TypeScript, MDX, C++, HTML, Rust
  • Official Gittensor activity: 1313 PR(s), 49 issue(s).
  • Related work: Titles/paths share 10 meaningful terms. (issue #2276, issue #2281)
  • Related work: Titles/paths share 8 meaningful terms. (issue #2276, issue #2287)
  • Related work: Titles/paths share 8 meaningful terms. (issue #2287, issue #2281)
Contributor next steps
  • Explain no-issue PR.
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
  • 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

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.87%. Comparing base (b4727d5) to head (9b5a693).
⚠️ Report is 3 commits behind head on main.

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           
Files with missing lines Coverage Δ
...ckages/gittensory-engine/src/opportunity-ranker.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gittensory-orb gittensory-orb Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@gittensory-orb gittensory-orb Bot merged commit 654546c into JSONbored:main Jul 5, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 1.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant