From 132e3a2780ff5d310f90b55b8ad286e5cf2cad09 Mon Sep 17 00:00:00 2001 From: RealDiligent Date: Sun, 26 Jul 2026 08:36:08 +0800 Subject: [PATCH] fix(ui): degrade an unrecognized skip reason to the neutral 'info' tone, not 'ready' audit-feed-model.ts's skipReasonTone fell back to 'ready' (a green, healthy-looking tone) for an unrecognized reason string. None of the four enumerated reasons map to 'ready' -- it existed solely as the unrecognized-value fallback, so a new or legacy backend skip reason silently rendered as a successful-looking pill. The sibling contributor-quality-table-model uses the neutral 'info' tone for the same unrecognized-enum-like-string situation; match that convention. Change the fallback to 'info'. The four enumerated reasons are unchanged. Adds a direct test asserting each enumerated reason's tone plus that an unrecognized reason returns 'info' (not 'ready'). --- .../src/components/site/audit-feed-model.ts | 5 ++++- .../src/components/site/audit-feed.test.tsx | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/loopover-ui/src/components/site/audit-feed-model.ts b/apps/loopover-ui/src/components/site/audit-feed-model.ts index 4efc4721c3..550143b2da 100644 --- a/apps/loopover-ui/src/components/site/audit-feed-model.ts +++ b/apps/loopover-ui/src/components/site/audit-feed-model.ts @@ -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"; } diff --git a/apps/loopover-ui/src/components/site/audit-feed.test.tsx b/apps/loopover-ui/src/components/site/audit-feed.test.tsx index 563d20bb0c..d26c4c2e0c 100644 --- a/apps/loopover-ui/src/components/site/audit-feed.test.tsx +++ b/apps/loopover-ui/src/components/site/audit-feed.test.tsx @@ -11,6 +11,7 @@ import { normalizeSinceInput, normalizeSkippedPrAuditExport, pullRequestHref, + skipReasonTone, } from "@/components/site/audit-feed-model"; import { AuditFeed } from "@/components/site/audit-feed"; @@ -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");