Skip to main content

Module integration

Module integration 

Source
Expand description

Wiring layer between crate::values (Phase 1) and the diff / apply pipeline.

Responsibilities:

  • Resolve the per-env values file path from config (values_file override or default values/<env>.yaml).
  • Build the per-resource flat lookup table from the structured ValuesFile per RFC §2.2 namespace rules.
  • Aggregate placeholder failures across resources so the caller can abort with a single grouped report (RFC §2.4 / §3 Q7).

Structs§

PreflightArgs
Bundle of inputs the pre-flight needs from the entry layer. Kept as a struct (rather than 10 positional args) to keep clippy happy and to make future additions (e.g. a new kind that grows placeholders) non-breaking at call sites.
ResolutionFailure
One resource’s worth of placeholder failures, ready to be folded into a top-level error message.

Functions§

compute_values_input_hashes
Compute per-resource “consumed values” hashes for plan-lock integrity checking (RFC §4 Phase 6).
format_failures
Format aggregated failures into a single human-readable error. Adds the “values file missing” hint when values_loaded == false so the operator immediately knows where to look.
load_values_for_env
Load the per-env values file, tolerating absence.
preflight_values
Walk every selected kind’s local files and validate that all __BRAZESYNC.*__ placeholders resolve against the loaded values file. Returns the loaded ValuesFile (or None if absent and no placeholders are used) on success; on any failure across any kind, aborts with an aggregated format_failures error.
resolve_content_block_in_place
Resolve every __BRAZESYNC.*__ in cb.content against values. content_block bodies are single-field, so all lid / cb_id / custom namespaces live at the resource root (RFC §2.2).
resolve_email_template_in_place
Resolve placeholders across every Liquid-bearing field of et. Each field has its own per-field lid / cb_id namespace; custom is resource-scoped (RFC §2.2). Failures are aggregated per field so a single email_template can surface multiple ResolutionFailures.
values_file_path
Where to look for the per-env values file. values_file config override wins; otherwise default values/<env>.yaml.