Skip to content

Validation

Validation checks a deck's structure, types, units, and references. It does not run geometry or read layout files. An empty deck is invalid; a rule that selects an empty layer is valid.

Validate a deck

Python
from fabcheck import load

deck = load("rules.py")
report = deck.validate()
for diagnostic in report.diagnostics:
    print(diagnostic.format())
compiled = report.require_valid()

require_valid() returns a compiled deck or raises DeckValidationError. deck.compile() and deck.require_valid() validate and return the same result in one call. The compiled deck is a snapshot: later edits to deck do not change it.

Check backend support

A capability manifest lists the operations and options a backend supports. Pass the manifest supplied by your execution backend:

Python
report = deck.validate(capabilities=capabilities)
compiled = report.require_valid()
deck.write("rules.fcd", capabilities=capabilities)
report.backend_compatibility Meaning What it does and why
unchecked No capability manifest was supplied Only deck validity was checked. Supply the backend's manifest when you also need to know whether its operations and options can run.
supported The manifest covers the deck's operations and options The supplied manifest covers the required operations and choices. Use it as the compatibility result, while still checking is_valid for separate deck errors.
unsupported An operation, version, or option is missing At least one required call, version, or option is unavailable. Read the diagnostics and change the deck or select a backend that supports it.

report.is_valid checks both deck validity and backend support. A supported deck can still contain errors. All declared operations are checked, including unused ones.

The public API includes only features available in this release. Unsupported options fail while building expressions. Validation and export also reject unavailable operations in saved or manually constructed graphs.

Supply your execution backend's capability manifest to check its support too. Capability acceptance does not prove that a layout passes the rules or that geometry results are correct.

Read errors

Diagnostics include an FC_* code, message, severity, rule ID, model path, and source file/line when available. They follow rule order, then model path. Errors in shared calculations point to the first rule that uses them.

Invalid Python arguments can raise TypeError, ValueError, or Pydantic's ValidationError before a report exists. Use the traceback to find the call. Off-grid values and other layout-dependent errors occur during execution.

See testing for assertion helpers, or the integration contract for model and capability details.