Skip to content

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

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

apps/loopover-ui/src/lib/miner-commands.ts (107 lines) has zero direct test coverage anywhere in
the repo. Its sole consumer, miner-panel.test.tsx, never exercises buildMinerCommandActions or
sanitizeMinerCommand directly. This module specifically redacts terms this repo's own house rules
forbid from ever reaching a public surface (wallet|hotkey|coldkey|mnemonic|trust score-shaped
patterns) — a security/compliance-relevant function with no regression protection at all. A future
refactor could silently break the redaction logic and no test would catch it.

Requirements

  • Add a dedicated test file for miner-commands.ts directly exercising buildMinerCommandActions
    and sanitizeMinerCommand, not relying on indirect coverage through miner-panel.test.tsx.
  • Cover, at minimum: a command containing each of the forbidden term categories (wallet, hotkey,
    coldkey, mnemonic, trust score — matching whatever exact pattern sanitizeMinerCommand uses), a
    command containing none of them (passthrough case), and buildMinerCommandActions's branch
    structure (every conditional path in the function).

Deliverables

  • A new dedicated test file directly tests sanitizeMinerCommand against each forbidden-term
    category it's designed to redact, asserting the sensitive term never appears in the output.
  • The same test file directly tests buildMinerCommandActions's full branch coverage.
  • A passthrough case confirms a command containing none of the forbidden terms is left
    unmodified (or handled per the function's actual documented contract).

All three Deliverables are required in the same PR.

Test Coverage Requirements

apps/** is excluded from codecov/patch gating, but apps/loopover-ui's own local vitest
coverage thresholds (branch-level) apply — this module currently has 0% direct coverage; the new
test file must bring both functions to full branch coverage.

Expected Outcome

miner-commands.ts's redaction logic — which exists specifically to keep forbidden sensitive terms
out of a public-facing surface — has direct, explicit regression-test coverage, so a future
refactor that weakens the redaction is caught immediately instead of silently shipping.

Links & Resources

  • apps/loopover-ui/src/lib/miner-commands.ts (the module to test)
  • apps/loopover-ui/src/components/site/app-panels/miner-panel.test.tsx (existing indirect-only
    coverage)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions