Skip to content

docs: CEL validation discovery brief (#76)#191

Merged
zeevdr merged 2 commits intomainfrom
cel-discovery
Apr 27, 2026
Merged

docs: CEL validation discovery brief (#76)#191
zeevdr merged 2 commits intomainfrom
cel-discovery

Conversation

@zeevdr
Copy link
Copy Markdown
Member

@zeevdr zeevdr commented Apr 27, 2026

Summary

Prior art surveyed: Kubernetes CRD x-kubernetes-validations, buf protovalidate, Terraform variable validation, JSON Schema 2020-12 conditionals, Symfony Expression. Decisions explained in the brief.

Three follow-up issues filed against #76 as Phase 1 subtasks.

Test plan

  • Doc-only change — no Go code touched
  • Reviewer reads the brief, calls out anything ambiguous before Phase 1 implementation begins

@zeevdr zeevdr added docs Documentation size: S Quick win — a few hours or less priority: P1 Current milestone work labels Apr 27, 2026
@zeevdr zeevdr added this to the Schema Spec v0.1.0 milestone Apr 27, 2026
zeevdr and others added 2 commits April 27, 2026 19:07
Adds .agents/context/cel-validation.md covering the design space for
cross-field validation via CEL (issue #76):

- Prior art survey: Kubernetes CRD x-kubernetes-validations, buf
  protovalidate, Terraform variable validation, JSON Schema 2020-12
  conditionals (dependentRequired / if-then-else), Symfony Expression
- Schema shape: top-level `validations:` list at group granularity,
  binding `self.<path>` to align with K8s + protovalidate idiom
- JSON Schema carve-out: `dependentRequired:` for free declarative
  cross-field requirement; CEL is the escape hatch for arithmetic /
  multi-field invariants
- Lint rules: 4 (syntax / >=1 field ref / typed-env resolution /
  native-substitutable detection)
- Engine: cel-go, compile at ImportSchema, cache cel.Program, evaluate
  per write, CostLimit for DoS protection
- Phasing: Phase 1 reserve keys + dependentRequired enforcement +
  prefix-overlap lint (v0.1.0); Phase 2 CEL engine MVP; Phase 3 polish

Updates schema-spec.md to reserve `validations:` and `dependentRequired:`
in v0.1.0 and cross-link the brief.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Surfaced during the dependentRequired implementation race-safety
discussion. Two CEL rules can be jointly unsatisfiable (a>b paired with
b>a; x==k1 paired with x==k2 for distinct constants), making every
config fail the validation gate. Worth detecting at ImportSchema time
so the schema author hears about it instead of every downstream user.

Documents three approaches with trade-offs:
- AST pattern match (cheap, common shapes only)
- Empty-set probe (cheap, statistical)
- SMT translation via z3 (heavy, violates vanilla principle)

Phase 2 ships AST pattern match + empty-set probe. SMT out of scope.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zeevdr zeevdr merged commit db2eb5e into main Apr 27, 2026
11 checks passed
@zeevdr zeevdr deleted the cel-discovery branch April 27, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation priority: P1 Current milestone work size: S Quick win — a few hours or less

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant