main ← kanban
merged 02:54PM - 21 Feb 26 UTC
## Summary
This PR adds a Kanban view to /workflow and extends workflow dis…covery with actionable board interactions, compatibility checks, admin visibility, stale-state recovery, and expanded test coverage.
Compared to main, this is primarily a discovery/list UX expansion plus transition/runtime hardening, while keeping permissioning aligned with core Discourse category behavior.
## New Features
### 1. List/Kanban toggle in workflow discovery
- Adds a Kanban / List toggle to the workflow quick-filter row.
- Toggle appears only when the current workflow list is scoped to exactly one Kanban-compatible workflow.
- Uses SPA query-param transitions (no hard page reload).
### 2. Kanban board rendering and actions
- Renders columns from workflow step positions.
- Renders cards from workflow topics grouped by current step.
- Cards are clickable and open the topic.
- Supports drag/drop transitions for legal target steps.
- Supports keyboard transitions on focused cards with ArrowLeft / ArrowRight.
- Legal drop targets are highlighted during drag.
- Illegal targets are cross-hatched and reject drops.
### 3. Kanban compatibility rules and admin visibility
- Workflow admin now displays whether a workflow is Kanban-compatible.
- Compatibility requires:
- one start step at position 1
- unique step positions
- valid step targets
- full reachability from the start step
- unique directed edge mapping per step pair (from_step -> to_step)
- Backward/cyclic paths are supported.
### 4. Workflow-level Kanban tag control
- Adds workflow setting show_kanban_tags (default true).
- Exposed in admin workflow editor.
- Kanban cards show/hide tags below title using core tag rendering.
### 5. Stale-state transition handling
- Stale/invalid transition attempts now return 409 Conflict.
- Error shown to users:
- Transition Failed: probably due to stale UI state - please try again after refresh - refreshing!
- Frontend refreshes after acknowledgment to re-sync state in both Kanban and topic-banner action flows.
### 6. Overdue refinements in this PR
- The overdue model itself already existed on main; this PR does not introduce a new overdue framework.
- Kanban cards now display the existing overdue state (workflow_overdue) with an overdue badge.
- After a successful Kanban transition, the in-memory card state clears overdue to avoid stale badge display before refresh.
- Existing list overdue behavior remains in place and is exercised alongside Kanban/list toggling specs.
### 7. Visual refinements
- Kanban lane borders use step category color (or parent category fallback).
- Lane header border radii updated so lane border colors remain visible.
- Column depth grows naturally with content (no capped board height).
- Step filter input aligned with button row (margin-bottom: 0).
## Technical Changes
- Added migration: db/migrate/20260221120000_add_show_kanban_tags_to_workflows.rb.
- Extended topic list serialization with Kanban metadata:
- compatibility
- workflow name
- show tags flag
- steps (including category color)
- transition map (from_position, to_position, option_slug)
- Added stale-transition 409 response behavior in workflow action controller.
- Added category association/preload usage for step color metadata.
- Added list-side permission check caching for workflow_can_act.
## Tests
- Added/updated request/model/serializer/system specs for:
- Kanban compatibility rules (including cycles and directed-edge uniqueness)
- Kanban metadata serialization and admin exposure
- drag/drop and keyboard transitions
- stale transition error + refresh behavior
- Kanban tag toggle
- category-colored lane rendering
- overdue indicator behavior in list/Kanban contexts
## Notes
- Kanban transitions reuse existing workflow actions (/discourse-workflow/act/:topic_id) for consistent backend behavior.
- Permission semantics remain unchanged from core-aligned workflow/category permissioning.