Skip to main content

validate_placeholders_via_kernel

Function validate_placeholders_via_kernel 

Source
pub fn validate_placeholders_via_kernel(
    ops: &[ParsedOp],
    kernel: &dyn Kernel,
    enclosing: &[&PolydatProgram],
) -> Result<(), String>
Expand description

Apply iteration-variable substitution to op-template strings only — raw:, prepared:, stmt:, etc.

Iter vars flow into Polydat binding source as wires (declared as externs by BindingScope::add_iteration_var and bound at runtime via the standard input mechanism), so this helper does not touch op.bindings. It only rewrites the op-template field values, where {var} placeholders refer to structural elements (table names, keyspace names, optimize-for hints) that adapters need as literal text — not as bind variables. CQL’s prepared: form, for example, converts every remaining {name} in the statement to a ? bind marker; iter vars in structural positions (INSERT INTO ks.{table} ...) must be substituted away before that conversion runs, since CQL doesn’t permit ? for table names. SRD-68 Push 5c — validate-only walk. Same semantic as [resolve_placeholders_via_kernel] but DOES NOT mutate the op strings. Walks every {name} placeholder in the ops’ op fields and op-level params, accumulating diagnostics for unresolved references; returns Result<(), String> describing any unresolved bindpoints.

Used at phase activation as the single workload-load-time validation step. Adapters now do their own cycle-time resolution (CQL: construction-time structural via canonical_kernel.lookup + cycle-time per-cycle via WireSource::get; non-CQL: cycle-time via synthesis::resolve_cached → substitute_bind_points_with_state against main_kernel). Mutation of the workload model is no longer load-bearing — only the diagnostic surface is.

enclosing are the programs of the scopes around the phase — the current parent and every installed ancestor. A name one of them BINDS (a per-cycle workload or scenario binding, not a folded constant) resolves nowhere now, yet the phase scope pulls its binding in as local matter (local_inclusion_chain, SRD-13f case 3), so it is per-cycle here exactly like a phase-declared one.