Title here
Summary here
Status: Superseded by ADR 016
Date: 2026-06-03
Context:
The contract validator’s pathExistsInSchema function uses Fields(cue.All()) to iterate fields and match path segments by label. This approach has three blind spots:
_) returns zero fields from Fields(), so any sub-path fails[string]: T) are not matched by label comparisoniter.Label() API requires a //nolint suppressionThese produce false positives for valid policies referencing standard fields like input.on.push.branches or input.jobs.build.
Decision:
Replace the field iteration loop with CUE’s LookupPath API using a per-segment fallback chain:
IncompleteKind() == cue.TopKind — accept all remaining segmentsStr(part).Optional() — matches named and optional fieldsAnyString — matches [string]: T pattern constraintsThis delegates CUE type system semantics to the CUE SDK rather than reimplementing them.
Consequences:
Benefits:
iter.Label())Drawbacks:
AnyString fallback is permissive — a path like input.jobs.anything will pass if jobs has a pattern constraint, even if anything isn’t a real job name (this is correct: the schema says any string key is valid)Related: