Skip to content

Commit 2347f2b

Browse files
fix(ui): stop workflowHeadline contradicting the Accepted pill when accepted-but-not-ready (#7549)
workflowHeadline derives its copy from the bucket-derived overallState plus readiness.ready (an independent API-side signal). When every workflow bucket is clear (state "accepted") but readiness.ready is false, it skipped the accepted branch and fell through to the generic "Needs cleanup — some areas ... require maintainer follow-up" default — contradicting the "Accepted" pill rendered from the same overallState, and implying an actionable bucket item exists when none does. Add an explicit state === "accepted" && !ready branch with truthful copy (buckets clear, an out-of-bucket readiness check still blocking). The not_ready and needs_cleanup branches are unchanged. Export the function and add registration-workspace.test.ts (previously untested) covering all four cases. Closes #7535 Co-authored-by: jaytbarimbao-collab <300663773+jaytbarimbao-collab@users.noreply.github.com>
1 parent 032ffb5 commit 2347f2b

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { describe, expect, it } from "vitest";
2+
3+
import { workflowHeadline } from "@/lib/registration-workspace";
4+
5+
describe("workflowHeadline (#7535)", () => {
6+
it("reports Accepted when the buckets are clear and readiness is ready", () => {
7+
expect(workflowHeadline("accepted", true)).toBe(
8+
"Accepted — contributor intake posture matches the recommended registration mode.",
9+
);
10+
});
11+
12+
it("does not contradict the Accepted pill when accepted but readiness is false", () => {
13+
// overallState is "accepted" (every bucket clear) so the pill above the headline reads "Accepted";
14+
// the headline must not fall through to the generic "Needs cleanup" copy, which would both contradict
15+
// the pill and imply an actionable bucket item exists when none does.
16+
const headline = workflowHeadline("accepted", false);
17+
expect(headline).toBe(
18+
"Accepted — the workflow buckets are all clear, but an overall readiness check outside them is still blocking; resolve it before scaling intake.",
19+
);
20+
expect(headline.startsWith("Accepted")).toBe(true);
21+
expect(headline).not.toContain("Needs cleanup");
22+
});
23+
24+
it("reports Not ready for the not_ready state regardless of readiness", () => {
25+
const expected =
26+
"Not ready — resolve blockers in the workflow buckets before inviting more contributors.";
27+
expect(workflowHeadline("not_ready", false)).toBe(expected);
28+
expect(workflowHeadline("not_ready", true)).toBe(expected);
29+
});
30+
31+
it("reports Needs cleanup only for the needs_cleanup state", () => {
32+
const expected =
33+
"Needs cleanup — some areas are acceptable but require maintainer follow-up before scaling intake.";
34+
expect(workflowHeadline("needs_cleanup", false)).toBe(expected);
35+
expect(workflowHeadline("needs_cleanup", true)).toBe(expected);
36+
});
37+
});

apps/loopover-ui/src/lib/registration-workspace.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,10 +661,17 @@ function workflowRank(state: OwnerWorkflowState): number {
661661
return 2;
662662
}
663663

664-
function workflowHeadline(state: OwnerWorkflowState, ready: boolean): string {
664+
export function workflowHeadline(state: OwnerWorkflowState, ready: boolean): string {
665665
if (state === "accepted" && ready) {
666666
return "Accepted — contributor intake posture matches the recommended registration mode.";
667667
}
668+
// #7535: `state` is bucket-derived (every bucket "accepted"), while `ready` (readiness.ready) is an
669+
// independent API-side signal. When the buckets are all clear but readiness is still false there is no
670+
// actionable bucket item, so falling through to the generic "needs cleanup — some areas require follow-up"
671+
// default contradicts the "Accepted" pill rendered from the same overallState. Say so truthfully instead.
672+
if (state === "accepted" && !ready) {
673+
return "Accepted — the workflow buckets are all clear, but an overall readiness check outside them is still blocking; resolve it before scaling intake.";
674+
}
668675
if (state === "not_ready") {
669676
return "Not ready — resolve blockers in the workflow buckets before inviting more contributors.";
670677
}

0 commit comments

Comments
 (0)