feat(workflow): issue routing is a control-plane setting edited in the dashboard (#1959)

Label to workflow rules and a default workflow are the intake-routes
resource: ordered, case-insensitive, first rule wins, seeded with bug to
tdd, feature to feasibility, default triage. A write naming an undefined
workflow or an empty label is refused. The daemon reads it through the
workflow definitions client when pinning a task and at intake.

The kind indirection only carried this routing, so it is removed: the
per-kind NATS subjects (every consumer already bound archie.task.>) are
one subject, the envelope and playbook triggers lose their kind, and
x-intake-routes is dropped. The dashboard gets an Issue routing page
under Automation; the trigger card reads the same setting.
This commit is contained in:
sam committed 2026-11-13 20:28:52 +11:00
1 parent ca4b039cb4
commit 41f44c43a1
28 files changed
+395 -234

No files matched your search

+8 -2
View File
@@ -20,9 +20,11 @@ import (
"github.com/samcharles93/archie-core/internal/events"
)
// workflowDefinitionSource supplies the active workflow definitions.
// workflowDefinitionSource supplies the active workflow definitions and the
// routes that send an issue to one by its labels.
type workflowDefinitionSource interface {
WorkflowDefinitions(context.Context) (workflow.WorkflowDefinitionCollection, int64, error)
IntakeRoutes(context.Context) (workflow.IntakeRoutes, error)
}
// workflowEnablementSource supplies which workflows each org has disabled.
@@ -367,7 +369,11 @@ func (bd *BindingDispatch) disabledRoutedWorkflow(ctx context.Context, labels, i
for _, definition := range definitions.Definitions {
available[definition.ID] = struct{}{}
}
routed, resolveErr := workflow.ResolveWorkflowID(&workflow.Task{Labels: labels}, available)
routes, err := bd.definitions.IntakeRoutes(ctx)
if err != nil {
return "", false, err
}
routed, resolveErr := workflow.ResolveWorkflowID(&workflow.Task{Labels: labels}, routes, available)
if resolveErr == nil {
enablement, err := bd.workflowEnablement(ctx)
if err != nil {