CheckDefinition#

class nominal.experimental.compute_as_code.CheckDefinition(title, expression, *, priority=None, description='', key=None, event_type=None, event_labels=None)#

Bases: object

A reusable failure condition written in the frontend compute language.

Bind channels when adding this definition to a ChecklistBuilder. Use dataclasses.replace or ordinary Python functions to create variations.

Parameters:
  • title (str)

    Display name of the check.

  • expression (str)

    Source ending in a range expression describing violations. Assignments are allowed; omit imports. Convert boolean conditions with .ranges().

  • priority (Priority | None)

    Default severity of violations, from P0 (most severe) to P4. Overrides the builder’s default_priority. A priority passed to ChecklistBuilder.add overrides this one.

  • event_type (EventType | None)

    Default category of generated events. Overrides the builder’s default_event_type. An event type passed to ChecklistBuilder.add overrides this one. When none of these is set, the service uses EventType.ERROR. This does not change the condition or turn absence of matching ranges into success. EventType.UNKNOWN is not a valid category for creation.

  • event_labels (Sequence[str] | None)

    Labels applied to generated events, not checklist grouping labels. When omitted or empty, this check supplies no event labels. Merged with the builder’s event_labels and any passed to ChecklistBuilder.add. Labels are copied when the definition is added to a builder.

  • description (str)

    Description of the check.

  • key (str | None)

    Optional stable identity, independent of title and source. The same key preserves lineage across revisions. Omit to generate an identity each time the check is added. Keys are case-sensitive, are not trimmed, and must not be blank or repeated in a builder.

title: str#
expression: str#
priority: Priority | None = None#
description: str = ''#
key: str | None = None#
event_type: EventType | None = None#
event_labels: Sequence[str] | None = None#