Skip to content

fix(miner): carry assignees through normalizeCandidate in opportunity-ranker - #9343

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
jeffrey701:fix-9330-ranked-assignees
Jul 27, 2026
Merged

fix(miner): carry assignees through normalizeCandidate in opportunity-ranker#9343
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
jeffrey701:fix-9330-ranked-assignees

Conversation

@jeffrey701

Copy link
Copy Markdown
Contributor

What

RankedCandidateIssue = RawCandidateIssue & {...score fields} in
packages/loopover-miner/lib/opportunity-ranker.ts, and RawCandidateIssue carries
assignees: string[] (populated by normalizeIssue/assigneeLogins in opportunity-fanout.ts,
#7040). But normalizeCandidate re-copied every other field onto its return object — owner,
repo, repoFullName, issueNumber, title, labels, commentsCount, createdAt, updatedAt,
htmlUrl, aiPolicyAllowed, aiPolicySource — and silently dropped assignees. So discover --json's
result.ranked (and options.onResult's payload) omitted a field the RankedCandidateIssue type
promises. The pre-ranking exclusion filter isn't affected — it runs on raw fan-out candidates — but
consumers of the ranked output lose the field.

Change

normalizeCandidate now copies assignees, validated exactly the way the sibling labels field is
(array-of-strings, defaulting to [] when missing or malformed). No .trim() — the producer
(assigneeLogins) already emits clean GitHub logins filtered to length > 0, so the check mirrors
that (typeof assignee === "string" && assignee.length > 0). No other field's normalization,
RawCandidateIssue, RankedCandidateIssue, or normalizeIssue is touched.

Validation

Two new tests in test/unit/miner-opportunity-ranker.test.ts:

  • a candidate with a populated assignees array survives rankCandidateIssues with assignees
    present and correct in the ranked output;
  • missing (undefined), non-array ("not-an-array"), and mixed-invalid ([42, "", "keep"])
    assignees fields normalize to [] / ["keep"] rather than throwing or propagating invalid values
    — exercising both sides of the Array.isArray guard and both operands of the filter predicate.

npx vitest run test/unit/miner-opportunity-ranker.test.ts → 22 pass. Every changed line and branch
is covered.

Closes #9330

@jeffrey701
jeffrey701 requested a review from JSONbored as a code owner July 27, 2026 13:29
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.40%. Comparing base (1227894) to head (d3a7359).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9343      +/-   ##
==========================================
+ Coverage   75.38%   75.40%   +0.02%     
==========================================
  Files         275      276       +1     
  Lines       58023    58082      +59     
  Branches     6181     6205      +24     
==========================================
+ Hits        43739    43798      +59     
  Misses      14014    14014              
  Partials      270      270              
Flag Coverage Δ
backend 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-miner/lib/opportunity-ranker.ts 100.00% <100.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 27, 2026
@loopover-orb

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-27 13:39:01 UTC

2 files · 1 AI reviewer · no blockers · readiness 95/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

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 — 3 non-blocking
  • opportunity-ranker.ts's `assignees` filter doesn't trim whitespace-only strings the way `labels` does, so a stray `" "` entry from a non-conforming producer would survive as `[" "]` instead of being dropped — low risk given the documented upstream guarantee, but worth a one-line comment reference to that trust boundary if the producer ever changes.
  • The inline comment at opportunity-ranker.ts (`// ams: opportunity-ranker silently drops assignees despite RankedCandidateIssue's type promising it #9330: ...`) is fairly long for a single field; could be trimmed to one line since the rationale is already in the PR description.
  • Consider asserting in the discovery-index-contract.ts cross-check (or a shared test) that `normalizeCandidate` and `normalizeDiscoveryIndexCandidate` stay in sync on `assignees` handling, since the two implementations duplicate the same validation logic independently.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9330
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 83 registered-repo PR(s), 38 merged, 17 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jeffrey701; Gittensor profile; 83 PR(s), 17 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
normalizeCandidate now copies and validates assignees using the same array-of-strings pattern as labels, defaulting to [] on missing/malformed input, and new tests cover both a populated-assignees case and missing/malformed cases including mixed-invalid arrays.

Review context
  • Author: jeffrey701
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Rust, TypeScript, Clojure, JavaScript
  • Official Gittensor activity: 83 PR(s), 17 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
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.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ams: opportunity-ranker silently drops assignees despite RankedCandidateIssue's type promising it

1 participant