Metadata-Version: 2.5
Name: urml-conformance
Version: 0.5.4
Summary: Conformance test suite for URML runtimes. Free, public, runnable.
Project-URL: Homepage, https://github.com/urml-dev/URML
Project-URL: Repository, https://github.com/urml-dev/URML
Project-URL: Issues, https://github.com/urml-dev/URML/issues
Author: URML Maintainers
License: BUSL-1.1
License-File: LICENSE
Keywords: conformance,robotics,specification,urml
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.11
Requires-Dist: pydantic<3,>=2.6
Requires-Dist: pyyaml<7,>=6.0
Requires-Dist: urml-ros2-runtime>=0.5.4
Requires-Dist: urml-validator>=0.5.4
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-cov>=5; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
Provides-Extra: llm-bridge
Requires-Dist: urml-llm-bridge>=0.5.4; extra == 'llm-bridge'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://urml.dev"><img src="https://urml.dev/favicon.svg" alt="URML" width="72" height="72"></a>
</p>

<p align="center">
  A small, opinionated, human-readable language for describing robot intent.
</p>

<p align="center">
  <a href="https://urml.dev"><b>urml.dev</b></a>
</p>

---

# URML Conformance Suite

**Status:** alpha, on PyPI as `urml-conformance` (`pip install urml-conformance`). Versions are `0.x`, so a release may break compatibility; the [changelog](https://github.com/urml-dev/URML/blob/main/CHANGELOG.md) says what each one changed. It ships the declarative fixture model, `ConformanceRunner`, the `python -m urml_conformance` and `urml conformance run` entry points, the goal-line lane and the fixtures: 270 YAML cases in 23 directories as of release 0.5.4, 129 of them programs that must be rejected. The fixtures and the manifests, envelopes, policies and rulebooks they name are inside the package, so an installed suite runs without a checkout. The suite exists ahead of the [MANIFESTO Roadmap](https://github.com/urml-dev/URML/blob/main/MANIFESTO.md), which named Phase 3 for a suite v1, so that every URML-compatible runtime has a target to build toward from day one.

## What this is

The **freely runnable** set of tests that determines whether a runtime is **URML-compatible**. The conformance suite is the bridge between the abstract specification documents in [`/spec`](https://github.com/urml-dev/URML/tree/main/spec) and a concrete claim of compatibility a robot maker can stand behind.

A sibling sub-suite, [`conformance/llm-bridge/`](https://github.com/urml-dev/URML/tree/main/conformance/llm-bridge), scores `(model, backend, profile)` triples for the on-device LLM bridge introduced by [RFC-0021](https://github.com/urml-dev/URML/blob/main/docs/rfcs/0021-on-device-llm-bridge.md). The runtime sub-suite below answers "does this runtime execute URML correctly"; the LLM-bridge sub-suite answers "how reliably does this model emit URML the validator accepts."

The conformance suite is licensed under the Business Source License 1.1 (see [`LICENSING.md`](https://github.com/urml-dev/URML/blob/main/LICENSING.md)). Running it to test a runtime is non-production use and is free. The *URML-Certified* mark rests on a paid certification run ([RFC-0705](https://github.com/urml-dev/URML/blob/main/docs/rfcs/0705-urml-certified.md), [RFC-0708](https://github.com/urml-dev/URML/blob/main/docs/rfcs/0708-paid-certification.md)): the fee pays for the Licensor's reproduction, never for the result. The tests are public and runnable by anyone, and every certification rests on reports anyone can re-run.

The **normative, human-readable contract** this suite enforces (the six clauses a runtime must satisfy, the two tiers, and the spec-gap loop) is [`spec/conformance/v0.2.3.md`](https://github.com/urml-dev/URML/blob/main/spec/conformance/v0.2.3.md) ([RFC-0014](https://github.com/urml-dev/URML/blob/main/docs/rfcs/0014-substrate-conformance.md), [RFC-0705](https://github.com/urml-dev/URML/blob/main/docs/rfcs/0705-urml-certified.md), [RFC-0706](https://github.com/urml-dev/URML/blob/main/docs/rfcs/0706-recorded-adapter-calls.md)). This suite is its executable form (clause 6); that document is its written form.

## How conformance is structured

Conformance is **per-specification-version**, not whole-project. A runtime that passes the Layer-2 v0.1 tests and the home-profile v0.1 tests is conformant to *those* specs at *those* versions, no more and no less. The runtime declares this in its own `CONFORMANCE.md`.

```yaml
declares:
  layer-1-hal: 0.1.0
  layer-2-primitives: 0.1.0
  layer-3-behavior: 0.1.0
  layer-4-nl-grammar: 0.1.0
  profiles:
    home: 0.1.0
```

The conformance suite ships with a runner that, given a runtime's adapter, runs the fixtures (all of them, or those of the profiles named with `--profile`) and emits a structured report (`urml.conformance-report/1`). The runner does not read `CONFORMANCE.md`: whoever runs it selects the profiles that match the declaration.

## What the suite tests

The suite contains tests in three categories:

### 1. Static behavior

Tests of the validator and the spec itself, independent of any particular runtime. These confirm that a given URML program, manifest, and envelope produce the documented validation outcome.

### 2. End-to-end behavior

Tests of a runtime, given a manifest and a URML program. The suite records the calls the runtime makes on its adapter and compares them, with the outcome, the number of steps and the bindings, to what the fixture expects. The record shows what the runtime asked the substrate to do. It does not show that the robot moved: for `move_to(kitchen)` it shows a navigation goal for the kitchen, and a simulator or the robot itself has to show the arrival.

### 3. Negative tests

The most important category. Confirms that the runtime correctly **rejects** programs that violate declared capability or the safety envelope. Cases include:

- Programs that require capabilities not in the manifest.
- Programs that exceed declared velocity / payload / force / altitude / geofence / cell-perimeter limits.
- Programs that use a profile-gated primitive outside its profile (`drive` without the educational profile, `gesture` without the social profile).
- Programs that hand a primitive a binding of the wrong type (a `follow_trajectory` given a detected object instead of a planned trajectory).
- Programs a rulebook forbids (a cap, a forbidden primitive or zone, a flight over a declared people zone), and robots whose provenance the compliance policy refuses (a denied vendor or country).
- Fleet programs that address an undeclared member or send two robots into one workspace at once.

A runtime that *executes* one of these programs has a critical conformance bug. The suite makes that bug visible. The goal-line lane (`python -m urml_conformance --goal-line`) hands every rejected fixture to the runtime itself and requires a refusal with the expected codes and zero adapter calls.

## What the suite does NOT test

- Performance, latency, jitter. Those are runtime concerns, not specification concerns. A separate (non-conformance) benchmarking suite may eventually live in this directory; if so, it is clearly labeled as a benchmark, not a conformance test.
- Substrate-specific behavior. The suite tests *URML* compliance; it does not test that the runtime's chosen Layer-0 (ROS 2, PX4, ...) is also well-behaved.
- Hardware-specific behavior. The default run uses the hermetic `MockROSAdapter`; `--adapter` runs the same fixtures through a runtime's own adapter, against a simulator or a robot. Hardware-in-the-loop is the runtime developer's own responsibility.

## How conformance is consumed

Two paths:

1. **Self-reported conformance.** A runtime developer runs the suite against their runtime, records the result, and publishes the report. This is what the open ecosystem looks like. Self-reporting is honest because anyone can re-run the suite and verify.
2. **Certified conformance.** The Licensor (or a successor foundation) reproduces a self-reported run from the public package and, if it passes, grants the **URML-Certified** mark through the registry. On the public criteria in [`spec/conformance/v0.2.3.md`](https://github.com/urml-dev/URML/blob/main/spec/conformance/v0.2.3.md) section 3; the run is a paid validation service ([`COMMERCIAL.md`](https://github.com/urml-dev/URML/blob/main/COMMERCIAL.md#urml-certified-runtime-makers)). The run itself is public code, so anyone can repeat it:

   ```bash
   python -m urml_conformance.reproduce registry/entries/<id>.yaml           # install, run offline, check
   python -m urml_conformance.reproduce registry/entries/<id>.yaml --write   # and fill the entry
   ```

   It installs exactly `<package>==<version>` and the matching urml-conformance into a fresh virtual environment, runs the claimed profiles with the entry's adapter while refusing every network connection and lookup except loopback, and checks the reproduction passed every fixture with the same adapter and the same fixture set (`fixtures_sha256`) as the self-report. The guard covers the suite's own process; `--run-prefix "unshare -rn"` (Linux) adds an OS-level sandbox for adapters that start their own processes. A failed run keeps its report as the record and grants nothing.

   The reproduction report also records `timing`: wall-clock seconds for each step of the run (`plan`, `install`, `run`, `check`) on the Licensor's machine. These numbers are what the certification fee schedule will be built from ([RFC-0708](https://github.com/urml-dev/URML/blob/main/docs/rfcs/0708-paid-certification.md)). They cover machine time only; the review of the entry and the attestation is not in them.

## How tests are added

A spec change (RFC) that affects observable behavior must land with the corresponding conformance-suite changes in the same release. A spec change without conformance updates is incomplete and is sent back. This rule is what keeps the spec and the suite from drifting.

## Status

The suite is public and runs from PyPI or from a checkout. The reference `URMLRuntime` with the hermetic `MockROSAdapter` passes every fixture, and the goal-line lane passes on every rejected one. That result describes the mock and says nothing about a real robot stack. A compatibility claim needs a run with a runtime's own adapter, and the [registry](https://github.com/urml-dev/URML/blob/main/registry/README.md) records those: on 2026-11-28 no entry carried one, and nothing was URML-Certified.

## Quickstart (hermetic, no ROS 2 needed)

From PyPI, in any directory:

```bash
python -m venv .venv && . .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install urml-conformance
python -m urml_conformance        # or: urml conformance run
```

From a checkout of the repository, to run the suite's own tests:

```bash
cd conformance
python -m venv .venv && . .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -e ../reference/validator
pip install -e ../reference/ros2-runtime
pip install -e ".[dev]"
pytest
```

Use the runner programmatically:

```python
from urml_conformance import ConformanceRunner

runner = ConformanceRunner()
report = runner.run()
assert report.all_passed, report.render()
```

Check that every rejected fixture sends zero commands through the runtime:

```bash
python -m urml_conformance --goal-line
```

## Authoring a new fixture

Drop a YAML file under `conformance/fixtures/<profile>/`:

```yaml
name: profile/my_case
description: One-line summary.
manifest: turtlebot4_home      # name from MANIFEST_REGISTRY
envelope: home_default         # optional; name from ENVELOPE_REGISTRY
profiles: [home]

program:
  profile: home
  behavior:
    type: sequence
    steps: [ ... ]

adapter_overrides:             # optional: pre-configure MockROSAdapter
  navigation: { success: false, reason: path_blocked }

expected_validation:
  accepted: true               # or false + error_codes for rejection tests

expected_execution:            # omit for validator-only cases
  success: true
  steps_executed: 5
  audit_methods: [send_navigation_goal, ...]
  bindings_contains:
    target_mug: { class: mug }
```

The fixture is picked up automatically by `discover_fixtures()` and exercised by the next `pytest` run.

## What's in the fixture set

Ten of the fixtures, as a sample. The full set is discovered automatically from
`conformance/fixtures/**/*.yaml` by `discover_fixtures()`: 270 files as of
release 0.5.4. `urml conformance run` prints the count of the version you have
installed.

| Fixture | Exercises |
|---|---|
| `home/red_mug_positive` | Canonical red-mug fetch end to end. |
| `home/red_mug_nav_failure` | Adapter failure → `abort_and_report` halts the sequence. |
| `home/missing_location_rejected` | Validator-only: undeclared location → `capability.missing_location`. |
| `home/branch_on_color` | Branch composition + `$ref.field.subfield` condition evaluation. |
| `home/retry_until_confidence` | Retry composition with `until` short-circuit. |
| `home/parallel_first_to_succeed` | Parallel composition with `first_to_succeed` mode. |
| `industrial/pick_red_positive` | Industrial pick-and-place written with the core twelve (composition-equivalent). |
| `industrial/pick_from_positive` | RFC-0013: `pick_from` + `place_at`; the picked-object binding flows between them. |
| `industrial/swap_tool_positive` | RFC-0013: `swap_tool` rides the docking-service path (`send_docking_goal`). |
| `industrial/swap_tool_undeclared_service_rejected` | RFC-0013 negative: `swap_tool` at a non-station → `capability.missing_docking_station`. |

## Related documents

- [`LICENSING.md`](https://github.com/urml-dev/URML/blob/main/LICENSING.md): what is free and what needs a commercial license.
- [`/spec/`](https://github.com/urml-dev/URML/tree/main/spec): the specifications the suite tests against.
- [`/reference/`](https://github.com/urml-dev/URML/tree/main/reference): the reference implementations the suite is first exercised against.
- [`TRADEMARK.md`](https://github.com/urml-dev/URML/blob/main/TRADEMARK.md): the policy for the URML name and the URML-Certified mark, which lives separately from the suite.
