feat(workflow): load kind/label bindings from multiple playbook directories

Third slice of docs/prds/eda-playbook-engine.md (t2db.11), completing open
question 2: instead of a single playbook dir, the config gains a LIST of
directories (playbook_dirs) of *.yaml/*.yml binding files, loaded at
startup as an additional input to workflow_routing_file and
workflow_labels_file, which remain supported unchanged.

- LoadPlaybookDirs(dirs []string) reads every yaml file across the
  configured directories and merges kind + arbitrary-label bindings.
- This is what finally exercises the design doc's drop-and-report
  collision rule: a single file cannot collide with itself, so the
  cross-source path (two files in one dir, two dirs, or a dir plus a
  single-file field) had never run in production. A binding key declared
  by more than one source is a reported load failure, not a silent
  pick-one by source order or version.
- Router-level collision handling: MergeKindWorkflows/MergeLabelWorkflows
  fail on a key bound by both the single-file fields and the playbook
  dirs, applied at boot.
- Config: PlaybookDirs []string, empty by default (no behavior change for
  existing configs). Repo-scoping (typing dirs to Config.Repos owner/name)
  is explicitly deferred to a separate later decision per ticket;
  org/tenant keying is out of scope.
- PRD: records the list shape per Sam's correction (single dir would
  contradict multiple independently-maintained playbook sources).
This commit is contained in:
sam committed 2026-09-03 02:57:38 +10:00
1 parent da3fe2dbd5
commit cf6c5f42d5
7 files changed
+373 -2

No files matched your search

+17
View File
@@ -247,6 +247,23 @@ before Channel/Forge actions or multi-action playbooks ship.
single-file shape does not preclude it -- a future `workflow_dir` would
compose `workflow_labels_file`'s role into a loader.
**Status 2026-09-03: resolved by t2db.11 (corrected).** The directory
shape landed as `playbook_dirs` (a LIST of directories of
`*.yaml`/`*.yml` binding files), loaded at startup as an additional
input to the two single-file fields, which remain supported unchanged.
Sam's correction 2026-09-03: a single `playbook_dir` would contradict
supporting multiple independently-maintained playbook sources, which
the Dedup section already assumes ('independently-sourced playbook
directories collide'), so the field is a list. Cross-source collision
(same key in two directories, or in a single-file field and a
directory) is reported like an in-directory collision -- nothing is
arbitrated by source precedence. This is what finally exercises the
design doc's drop-and-report collision rule, since a single file
cannot collide with itself. Repo-scoping (tying directories to
`Config.Repos` owner/name) is explicitly deferred to a separate,
later decision; org/tenant keying is out of scope (no auth/identity
model).
Decisions recorded from the label-vocabulary slice (commit pending):
- Arbitrary labels bind to registered workflow names via
`LabelWorkflows` + `LoadLabelWorkflowsYAML`/`SetLabelWorkflows`