|
| 1 | +# SourceOS Operation Conformance Runner |
| 2 | + |
| 3 | +Status: initial implementation |
| 4 | + |
| 5 | +Issue: SourceOS-Linux/sourceos-devtools#19 |
| 6 | + |
| 7 | +## Purpose |
| 8 | + |
| 9 | +`tools/sourceos_operation_conformance.py` validates Workspace Operation Plane fixture bundles from `SocioProphet/prophet-core-contracts` or from adapter repos that implement the same fixture shape. |
| 10 | + |
| 11 | +The runner is intentionally usable with only the Python standard library for structural checks. If the optional `jsonschema` package is installed, it also runs schema validation against the contract schemas. |
| 12 | + |
| 13 | +## Default layout |
| 14 | + |
| 15 | +The expected local development layout is: |
| 16 | + |
| 17 | +```text |
| 18 | +~/dev/sourceos-devtools |
| 19 | +~/dev/prophet-core-contracts |
| 20 | +``` |
| 21 | + |
| 22 | +From `~/dev/sourceos-devtools`, run: |
| 23 | + |
| 24 | +```bash |
| 25 | +python3 tools/sourceos_operation_conformance.py \ |
| 26 | + --contracts-dir ../prophet-core-contracts |
| 27 | +``` |
| 28 | + |
| 29 | +For structural-only checks: |
| 30 | + |
| 31 | +```bash |
| 32 | +python3 tools/sourceos_operation_conformance.py \ |
| 33 | + --contracts-dir ../prophet-core-contracts \ |
| 34 | + --structural-only |
| 35 | +``` |
| 36 | + |
| 37 | +For explicit paths: |
| 38 | + |
| 39 | +```bash |
| 40 | +python3 tools/sourceos_operation_conformance.py \ |
| 41 | + --examples-dir ../prophet-core-contracts/examples/workspace-operation \ |
| 42 | + --schemas-dir ../prophet-core-contracts/schemas |
| 43 | +``` |
| 44 | + |
| 45 | +## What structural validation checks |
| 46 | + |
| 47 | +- Every fixture is operation-centered. |
| 48 | +- `operation_id`, `operation_type`, `schema_version`, and `idempotency_key` are present. |
| 49 | +- Listed task IDs have corresponding task objects. |
| 50 | +- Listed artifact IDs have corresponding artifact objects. |
| 51 | +- Listed decision IDs have corresponding decision objects. |
| 52 | +- Listed policy gate IDs have corresponding policy gate objects. |
| 53 | +- Retryable tasks have idempotency keys. |
| 54 | +- Active artifacts are admitted or activated. |
| 55 | +- Quarantined artifacts are not active. |
| 56 | +- Pending decisions include options. |
| 57 | +- Blocking or decision-requiring gates include responsible actor and remediation options. |
| 58 | +- `awaiting_decision` operations include decisions. |
| 59 | +- `blocked` operations include policy gates. |
| 60 | + |
| 61 | +## Optional JSON Schema validation |
| 62 | + |
| 63 | +If `jsonschema` is installed, the runner also validates objects against: |
| 64 | + |
| 65 | +- `schemas/workspace-operation.schema.json` |
| 66 | +- `schemas/operation-task-event.schema.json` |
| 67 | +- `schemas/artifact-admission.schema.json` |
| 68 | +- `schemas/decision-policy-adapter.schema.json` |
| 69 | + |
| 70 | +This optional path is the bridge between the lightweight contract validation currently in `prophet-core-contracts` and a reusable SourceOS conformance runner that downstream repos can invoke. |
| 71 | + |
| 72 | +## Next work |
| 73 | + |
| 74 | +- Add a CLI wrapper once the repo's command layout is standardized. |
| 75 | +- Add adapter scaffolding commands. |
| 76 | +- Add redaction CLI for diagnostic bundles. |
| 77 | +- Emit machine-readable validation reports. |
| 78 | +- Add fixture-generation helpers for terminal, browser, local agent-machine, sync, and release operations. |
0 commit comments