Skip to content

feat(engine): add rankOpportunitiesAtOrAboveScore helper#3334

Merged
gittensory-orb[bot] merged 1 commit into
JSONbored:mainfrom
kiannidev:feat/engine-rank-opportunities-min-score
Jul 5, 2026
Merged

feat(engine): add rankOpportunitiesAtOrAboveScore helper#3334
gittensory-orb[bot] merged 1 commit into
JSONbored:mainfrom
kiannidev:feat/engine-rank-opportunities-min-score

Conversation

@kiannidev

@kiannidev kiannidev commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add rankOpportunitiesAtOrAboveScore(candidates, minScore) to @jsonbored/gittensory-engine: ranks with rankOpportunities, then keeps only entries whose rankScore meets the threshold.
  • Non-finite thresholds fail closed to an empty list; finite thresholds clamp to [0, 1] before filtering.
  • Implemented in new ranked-opportunity-min-score.ts and exported from the package barrel.

Why no linked issue

Complements the merged ranker helpers (pickTopRankedOpportunities, pending pickTopMetadataOpportunities) — miners/tools can drop low-score discovery noise without reimplementing rank ordering or threshold sanitization.

Conflict avoidance

Touches only packages/gittensory-engine/src/ranked-opportunity-min-score.ts (new file), packages/gittensory-engine/src/index.ts (one export line after the ranker block), and test/unit/opportunity-ranker.test.ts. Does not overlap open PRs (#3331 metadata-top-pick, #3314 miner CLI, #3322/#3332/#3333 enrichment, #3315/#3255 queue, #3316 signals, #3304 review holds, grafana/docs).

Codecov patch

Vitest covers every branch (threshold filter, zero/one/clamped thresholds, non-finite input, empty candidates, barrel export). Local diff-cover reports 100% patch coverage on ranked-opportunity-min-score.ts.

Test plan

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

Filter ranked discovery candidates by a minimum score threshold with
finite-only input validation and stable rankOpportunities ordering.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kiannidev kiannidev requested a review from JSONbored as a code owner July 5, 2026 03:45
@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:50:16 UTC

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

⏸️ Suggested Action - Manual Review

Review summary
This adds a small public helper that composes the existing ranker with a sanitized minimum-score filter, and the implementation correctly delegates ordering and score computation to rankOpportunities. The new source, barrel export, Vitest coverage, and compiled-package node:test coverage line up with the stated contract, including fail-closed handling for non-finite thresholds and clamping for finite out-of-range values. I do not see a reachable correctness defect in the changed code.

Nits — 5 non-blocking
  • nit: packages/gittensory-engine/src/ranked-opportunity-min-score.ts:4 references {@​link rankOpportunityScore} without importing or exporting it from this module, so generated API docs may not resolve that link even though runtime code is fine.
  • nit: packages/gittensory-engine/src/ranked-opportunity-min-score.ts:10 could avoid the explicit empty-array branch because rankOpportunities([]).filter(...) already returns [], but keeping it is harmless.
  • packages/gittensory-engine/src/ranked-opportunity-min-score.ts:4: either import rankOpportunityScore as a type/doc-only symbol if the docs tool needs local link resolution, or change the sentence to reference rankOpportunities, which is already in scope.
  • packages/gittensory-engine/src/ranked-opportunity-min-score.ts:11: consider inlining the empty case through the existing rankOpportunities path unless you specifically want the early return for readability.
  • 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: 1334 registered-repo PR(s), 648 merged, 49 issue(s).
Contributor context ✅ Confirmed Gittensor contributor kiannidev; Gittensor profile; 1334 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: not available
  • Official Gittensor activity: 1334 PR(s), 49 issue(s).
  • Related work: Titles/paths share 10 meaningful terms. (issue #2038, issue #2040)
  • Related work: Titles/paths share 10 meaningful terms. (issue #2276, issue #2281)
  • Related work: Titles/paths share 5 meaningful terms. (issue #2025, issue #1514)
  • Additional title-only matches omitted; title-only overlap does not block.
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.88%. Comparing base (c556d78) to head (869e70f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3334   +/-   ##
=======================================
  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           
Files with missing lines Coverage Δ
...tensory-engine/src/ranked-opportunity-min-score.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 2508655 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