Skip to content

test(ui): cover miner-commands redaction and action branches (#8677) - #8716

Closed
andriypolanski wants to merge 1 commit into
JSONbored:mainfrom
andriypolanski:test/8677-miner-commands-coverage
Closed

test(ui): cover miner-commands redaction and action branches (#8677)#8716
andriypolanski wants to merge 1 commit into
JSONbored:mainfrom
andriypolanski:test/8677-miner-commands-coverage

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

  • Closes test(ui): miner-commands.ts's sensitive-term redaction logic has zero direct test coverage #8677
  • Adds apps/loopover-ui/src/lib/miner-commands.test.ts with direct coverage of sanitizeMinerCommand (each forbidden term=value category, passthrough, path redaction, no false-positive on bare login/repo tokens) and buildMinerCommandActions (setup/ready/needs_login/needs_repo branches, invalid login/repo fallbacks).
  • Exports sanitizeMinerCommand so the redaction contract can be regression-tested without going through miner-panel.
  • No visible UI change — UI Evidence N/A.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • vitest run src/lib/miner-commands.test.ts (from apps/loopover-ui) — 10 passed
  • Coverage for miner-commands.ts: 100% statements / branches / functions / lines
  • npm run test:coverage
  • npm run ui:test
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

Test-only change under apps/** (not Codecov-gated). Full test:ci / UI matrix left for the opener if desired before push; targeted vitest + coverage above satisfy the issue’s full-branch requirement.

UI Evidence

N/A — test-only; no visible UI/frontend change.

Notes for reviewers / gate

  • No secrets, wallets, hotkeys, trust scores, or reward values as live values — tests use dummy RHS placeholders solely to assert term=value redaction.
  • Does not touch site/, CNAME, **/lovable/**, or CHANGELOG.md.

…ed#8677)

Add a dedicated unit test for sanitizeMinerCommand and buildMinerCommandActions
so public-surface sensitive-term redaction cannot regress silently.

Co-authored-by: Cursor <cursoragent@cursor.com>
@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 26, 2026
@loopover-orb

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-26 00:35:46 UTC

2 files · 1 AI reviewer · no blockers · CI failing · blocked

🛑 Suggested Action - Fix Blockers

Review summary
This is a test-only PR that exports the previously private `sanitizeMinerCommand` function and adds direct unit coverage for it plus `buildMinerCommandActions`, closing #8677's stated gap (redaction logic previously had no direct coverage, only indirect coverage via miner-panel tests). The tests are well-targeted, cover each forbidden term=value category, path redaction, passthrough, and all state branches (ready/setup/needs_login/needs_repo) including invalid login/repo fallbacks, and the export itself is a minimal, correct change with no behavior alteration. The two CI failures (validate-code, validate) are undetailed and this branch is 4 commits behind default, which is the more likely explanation than a defect in this diff.

Nits — 4 non-blocking
  • The JSDoc comment added above `sanitizeMinerCommand` in miner-commands.ts:87 is fine but slightly redundant given the existing inline comment already explaining the assignment-required contract just below it.
  • Test file line miner-commands.test.ts:9-10 duplicates rationale already stated in the PR description; consider trimming to keep the test file itself terse.
  • Since `test/unit/miner-dashboard-commands.test.ts` already exercises `buildMinerCommandActions` end-to-end with realistic login/repo values, the new test file could note that relationship to clarify it's adding lower-level/direct coverage rather than duplicating intent.
  • Consider running the skipped `npm run ui:typecheck`/`ui:lint` before merge since the export changes a public API surface, even though this is test-only.

CI checks failing

  • validate
  • validate-code

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 #8677
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: 206 registered-repo PR(s), 130 merged, 22 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 206 PR(s), 22 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR adds a dedicated test file that directly imports and exercises sanitizeMinerCommand (exported for testability) and buildMinerCommandActions, covering each forbidden term category, a passthrough case, path redaction, and every branch (setup/ready/needs_login/needs_repo plus invalid-input fallbacks) as the issue required.

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: not available
  • Official Gittensor activity: 206 PR(s), 22 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.
🧪 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 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-code)). 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 26, 2026
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.

test(ui): miner-commands.ts's sensitive-term redaction logic has zero direct test coverage

2 participants