fix: show scheduled kanban tasks in dashboard

This commit is contained in:
roycepersonalassistant 2026-05-18 20:25:40 -07:00 committed by Teknium
parent a5c2836b07
commit 6c4f11c64a
3 changed files with 35 additions and 3 deletions

View file

@ -91,7 +91,7 @@ from toolsets import get_toolset_names
# Constants
# ---------------------------------------------------------------------------
VALID_STATUSES = {"triage", "todo", "ready", "running", "blocked", "done", "archived"}
VALID_STATUSES = {"triage", "todo", "scheduled", "ready", "running", "blocked", "done", "archived"}
VALID_WORKSPACE_KINDS = {"scratch", "worktree", "dir"}
KNOWN_TOOLSET_NAMES = frozenset(name.casefold() for name in get_toolset_names())
_IS_WINDOWS = sys.platform == "win32"

View file

@ -129,8 +129,14 @@ def _conn(board: Optional[str] = None):
# Columns shown by the dashboard, in left-to-right order. "archived" is
# available via a filter toggle rather than a visible column.
#
# Keep this in sync with kanban_db.VALID_STATUSES. In particular,
# ``scheduled`` is a first-class waiting column used for time-based follow-ups;
# if it is omitted here, the board-level fallback below mis-buckets scheduled
# tasks into ``todo`` and makes the dashboard look like the Scheduled column
# disappeared.
BOARD_COLUMNS: list[str] = [
"triage", "todo", "ready", "running", "blocked", "done",
"triage", "todo", "scheduled", "ready", "running", "blocked", "done",
]

View file

@ -70,7 +70,8 @@ def test_board_empty(client):
data = r.json()
# All canonical columns present (triage + the rest), each empty.
names = [c["name"] for c in data["columns"]]
for expected in ("triage", "todo", "ready", "running", "blocked", "done"):
assert set(names) == kb.VALID_STATUSES - {"archived"}
for expected in ("triage", "todo", "scheduled", "ready", "running", "blocked", "done"):
assert expected in names, f"missing column {expected}: {names}"
assert all(len(c["tasks"]) == 0 for c in data["columns"])
assert data["tenants"] == []
@ -113,6 +114,31 @@ def test_create_task_appears_on_board(client):
assert "researcher" in data["assignees"]
def test_scheduled_tasks_have_their_own_column_not_todo(client):
"""Scheduled/time-delay tasks must not be silently bucketed into todo."""
task = client.post(
"/api/plugins/kanban/tasks",
json={"title": "wait for indexed data", "assignee": "ops"},
).json()["task"]
conn = kb.connect()
try:
with kb.write_txn(conn):
conn.execute(
"UPDATE tasks SET status = 'scheduled' WHERE id = ?",
(task["id"],),
)
finally:
conn.close()
r = client.get("/api/plugins/kanban/board")
assert r.status_code == 200
columns = {c["name"]: c["tasks"] for c in r.json()["columns"]}
assert any(t["id"] == task["id"] for t in columns["scheduled"])
assert not any(t["id"] == task["id"] for t in columns["todo"])
def test_tenant_filter(client):
client.post("/api/plugins/kanban/tasks", json={"title": "A", "tenant": "t1"})
client.post("/api/plugins/kanban/tasks", json={"title": "B", "tenant": "t2"})