Skip to main content

Canonical control-plane schemas for the Relay agent reliability OS.

Project description

epochly-relay-schemas

Canonical control-plane schemas for the Relay agent reliability OS.

This package owns the canonical schema source-of-truth and the W1.5 codegen pipeline.

Source-of-truth file (W1.5)

raw/openapi.yaml is a single OpenAPI 3.1 document carrying every persisted control-plane envelope under components.schemas. The W1.5 codegen pipeline consumes this file via:

  • datamodel-code-generator -> packages/sdk-python/relay/_generated/ (Pydantic v2 BaseModel subclasses with extra='forbid')
  • openapi-typescript -> packages/sdk-typescript/src/_generated/ (TypeScript type aliases + named re-exports)

Regenerate via:

uv run python packages/schemas/scripts/codegen.py

Drift check (VAL-W1-035):

uv run python scripts/check-codegen-drift.py

Two-layer architecture

The W1.5 generated layer carries the BASE canonical models (one Pydantic class per envelope; one TS type alias per envelope) with the extra='forbid' discipline. The hand-authored W1.1-W1.4 modules under packages/schemas/python/relay_schemas/envelopes.py and packages/schemas/typescript/src/envelopes.ts add the RICH validation layer:

  • Cross-field invariants (accepted_requires_evidence, raw_capture_requires_dpa_and_approver, dry_run_never_resolves).
  • RFC 3339 timezone-offset enforcement (VAL-W1-017, VAL-W1-024).
  • StrictBool rejection of string coercion (VAL-W1-023, VAL-W1-026).
  • Canonical-byte serializers for cross-language round-trip evidence.
  • The discriminated-union ScopeState metaclass adapter.

The generated layer and the hand-authored layer are independent: the generated classes are NOT subclassed by the hand-authored classes. Future W1.6 + cross-language fixtures consume both layers and verify them against the same JSON canonical form.

Two-layer convention (LOCKED post-W1.6, orchestrator decision 2026-05-13)

The two-layer architecture is the chosen convention for v0.1 and is not provisional. The hand-authored rich-validation layer addresses validation shapes that OpenAPI 3.1 cannot express directly (cross-field validators, StrictBool semantics, canonical-byte serializers). Folding rich validation into OpenAPI vendor extensions is OUT OF SCOPE for v0.1.

To prevent silent drift between raw/envelopes.yaml (rich-layer source) and raw/openapi.yaml (generated-layer source), the CI cross-YAML alignment check at packages/schemas/python/tests/test_yaml_alignment.py enforces:

  • Both YAMLs enumerate exactly the same envelope names.
  • Each shared envelope's schema_version Literal is identical across the two sources.
  • Each shared envelope's closed enums (status, action, draft_kind, etc.) carry identical member sets across the two sources.

The alignment check runs under the tier-1 plumbing marker (-m plumbing) on every commit. A failure means a drift has been introduced and one of the two YAMLs needs amendment to restore parity.

When a new canonical envelope is introduced (W2+ milestones), it lands in BOTH YAMLs in the same commit, with the alignment check verifying parity before merge.

Layout

  • raw/openapi.yaml - canonical OpenAPI 3.1 source-of-truth (W1.5).
  • raw/envelopes.yaml - W1.1-W1.4 custom-format YAML; lock-in documentation companion only (not a codegen source).
  • raw/relay-error-codes.yaml - canonical RELAY-* error code registry.
  • raw/owner-email-deny.yaml - canonical group-email deny prefixes (W1.4).
  • python/relay_schemas/ - W1.1-W1.4 hand-authored rich-validation envelopes.
  • typescript/src/ - W1.1-W1.4 hand-authored TS runtime guards.
  • sql/ - W1.1-W1.4 SQL DDL migrations (FK targets and CHECK constraints).
  • scripts/codegen.py - W1.5 codegen orchestrator (this file's home).
  • scripts/gen_error_codes.py - W1.4 error-codes generator (called by W1.5).
  • python/tests/ - W1 contract assertion tests (pytest, tier-1 plumbing).

Versioning

Per CLAUDE.md keystone invariant #10: every canonical envelope carries a schema_version field pinned to a string literal. Engines refuse unknown versions on write. The W1.5 codegen pipeline emits a RelayUnknownSchemaVersionError helper (Python + TS) that callers use via parse_envelope(...) / parseEnvelope(...) to surface forward-compat failures with a stable error type (VAL-W1-036).

License

Apache 2.0. See repository root LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epochly_relay_schemas-0.1.12.tar.gz (159.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epochly_relay_schemas-0.1.12-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

Details for the file epochly_relay_schemas-0.1.12.tar.gz.

File metadata

  • Download URL: epochly_relay_schemas-0.1.12.tar.gz
  • Upload date:
  • Size: 159.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for epochly_relay_schemas-0.1.12.tar.gz
Algorithm Hash digest
SHA256 92af707303ea50366ae5f780e1ad83c43ff1070453910851be3bb6af56ee163b
MD5 f22763b79ae01e2a9a3f72fa97bda06f
BLAKE2b-256 fc9bd344b4e7e61b71a0f9356485e930b570e8040c4f0bb6316307a4c21f3e56

See more details on using hashes here.

Provenance

The following attestation bundles were made for epochly_relay_schemas-0.1.12.tar.gz:

Publisher: release-pypi.yml on epochly-inc/relay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file epochly_relay_schemas-0.1.12-py3-none-any.whl.

File metadata

File hashes

Hashes for epochly_relay_schemas-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 8fb15490971ec592e1c4973e3b6c21723697f57a5a9f2121bc2318655c0f20be
MD5 55422c2e776b9d717de3587f5133e3fc
BLAKE2b-256 85bfe9ca349682b1957f4d4a2aa102e7a3b449f3ba1c29b698df2c9860318868

See more details on using hashes here.

Provenance

The following attestation bundles were made for epochly_relay_schemas-0.1.12-py3-none-any.whl:

Publisher: release-pypi.yml on epochly-inc/relay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page