Skip to content

feat(miner-extension): add read-only issue-page opportunity badge - #4568

Merged
loopover-orb[bot] merged 4 commits into
JSONbored:mainfrom
RealDiligent:feat/miner-extension-opportunity-badge-4308
Jul 10, 2026
Merged

feat(miner-extension): add read-only issue-page opportunity badge#4568
loopover-orb[bot] merged 4 commits into
JSONbored:mainfrom
RealDiligent:feat/miner-extension-opportunity-badge-4308

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Adds a read-only GitHub issue-page opportunity badge to apps/gittensory-miner-extension/, surfacing tier/score plus a short why from pre-ranked miner candidates.
  • Background looks up chrome.storage.local.rankedCandidates via the same repo#issue key as opportunity-ranker.js; badge helper is a classic content script (no top-level export) shared with the module background worker through globalThis.
  • Omits the badge when the repo is unwatched or no ranked signal exists; includes regression tests wired to real rankCandidateIssues output and a guard that the shippable badge script has no ESM export syntax.

Supersedes #4559 (auto-closed after fixing the content-script export blocker).

Closes #4308

Test plan

  • npx vitest run test/unit/miner-extension-content.test.ts
  • CI green on upstream PR

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 10, 2026 04:02
@superagent-security

Copy link
Copy Markdown
Contributor

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

RealDiligent and others added 4 commits July 10, 2026 12:06
Surface pre-ranked miner opportunity signals on GitHub issue pages via cached ranked candidates, with tier/score/why formatting and graceful omission when no signal is available. Builds on the miner extension scaffold.

Co-authored-by: Cursor <cursoragent@cursor.com>
… tests

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Drop ESM exports from the manifest-loaded badge helper so MV3 content scripts parse in Chrome, share logic via globalThis for the module background worker, and add a regression test that the shippable file has no export syntax.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.10%. Comparing base (ae70406) to head (63c0df4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4568   +/-   ##
=======================================
  Coverage   94.10%   94.10%           
=======================================
  Files         427      427           
  Lines       38022    38022           
  Branches    13877    13877           
=======================================
  Hits        35779    35779           
  Misses       1586     1586           
  Partials      657      657           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

loopover-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-10 04:19:05 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This wires a real read-only opportunity badge into the miner extension: opportunity-badge.js is shared via globalThis between the module background worker and the classic content script (verified safe under the manifest's declared load order and module type), the badge is correctly omitted when unwatched or signal-less, and output is HTML-escaped consistently with the existing gittensory-extension pattern. Tests drive the actual rankCandidateIssues output rather than a fabricated payload, which is the right approach. The only real gaps are advisory: thin branch coverage on the multi-reason 'why' builder and an unused discoveryIndexUrl field shipped ahead of any reader.

Nits — 5 non-blocking
  • opportunity-badge.js:29-33 — buildOpportunityWhy's five independent threshold branches (laneFit/freshness/potential/feasibility/dupRisk) and the no-reasons fallback are only exercised in aggregate (why.length > 0); add cases that pin an individual reason string when its threshold is crossed, and one that hits the 'Balanced opportunity signals' fallback.
  • opportunity-badge.js:22-33 — tier and reason thresholds (0.75, 0.5, 0.7, 0.3) are unexplained magic numbers; consider named constants (e.g. HIGH_TIER_MIN, REASON_THRESHOLD, LOW_DUP_RISK_MAX) so the intent behind each cutoff is legible without cross-referencing the ranker.
  • options.js/options.html — discoveryIndexUrl is saved to chrome.storage.sync but has no reader in this PR (README admits 'it is not read yet'); consider holding it for the follow-up issue that consumes it so this PR stays scoped to the badge.
  • opportunity-badge.js's escapeOpportunityHtml/renderOpportunityBadgeMarkup duplicate the same-shaped helpers in apps/gittensory-extension/content.js; likely fine given the two apps are intentionally separate products, but worth a one-line note if a shared util ever gets extracted.
  • Add targeted unit tests for each buildOpportunityWhy branch and the fallback (opportunity-badge.js:29-34).
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #4308
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: 314 registered-repo PR(s), 128 merged, 19 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 314 PR(s), 19 issue(s).
Gate result ✅ Passing No configured blocker found.
Linked issue satisfaction

Addressed
The PR adds a read-only content-script badge on GitHub issue pages that mounts via the existing DOM-mount pattern, sources its score/tier/why from ranked-candidate data compatible with rankCandidateIssues (validated in tests against the real function), takes no write actions, and cleanly omits itself when the repo is unwatched or no ranked entry exists.

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 314 PR(s), 19 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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.
Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before / after /
/ mobile before / (mobile) after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

🟩 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

@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.

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

@loopover-orb
loopover-orb Bot merged commit 3f23c61 into JSONbored:main Jul 10, 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 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(miner-extension): add read-only issue-page opportunity badge

1 participant