workflow: generalize routing/label files to multiple playbook directories #434

Closed
opened 2026-10-27 13:36:19 +00:00 by sam · 0 comments
Owner

Third slice of docs/prds/eda-playbook-engine.md, completing open question #2. Generalizes the single-file workflow_routing_file / workflow_labels_file config fields (t2db.9, t2db.10) into a LIST of configured playbook directories, loaded at daemon startup alongside the existing single-file fields for backward compatibility. This is what makes the design doc's collision-handling rule (drop + log + report to caller, no auto-arbitration) load-bearing: a single file has nothing to collide with, so the rule has never actually been exercised in production code yet.

Corrected 2026-09-03 (Sam): must be a list of directories, not one directory -- a single playbook_dir field would contradict supporting multiple independently-maintained playbook sources, which the PRD's own Dedup section already assumes ('independently-sourced playbook directories collide'). Scope directories by the existing Repo (owner/name) concept already in Config.Repos, NOT by org/tenant -- org-keying would require an auth/identity model archie does not have yet. That is a separate, later decision, not something to half-build here.

Design

Follow the existing once-at-startup lifecycle (SetKindWorkflows/SetLabelWorkflows pattern) rather than inventing new state management. Config gains a list field (e.g. PlaybookDirs []string, or a PlaybookDir field on the existing Repo struct if directories should tie to a specific configured repo rather than being globally pooled -- decide based on whether playbooks are meant to be repo-scoped or operator-global). A loader reads every *.yaml file across all configured directories, applying the same per-file validation LoadLabelWorkflowsYAML already does, then merges bindings across all sources -- a binding for the same label/kind declared by two different sources is the collision case: drop both, log which sources/label collided, return the error to the caller (do not start the daemon on a routing collision). Single-file fields (workflow_routing_file, workflow_labels_file) remain supported unchanged as an additional, independent input alongside the directory list, not replaced by it.

Acceptance criteria

Config supports a LIST of playbook directories (not a single path), empty/unset by default (no behavior change for existing configs). Loading two directories with a colliding label binding is a reported load failure, not a silent pick-one. Loading multiple non-colliding directories merges cleanly and Route() honours the merged bindings. Existing workflow_routing_file/workflow_labels_file continue to work unchanged when no directories are configured. Org/tenant scoping is explicitly out of scope and not attempted. task check passes.

Close reason

Verified landed: workflow.LoadPlaybookDirs + MergeKindWorkflows/MergeLabelWorkflows, wired via cfg.PlaybookDirs.


Imported from beads archie-core-t2db.11 · GitHub #743 · type task · priority P2 · created 2026-09-02 · closed 2026-09-11

Third slice of docs/prds/eda-playbook-engine.md, completing open question #2. Generalizes the single-file workflow_routing_file / workflow_labels_file config fields (t2db.9, t2db.10) into a LIST of configured playbook directories, loaded at daemon startup alongside the existing single-file fields for backward compatibility. This is what makes the design doc's collision-handling rule (drop + log + report to caller, no auto-arbitration) load-bearing: a single file has nothing to collide with, so the rule has never actually been exercised in production code yet. Corrected 2026-09-03 (Sam): must be a list of directories, not one directory -- a single playbook_dir field would contradict supporting multiple independently-maintained playbook sources, which the PRD's own Dedup section already assumes ('independently-sourced playbook directories collide'). Scope directories by the existing Repo (owner/name) concept already in Config.Repos, NOT by org/tenant -- org-keying would require an auth/identity model archie does not have yet. That is a separate, later decision, not something to half-build here. ### Design Follow the existing once-at-startup lifecycle (SetKindWorkflows/SetLabelWorkflows pattern) rather than inventing new state management. Config gains a list field (e.g. PlaybookDirs []string, or a PlaybookDir field on the existing Repo struct if directories should tie to a specific configured repo rather than being globally pooled -- decide based on whether playbooks are meant to be repo-scoped or operator-global). A loader reads every *.yaml file across all configured directories, applying the same per-file validation LoadLabelWorkflowsYAML already does, then merges bindings across all sources -- a binding for the same label/kind declared by two different sources is the collision case: drop both, log which sources/label collided, return the error to the caller (do not start the daemon on a routing collision). Single-file fields (workflow_routing_file, workflow_labels_file) remain supported unchanged as an additional, independent input alongside the directory list, not replaced by it. ### Acceptance criteria Config supports a LIST of playbook directories (not a single path), empty/unset by default (no behavior change for existing configs). Loading two directories with a colliding label binding is a reported load failure, not a silent pick-one. Loading multiple non-colliding directories merges cleanly and Route() honours the merged bindings. Existing workflow_routing_file/workflow_labels_file continue to work unchanged when no directories are configured. Org/tenant scoping is explicitly out of scope and not attempted. task check passes. ### Close reason Verified landed: workflow.LoadPlaybookDirs + MergeKindWorkflows/MergeLabelWorkflows, wired via cfg.PlaybookDirs. --- _Imported from beads `archie-core-t2db.11` · GitHub #743 · type task · priority P2 · created 2026-09-02 · closed 2026-09-11_
sam added the mediumtask labels 2026-10-27 13:36:19 +00:00
sam self-assigned this 2026-10-27 13:36:19 +00:00
sam closed this issue 2026-10-27 13:36:19 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#434