Skip to content
Open
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
21 changes: 21 additions & 0 deletions LifeOS/install/LIFEOS/PULSE/modules/work.columns.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Verifies that deriveColumn checks configured KANBAN_COLUMNS before applying
* LEGACY_STATUS_ALIASES, allowing custom columns matching raw statuses (e.g. Ready).
*
* Issue #2796
*/
import { describe, expect, test } from "bun:test";
import { deriveColumn } from "./work.ts";

const columnsWithReady = ["Triage", "Ready", "Queued", "Blocked", "In-Progress", "In-Review", "Complete"];
const defaultColumns = ["Queued", "Blocked", "In-Progress", "In-Review", "Complete"];

describe("deriveColumn", () => {
test("a configured column matching raw status takes precedence over legacy alias", () => {
expect(deriveColumn({ labels: ["Status:ready"], state: "OPEN" }, columnsWithReady)).toBe("Ready");
});

test("legacy aliases still apply when no configured column matches", () => {
expect(deriveColumn({ labels: ["Status:ready"], state: "OPEN" }, defaultColumns)).toBe("Queued");
});
});
5 changes: 2 additions & 3 deletions LifeOS/install/LIFEOS/PULSE/modules/work.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function issueSource(labels: string[]): "lifeos-sync" | "auto-native" | "auto-sw
return "manual";
}

function deriveColumn(issue: { labels: string[]; state: string }, columns: string[]): string {
export function deriveColumn(issue: { labels: string[]; state: string }, columns: string[]): string {
if (issue.state === "CLOSED") {
return columns.includes("Complete")
? "Complete"
Expand All @@ -140,8 +140,7 @@ function deriveColumn(issue: { labels: string[]; state: string }, columns: strin
if (label.startsWith("Status:")) {
const raw = label.slice("Status:".length).trim().toLowerCase();
const aliased = LEGACY_STATUS_ALIASES[raw];
const target = aliased ?? raw;
const hit = columns.find((c) => c.toLowerCase() === target.toLowerCase());
const hit = columns.find((c) => c.toLowerCase() === raw) ?? (aliased ? columns.find((c) => c.toLowerCase() === aliased.toLowerCase()) : undefined);
if (hit) return hit;
}
}
Expand Down