Skip to content

ProbeSpec YAML grammar

A ProbeSpec is a human-readable YAML document describing a screen and a set of behavioural assertions to verify. It is screen-agnostic: it references Acumen screens by their registered screen_id and fields by their data-lens-path attributes (see Atlas attribute contract).

ProbeSpecs are stored in probe_spec.yaml_content and read directly by the ProbeRunner when handing the test off to cc.


Top-level structure

id: <slug>                   # required — unique within tenant
name: <human name>           # required
screen_id: <screen_id>       # required — must be a registered Acumen screen
description: <text>          # optional
tags: [<string>, ...]        # optional
lenser_project: <slug>       # optional — links spec to a LenserProject

scenarios:                   # required — one or more
  - id: <slug>
    name: <human name>
    setup: { ... }           # optional — runs outside scenario timing
    steps: [ ... ]           # required — ordered actions
    assert: [ ... ]          # required — behavioural assertions
    teardown: { ... }        # optional — runs outside scenario timing

setup and teardown are not included in pass/fail evaluation — they exist so a scenario can prepare or restore tenant state without affecting timing or status.

lenser_project is optional. ProbeSpecs can exist independently of any LenserProject.


Closed sets

Allowed action values

Action Purpose
navigate Open a screen (optionally a specific record or mode: new_record)
fill Type into a field
check / uncheck Toggle a checkbox
select Pick an option from a dropdown
click Click a button or toolbar action
leave_empty Explicitly assert a field is left blank (clears any default)
wait Pause for a fixed duration or condition

Allowed assert types

Assertion Purpose
field.state Field is enabled, disabled, visible, hidden, required
field_value Field has the expected value
validation_error A validation error appears for a field, optionally matching message_contains
no_validation_error No validation error appears for a field
record_saved The save endpoint returned success (record persisted)
record_not_saved Save was attempted but failed (record not persisted)
element_visible An element matching a data-* selector is rendered
element_hidden An element matching a data-* selector is not rendered

These are closed sets — cc is instructed to refuse any action or assertion outside the lists above. New types require a code change in ProbeRunner and the prompt schema.


Field paths

field paths use dot-notation matching the data-lens-path attribute that Atlas emits on form-field containers. For example, the License screen's expiration-date field renders as:

<input
  data-lens-path="form.license.expiration_date"
  data-lens-field="ExpirationDate"
  id="edExpirationDate"
/>

…and is referenced in YAML as field: form.license.expiration_date.

Toolbar actions use target: toolbar.<action> where the action matches data-acumen-action="<action>" on the rendered button — e.g. target: toolbar.save.


Worked example

This is the canonical Phase 1 example: verifying that the LicenseNoIndefinite Lenser project disables the Valid From field, makes Expiration Date required unless Never Expires is checked, and reverts cleanly on unpublish.

# probe_specs/fs_licenses__no_indefinite.probe.yaml

id: fs_licenses__no_indefinite
name: License No Indefinite Date
screen_id: fs_licenses
description: >
  Verify that indefinite license dates are prevented by the
  LicenseNoIndefinite Lenser project
tags:
  - lenser
  - fs_licenses
  - validation
lenser_project: LicenseNoIndefinite

scenarios:

  - id: valid_from_disabled
    name: Valid From field is disabled
    steps:
      - action: navigate
        screen: fs_licenses
        record: "900024"
    assert:
      - field: form.license.valid_from
        state: disabled

  - id: expiration_required_on_save
    name: Saving without expiration date shows validation error
    steps:
      - action: navigate
        screen: fs_licenses
        mode: new_record
      - action: fill
        field: form.license.license_type
        value: "CYSCO CCN"
      - action: fill
        field: form.license.staff_member
        value: "EP00000015"
      - action: leave_empty
        field: form.license.expiration_date
      - action: click
        target: toolbar.save
    assert:
      - validation_error:
          field: form.license.expiration_date
          message_contains: "required"
      - record_not_saved: true

  - id: never_expires_bypasses_validation
    name: Checking Never Expires allows save without expiration date
    steps:
      - action: navigate
        screen: fs_licenses
        mode: new_record
      - action: fill
        field: form.license.license_type
        value: "CYSCO CCN"
      - action: check
        field: form.license.never_expires
      - action: click
        target: toolbar.save
    assert:
      - no_validation_error:
          field: form.license.expiration_date
      - record_saved: true

  - id: unpublish_restores_valid_from
    name: Unpublishing the project re-enables Valid From
    setup:
      unpublish_lenser_project: LicenseNoIndefinite
    steps:
      - action: navigate
        screen: fs_licenses
        record: "900024"
    assert:
      - field: form.license.valid_from
        state: enabled
    teardown:
      publish_lenser_project: LicenseNoIndefinite

Validation rules

A ProbeSpec is rejected at POST /probe/specs (or PATCH) if any of the following are true:

  • screen_id is not a registered Acumen screen.
  • An action value is outside the closed set above.
  • An assert type is outside the closed set above.
  • A field path contains characters other than [a-z0-9_.] or starts/ends with ..
  • scenarios is empty.
  • A scenario's assert block is empty.

There is no schema for setup / teardown — they may use any orchestration verb the runner understands. Phase 1 supports publish_lenser_project and unpublish_lenser_project only; new verbs require a code change.


How Lensmith auto-generates specs

When you accept a Lensmith proposal in a Lenser project, Lensmith maps each LenserOperation to one or more assertions:

Override property Auto-generated assertion
read_only: true assert_field_state(disabled)
read_only: false assert_field_state(enabled)
value: <X> assert_field_value(== X)
required: true assert_field_state(visible) (proxy until Lens emits data-required)
Other properties Comment-only — "no auto-verifier yet"

The generator (ProbeSpecGenerator in services/probe_spec_generator.py) writes a YAML scenario per override, links the resulting probe_spec row to the LenserProject, and surfaces the YAML read-only in the Probe management screen.


See also