Skip to content

test(miner-extension): bring the browser extension under a real coverage gate (#4865) - #5642

Closed
andriypolanski wants to merge 1 commit into
JSONbored:mainfrom
andriypolanski:test/miner-extension-coverage-gate-4865
Closed

test(miner-extension): bring the browser extension under a real coverage gate (#4865)#5642
andriypolanski wants to merge 1 commit into
JSONbored:mainfrom
andriypolanski:test/miner-extension-coverage-gate-4865

Conversation

@andriypolanski

@andriypolanski andriypolanski commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Closes #4865

Summary

  • apps/gittensory-miner-extension was excluded from Codecov via the blanket apps/** ignore, and its existing root test/unit/miner-*.test.ts suites run source through a node:vm harness that v8 cannot attribute coverage to.
  • This PR completes the extension half of Bring the miner-ui and extension under a coverage gate #4865. The miner-ui half already shipped on main in test(miner-ui): bring the miner-ui under a real coverage gate #5613 (apps/gittensory-miner-ui/vitest.config.ts + npm test --coverage).
  • Adds an app-local, import-based vitest suite that imports background.js, opportunity-badge.js, and toolbar-badge.js directly (via the existing __GITTENSORY_MINER_EXTENSION_TEST__ hook) so v8 attributes real coverage, with measured baseline thresholds enforced by npm test.

Change

  • apps/gittensory-miner-extension/vitest.config.ts — v8 coverage scoped to the three covered source files; thresholds set at a measured baseline (98/94/98/98) with buffer below the wired-day numbers.
  • apps/gittensory-miner-extension/test/ — 19 tests across:
    • toolbar-badge.test.ts — pure state map (computeToolbarBadge)
    • opportunity-badge.test.ts — lookup, formatting, markup escaping
    • background.test.ts — issue context, sync, message routing, toolbar badge wiring, alarms/lifecycle
  • apps/gittensory-miner-extension/package.jsontest script → vitest run --coverage; adds vitest devDependency.
  • package.jsonui:test now runs @jsonbored/gittensory-miner-extension run test.
  • test/unit/codecov-policy.test.ts — regression guard that both miner-ui and miner-extension have app-local coverage gates wired into ui:test.
  • README updates — document the gate and deferred scope in both miner apps.

Deferred scope (issue still open after merge)

Scope

Validation

  • git diff --check
  • npm run actionlint (not run — no .github/workflows/** changes)
  • npm run typecheck (not run — no src/** changes)
  • npm run test:coverage (full unsharded gate — run before push)
  • npm run test:workers (not run — no Workers pool changes)
  • npm run build:mcp / npm run test:mcp-pack (not run — no MCP changes)
  • npm run ui:openapi:check (not run — no OpenAPI changes)
  • npm run ui:lint / npm run ui:typecheck / npm run ui:build (run via npm run test:ci before push)
  • npm audit --audit-level=moderate
  • npm --workspace @jsonbored/gittensory-miner-extension run test — 19 passing; coverage 100% stmts / 95.79% branches / 100% funcs / 100% lines over configured floor
  • npm run test -- --run test/unit/codecov-policy.test.ts — 5 passing

If any required check was skipped, explain why:

  • Changes are under apps/** and test/** only — outside Codecov-measured src/** / lib/**, so no codecov/patch obligation. The new gate is the extension's own vitest threshold. Full npm run test:ci should still be run locally before push.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, PATs, private keys, trust scores, or private rankings exposed.
  • Public GitHub text unaffected — tests + config + docs only; no runtime behavior change.
  • Auth/cookie/CORS/session — n/a.
  • API/OpenAPI/MCP — n/a.
  • No visible UI or extension-behavior change.
  • No changelog edit.

UI Evidence

No visible UI or extension-behavior change. This PR only adds a test suite, coverage-gate config, ui:test wiring, and README notes — same as the miner-ui coverage-gate PR #5613. No screenshots required.

Notes

  • Root test/unit/miner-*.test.ts VM-based behavior tests are left in place; the new app-local suite's role is coverage instrumentation the VM harness structurally cannot provide.
  • Thresholds are a regression floor with buffer, not an aspirational target — raise per-PR as content.js/options.js get covered.

Files to commit

apps/gittensory-miner-extension/vitest.config.ts
apps/gittensory-miner-extension/test/helpers.ts
apps/gittensory-miner-extension/test/toolbar-badge.test.ts
apps/gittensory-miner-extension/test/opportunity-badge.test.ts
apps/gittensory-miner-extension/test/background.test.ts
apps/gittensory-miner-extension/package.json
apps/gittensory-miner-extension/README.md
apps/gittensory-miner-ui/README.md
package.json
package-lock.json
test/unit/codecov-policy.test.ts

@andriypolanski
andriypolanski marked this pull request as draft July 13, 2026 18:28
@superagent-security

Copy link
Copy Markdown
Contributor

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

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

loopover-orb Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 LoopOver review result - reject/close recommended

Review updated: 2026-07-13 18:36:25 UTC

11 files · 1 AI reviewer · 1 blocker · readiness 100/100 · CI green · clean

🛑 Suggested Action - Reject/Close

  • AI review could not be completed: The dual-model AI review did not return a usable verdict for this change.

Review summary
This PR adds an app-local, import-based vitest suite for the miner browser extension (background.js, opportunity-badge.js, toolbar-badge.js), wires coverage thresholds at a measured baseline, hooks it into ui:test, and adds a codecov-policy regression test that verifies both miner-ui and miner-extension gates are wired. The approach is sound: importing modules directly via the existing __GITTENSORY_MINER_EXTENSION_TEST__ hook is the correct fix for v8's inability to attribute coverage through the prior node:vm harness, and content.js/options.js are explicitly and reasonably deferred pending a jsdom mount harness. Tests look substantive (routing, storage normalization, alarm/lifecycle wiring, badge repaint logic) rather than fabricated, and CI is green.

Nits — 5 non-blocking
  • apps/gittensory-miner-extension/vitest.config.ts:16-19 — the 98/94/98/98 threshold numbers are only explained by a comment; consider stating the exact measured baseline percentages achieved in the PR description or a code comment so future readers can tell 'measured' from 'guessed' without re-running coverage locally.
  • apps/gittensory-miner-extension/test/helpers.ts is fairly large (195 lines) shared mock scaffolding — fine for now, but if content.js/options.js coverage lands later, consider whether this chrome mock builder needs factoring further rather than growing options indefinitely.
  • Confirm in a follow-up PR description or issue comment that the linked issue Bring the miner-ui and extension under a coverage gate #4865 will be fully closed only once content.js/options.js are covered, since the issue is currently only partially addressed per the external brief.
  • Consider adding a one-line note in the PR description on how the 98/94/98/98 baseline numbers were derived (i.e., 'ran with --coverage and set thresholds 1-2pts below actual') to preempt reviewer questions on those magic numbers.
  • AI review could not be completed — The gate is held for a human reviewer rather than passed automatically; it re-evaluates on the next update.

Why this is blocked

  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.
Signal Result Evidence
Code review ❌ 1 blocker 1 reviewer
Linked issue ✅ Linked #4865
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: 163 registered-repo PR(s), 106 merged, 28 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 163 PR(s), 28 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence. LLM value judgment: moderate — The PR closes the extension half of a real coverage-gate issue with a correct fix (import-based testing to get real v8 attribution) and non-trivial new test coverage, though it deliberately leaves content.js/options.js uncovered so the underlying issue isn't fully closed yet.
Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, JavaScript, Rust, Cuda, Kotlin, MDX, Scala
  • Official Gittensor activity: 163 PR(s), 28 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.
[BETA] Chat with Gittensory

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

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

Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands

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

  • Re-run LoopOver review

@andriypolanski
andriypolanski marked this pull request as ready for review July 13, 2026 18:34
@loopover-orb

loopover-orb Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (Linked issue overlaps another open PR; duplicate of another open PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 13, 2026
@andriypolanski
andriypolanski deleted the test/miner-extension-coverage-gate-4865 branch July 16, 2026 15:10
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.

Bring the miner-ui and extension under a coverage gate

2 participants