Schema guard
Compare a proposed schema against a current contract and emit a gated publish proposal only when compatibility is proven from policy and samples.
You’re reading version sha-dd8989e2b8a1. Go to the current version
Overview
schema-guard reviews a current schema, a proposed schema, bounded sample
payloads, and a compatibility policy. It reports whether the proposed schema is
safe to publish, identifies breaking changes by field path and policy rule, and
emits a publish_schema_proposal only when the change is compatible.
The skill does not write schemas, call registries, mutate repositories, or notify
customers. The proposal is gated for a human schema approver or the governed
schema-publisher executor from the runx-skills-v3 wave.
In the manual
Runner
guard
Declared by its execution profile. Read the profile
SKILL.md
schema-guard
schema-guard reviews a current schema, a proposed schema, bounded sample
payloads, and a compatibility policy. It reports whether the proposed schema is
safe to publish, identifies breaking changes by field path and policy rule, and
emits a publish_schema_proposal only when the change is compatible.
The skill does not write schemas, call registries, mutate repositories, or notify
customers. The proposal is gated for a human schema approver or the governed
schema-publisher executor from the runx-skills-v3 wave.
Inputs
current_schema: object withname,version, andfields.proposed_schema: object withname,version, andfields.sample_payloads: array of bounded sample objects to validate against both contracts.compatibility_policy: object with:breaking_allowed: boolean.required_fields: array of field names that must remain present and required.versioning_rule: human-readable rule such assemver_minor_for_additiveorsemver_major_for_breaking.
Each field may be written as either {type, required, enum} or a simple type
string. Nested field names can be expressed with dot paths.
Decision rules
- Refuse missing or malformed current/proposed schemas.
- Compare every current field with the proposed field at the same path.
- Mark a breaking change when a required field is removed, a required field is made optional, a field type changes, an enum narrows, or a policy-required field is absent or optional.
- Validate every supplied sample payload against the proposed schema and record missing required fields, type mismatches, and enum violations.
- Treat missing sample coverage as unknown evidence, not proof.
- If breaking changes exist and
breaking_allowedis false, setcompatibility.compatibleto false and emit nopublish_schema_proposal. - If there are no blocking changes, emit a gated proposal containing the schema name, version transition, field changes, sample count, validation summary, and approval gate.
- Never invent sample coverage, live registry state, or unpublished schema effects.
Output schema
The runner emits runx.schema_guard.v1:
{
"status": "compatible",
"compatibility": {
"compatible": true,
"status": "compatible",
"summary": "Additive schema change is compatible with the supplied policy.",
"breaking_changes": [],
"unknowns": []
},
"validation_results": [
{
"sample_index": 0,
"valid_current": true,
"valid_proposed": true,
"missing_required": [],
"type_mismatches": [],
"enum_violations": []
}
],
"migration_notes": [
{
"kind": "additive_field",
"field_path": "memo",
"note": "Optional field added; existing samples remain valid."
}
],
"publish_schema_proposal": {
"target": "schema-publisher",
"approval_gate": "requires_human_or_schema_publisher_approval",
"schema_name": "invoice_event",
"from_version": "1.0.0",
"to_version": "1.1.0",
"proposal_status": "ready_for_review"
},
"evidence": {
"side_effects": "none",
"sample_count": 2,
"compatibility_status": "compatible",
"breaking_changes_count": 0,
"proposal_status": "ready_for_review"
}
}When a breaking change is refused, publish_schema_proposal is null,
compatibility.compatible is false, and each breaking change includes:
field_pathold_contractnew_contractpolicy_rule
Worked example
runx skill ./skills/schema-guard \
--runner guard \
--input-json current_schema='{"name":"invoice_event","version":"1.0.0","fields":{"id":{"type":"string","required":true}}}' \
--input-json proposed_schema='{"name":"invoice_event","version":"1.1.0","fields":{"id":{"type":"string","required":true},"memo":{"type":"string","required":false}}}' \
--input-json sample_payloads='[{"id":"inv_1","memo":"ok"}]' \
--input-json compatibility_policy='{"breaking_allowed":false,"required_fields":["id"],"versioning_rule":"semver_minor_for_additive"}' \
--jsonExpected result: compatibility.compatible = true, zero breaking changes, sample
validation recorded, and a gated publish_schema_proposal for review.
Validation
Run from the repository root:
runx harness ./skills/schema-guardExpected harness cases:
additive-compatible-proposal: sealed, compatible, emits a gated proposal.breaking-change-refused-no-proposal: sealed, detects breaking changes and emits no proposal.missing-schema-failure: fails when the required schema input is absent.
Safety boundary
schema-guard is non-mutating. It does not publish schemas, write files outside
its run, change registries, call external services, send notifications, or claim
that sample coverage exists when it was not supplied. It only emits a reviewable
compatibility packet.
Published execution profile
The execution profile published with sha-dd8989e2b8a1, shown as its exact bytes.
| Runner |
|
|---|---|
| Profile digest | sha256:18553848a53fb0e13e86fc9a0fffc5d4ff780ea62d65351984d5de5beb762658 |
skill: schema-guard
version: 0.1.0
catalog:
kind: skill
audience: public
visibility: public
role: canonical
category: code
runners:
guard:
default: true
inputs:
current_schema:
type: json
required: true
description: Current schema contract with fields, required flags, types, and optional enum values.
proposed_schema:
type: json
required: true
description: Proposed schema contract to compare against the current schema.
sample_payloads:
type: json
required: true
description: Bounded sample payloads used only for compatibility evidence.
compatibility_policy:
type: json
required: true
description: Policy object with breaking_allowed, required_fields, and versioning_rule.
steps:
- id: guard
tool:
command: node
args:
- run.mjs
inputs:
current_schema: $input.current_schema
proposed_schema: $input.proposed_schema
sample_payloads: $input.sample_payloads
compatibility_policy: $input.compatibility_policy
artifacts:
wrap_as: schema_guard_packet
harness:
cases:
- name: additive-compatible-proposal
runner: guard
inputs:
current_schema:
name: invoice_event
version: 1.0.0
fields:
id:
type: string
required: true
amount_cents:
type: number
required: true
status:
type: string
required: true
enum:
- draft
- paid
proposed_schema:
name: invoice_event
version: 1.1.0
fields:
id:
type: string
required: true
amount_cents:
type: number
required: true
status:
type: string
required: true
enum:
- draft
- paid
memo:
type: string
required: false
sample_payloads:
- id: inv_1
amount_cents: 1200
status: paid
- id: inv_2
amount_cents: 0
status: draft
memo: optional note
compatibility_policy:
breaking_allowed: false
required_fields:
- id
- amount_cents
- status
versioning_rule: semver_minor_for_additive
expect:
status: sealed
receipt:
schema: runx.receipt.v1
operator_journeys:
- mode: standalone
confusors:
- extract
- skill-review
request: Check whether this schema change breaks existing callers.
expected_outcome: Return a compatibility verdict and enforce the policy before anything publishes.
- mode: composed
request: Continue this schema-guard work from evidence already gathered upstream.
expected_outcome: Return a compatibility verdict and enforce the policy before anything publishes.
prior_evidence:
- The current schema, proposed schema and samples already supplied.
must_not_repeat:
- Do not publish the schema.
- name: breaking-change-refused-no-proposal
runner: guard
inputs:
current_schema:
name: invoice_event
version: 1.0.0
fields:
id:
type: string
required: true
amount_cents:
type: number
required: true
status:
type: string
required: true
proposed_schema:
name: invoice_event
version: 2.0.0
fields:
id:
type: string
required: true
amount_cents:
type: string
required: true
state:
type: string
required: true
sample_payloads:
- id: inv_3
amount_cents: 1500
status: paid
compatibility_policy:
breaking_allowed: false
required_fields:
- id
- amount_cents
- status
versioning_rule: semver_major_for_breaking
expect:
status: sealed
receipt:
schema: runx.receipt.v1
- name: missing-schema-failure
runner: guard
inputs:
current_schema: {}
sample_payloads: []
compatibility_policy:
breaking_allowed: false
required_fields:
- id
versioning_rule: semver_minor_for_additive
expect:
status: failure
Published package and test evidence.
This exact version passed its recorded harness run: 3 checks passed · 0 failed.
Test result
| Harness result | Passed |
|---|---|
| Tested version | sha-dd8989e2b8a1 |
| Recorded result | 3 checks passed · 0 failed |
| Result source | Reported by the publisher (runx_registry_publish) |
| Suite | runx-harness |
| Test recorded | |
| Declared cases | 3 |
| Test record | Open the recorded run |
Inspect receipt references
sha256:34178bbe9e65457319be0d08412ab3dfe440b3c8ee0f1f8a7ffa0f10484897f9sha256:81286f3eea21c287e539942ab21f685bf63e787350b2117c5b7b18acd3751746sha256:953d3990c29b68475d0c791eb7e737e211691b43ed7299da74ed1bd8b4ed55fbPackage identity
| Published revision | sha-dd8989e2b8a1 |
|---|---|
| Content digest | sha256:dd8989e2b8a19bc4a13cd95d52854ca2f94075fc8d33f81353855359890c0c0d |
| SKILL.md digest | sha256:b539817b9af6c21501d9ec4cfa58a0e18c37c3ebc632892ca2cd28c5d78e6749 |
| Execution profile digest | sha256:18553848a53fb0e13e86fc9a0fffc5d4ff780ea62d65351984d5de5beb762658 |
| Publisher identity | Unverified publisher · rohitmulani63-ops |
| Trust tier | CommunityPublished through the registry without publisher verification. This tier is not a code assessment. |
| Attestations |
|
| Source provenance | Not published with this version |
Version history
sha-150b8b5650caContent digest sha256:150b8b5650caa9f63bf8bed5bf071fe4cf5f1a400bfa4076fea7779d85690292sha-dd8989e2b8a1ViewingContent digest sha256:dd8989e2b8a19bc4a13cd95d52854ca2f94075fc8d33f81353855359890c0c0dsha-2b12e0f26f92Content digest sha256:2b12e0f26f926434d2fc85b2f5f8f78d3960abf54371ee04ac5b921c42d3f976sha-a3b8e6ee3044Content digest sha256:a3b8e6ee3044fdf9539feb4c0446f5aae5521ffdac2398d29cab60f701312568