Skip to content

src/dazzle_back/runtime/invariant_evaluator.py

Generated: 2026-03-30T04:38:47.454954+00:00

Commit: 615f1354a103

Language: python

Scope: dazzle_back

Purpose

Invariant evaluator for DNR runtime.

This module evaluates entity invariants at runtime during create/update operations. Invariants are cross-field constraints that must always hold true.

Key Exports

  • InvariantViolationError
  • evaluate_invariant_expr
  • validate_invariant
  • validate_invariants
  • check_invariants_for_create
  • check_invariants_for_update

Dependencies

Imports

  • datetime.date
  • datetime.datetime
  • datetime.timedelta
  • decimal.Decimal
  • typing.Any
  • dazzle_back.runtime._comparison.eval_comparison_op
  • dazzle_back.specs.entity.DurationUnitKind
  • dazzle_back.specs.entity.InvariantComparisonKind
  • dazzle_back.specs.entity.InvariantExprSpec
  • dazzle_back.specs.entity.InvariantLogicalKind
  • dazzle_back.specs.entity.InvariantSpec

Event Interactions

None detected.

Invariants and Assumptions

  • Note: must check datetime before date since datetime is a subclass of date

  • Invariant Validation

Tests

  • tests/unit/test_invariant_evaluator.py
  • tests/integration/test_runtime_e2e.py
  • tests/integration/test_runtime_pipeline.py
  • tests/unit/test_runtime_test_routes.py
  • tests/unit/test_runtime_services.py

Notes

This page was automatically generated by tools/gen_reference_docs.py.