Skip to main content

Module extends

Module extends 

Source
Expand description

Workload extends: resolution and merging (SRD-72).

Resolves single-parent workload composition: a child workload YAML may declare extends: <relative-path> at the top level to inherit from a parent. The parent is loaded (recursively, if it has its own extends:) and merged field-by-field before the resulting workload is fed to parse::parse_workload.

The merge runs on parsed serde_json::Value trees, not on raw YAML text — every merge rule is structural (per-key merge, per-name replace, list union with dedup). The result is re-serialised back to YAML so the existing parse_workload(&str, …) entry point can consume it unchanged; template expansion then runs on the merged text with the caller’s params, matching the SRD-72 rule that validation and templating run once, on the merged whole.

Functions§

load_and_merge
Load a workload YAML from disk, follow its extends: chain to completion, and return the merged YAML text ready for parse::parse_workload, plus any resolution warnings the chain produced (a target name matching multiple resources — see [resolve_extends_target]). Callers surface the warnings on their own channel; dropping them silently is a bug.
load_and_merge_bundled
SRD-85: load a bundled workload from the catalog, follow its extends: chain (catalog-resolved — a bundled workload has no directory context), and return the merged YAML text plus any resolution warnings.