Skip to content

fix(ui): skipReasonTone's fallback for an unrecognized skip reason renders a misleading 'ready' (green) tone #8666

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/components/site/audit-feed-model.ts:124-129's skipReasonTone:

export function skipReasonTone(reason: string): "ready" | "info" | "warn" | "degraded" {
  if (reason === "bot_author" || reason === "not_official_gittensor_miner") return "info";
  if (reason === "surface_off" || reason === "maintainer_author") return "warn";
  if (reason === "miner_detection_unavailable" || reason === "missing_author") return "degraded";
  return "ready";
}

is never called in any test (confirmed by grep: zero references outside its own definition and its
one call site, audit-feed.tsx:275). None of the four enumerated reasons map to "ready" — it
exists solely as the fallback for an unrecognized reason string.

SkippedPrAuditItem.reason is typed as plain string (not a narrower union), the same intentional
API-boundary widening used by the sibling contributor-quality-table-model.ts's band: string
but that sibling model explicitly falls back to the neutral "info" tone for an unrecognized value
("an unrecognized value degrades to a neutral pill instead of a type error"). skipReasonTone
instead falls back to "ready" — a green, healthy-looking tone — for the exact same
unrecognized-value situation, implying a positive/successful state for something that is actually
unclassified. If the backend ever emits a new or legacy skip reason not in the current four
enumerated cases, the audit feed silently displays it as "ready" (green) rather than flagging it as
unrecognized, contrary to the established sibling convention in this same codebase.

Requirements

  • Change skipReasonTone's fallback branch from "ready" to the neutral "info" tone, matching
    contributor-quality-table-model.ts's established convention for an unrecognized enum-like string
    value.
  • Do not change behavior for any of the four already-enumerated, already-tested reason values.

Deliverables

  • skipReasonTone's fallback for an unrecognized reason string returns "info", not "ready".
  • A new test renders an audit-feed item with an unmapped/unrecognized reason string and asserts
    the resulting pill does NOT get the "ready" tone (asserts "info" instead).
  • Existing tests for the four enumerated reason values continue to pass unchanged.

All Deliverables above 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 apply — the new test must exercise skipReasonTone's fallback branch directly,
which currently has zero test coverage at all.

Expected Outcome

An unrecognized/legacy skip reason renders as a neutral pill, matching this codebase's established
convention for unclassified enum-like values (as already implemented in
contributor-quality-table-model.ts), instead of misleadingly appearing "ready"/healthy.

Links & Resources

  • apps/loopover-ui/src/components/site/audit-feed-model.ts:124-129 (skipReasonTone)
  • apps/loopover-ui/src/components/site/audit-feed.tsx:275 (the one call site)
  • contributor-quality-table-model.ts (band: string's fallback-to-neutral convention to mirror)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions