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-a3b8e6ee3044. 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 with name, version, and fields.
  • proposed_schema: object with name, version, and fields.
  • 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 as semver_minor_for_additive or semver_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

  1. Refuse missing or malformed current/proposed schemas.
  2. Compare every current field with the proposed field at the same path.
  3. 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.
  4. Validate every supplied sample payload against the proposed schema and record missing required fields, type mismatches, and enum violations.
  5. Treat missing sample coverage as unknown evidence, not proof.
  6. If breaking changes exist and breaking_allowed is false, set compatibility.compatible to false and emit no publish_schema_proposal.
  7. 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.
  8. Never invent sample coverage, live registry state, or unpublished schema effects.

Output schema

The runner emits runx.schema_guard.v1:

json
{
  "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_path
  • old_contract
  • new_contract
  • policy_rule

Worked example

bash
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"}' \
  --json

Expected result: compatibility.compatible = true, zero breaking changes, sample validation recorded, and a gated publish_schema_proposal for review.

Validation

Run from the repository root:

bash
runx harness ./skills/schema-guard

Expected 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-a3b8e6ee3044, shown as its exact bytes.

Runner
  • guard
Profile digestsha256:502ff86f0b69adb6e5d0c590e092e24c6063b9efda534fd73a322da20f979397
skill: schema-guard
version: 0.1.0
catalog:
  kind: skill
  audience: public
  visibility: public
  role: canonical
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.

The latest recorded test covers an earlier version, sha-150b8b5650ca. It does not establish a result for this version.

Test result

Harness resultAn earlier version was tested
Tested versionsha-150b8b5650caNot this page’s version, sha-a3b8e6ee3044
Recorded result3 checks passed · 0 failed
Result sourceReported by the publisher (runx_registry_publish)
Suiterunx-harness
Test recorded
Declared cases3

Package identity

Published revisionsha-a3b8e6ee3044
Content digestsha256:a3b8e6ee3044fdf9539feb4c0446f5aae5521ffdac2398d29cab60f701312568
SKILL.md digestsha256:b539817b9af6c21501d9ec4cfa58a0e18c37c3ebc632892ca2cd28c5d78e6749
Execution profile digestsha256:502ff86f0b69adb6e5d0c590e092e24c6063b9efda534fd73a322da20f979397
Publisher identityUnverified publisher · rohitmulani63-ops
Trust tierCommunityPublished through the registry without publisher verification. This tier is not a code assessment.
Attestations
  • Publisher · Declaredrohitmulani63-ops · 13 Oct 2026
Source provenanceNot published with this version

Version history

  1. sha-150b8b5650caContent digest sha256:150b8b5650caa9f63bf8bed5bf071fe4cf5f1a400bfa4076fea7779d85690292
  2. sha-dd8989e2b8a1Content digest sha256:dd8989e2b8a19bc4a13cd95d52854ca2f94075fc8d33f81353855359890c0c0d
  3. sha-2b12e0f26f92Content digest sha256:2b12e0f26f926434d2fc85b2f5f8f78d3960abf54371ee04ac5b921c42d3f976
  4. sha-a3b8e6ee3044ViewingContent digest sha256:a3b8e6ee3044fdf9539feb4c0446f5aae5521ffdac2398d29cab60f701312568