Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/loopover-ui/src/components/site/audit-feed-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,8 @@ export function skipReasonTone(reason: string): "ready" | "info" | "warn" | "deg
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";
// #8666: an unrecognized reason degrades to the neutral "info" tone (matching
// contributor-quality-table-model's `band` convention), not "ready" -- a green/healthy tone would imply a
// successful state for a value that is actually unclassified, since none of the enumerated reasons map to "ready".
return "info";
}
14 changes: 14 additions & 0 deletions apps/loopover-ui/src/components/site/audit-feed.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
normalizeSinceInput,
normalizeSkippedPrAuditExport,
pullRequestHref,
skipReasonTone,
} from "@/components/site/audit-feed-model";
import { AuditFeed } from "@/components/site/audit-feed";

Expand Down Expand Up @@ -62,6 +63,19 @@ describe("audit feed helpers", () => {
);
});

it("maps each enumerated skip reason to its tone and degrades an unrecognized reason to neutral 'info', not 'ready' (#8666)", () => {
expect(skipReasonTone("bot_author")).toBe("info");
expect(skipReasonTone("not_official_gittensor_miner")).toBe("info");
expect(skipReasonTone("surface_off")).toBe("warn");
expect(skipReasonTone("maintainer_author")).toBe("warn");
expect(skipReasonTone("miner_detection_unavailable")).toBe("degraded");
expect(skipReasonTone("missing_author")).toBe("degraded");
// An unrecognized/legacy reason must NOT read as a green "ready" (healthy) pill -- it degrades to the
// neutral "info" tone, matching contributor-quality-table-model's convention for unknown enum-like values.
expect(skipReasonTone("some_future_reason")).not.toBe("ready");
expect(skipReasonTone("some_future_reason")).toBe("info");
});

it("formats skip reasons and pull request links", () => {
expect(formatSkipReason("surface_off")).toBe("Surface off");
expect(formatSkipReason("legacy_skip_reason")).toBe("legacy skip reason");
Expand Down
Loading