Schema guard

Check a proposed API or data contract against the current contract, real sample payloads, and a compatibility policy, and gate publication behind a refusable verdict with native digest evidence.

You’re reading version sha-a85b7a0b3f04. Go to the current version

Overview

Schema Check decides whether a proposed contract change can move forward without silently breaking callers. It compares the current and proposed JSON Schema contracts field by field, validates every supplied sample payload against the proposed contract, applies the caller's compatibility policy, and either refuses or emits a gated publish proposal. It never publishes anything itself.

In the manual

Runner

  • check

Declared by its execution profile. Read the profile

SKILL.md

Schema Check

Schema Check decides whether a proposed contract change can move forward without silently breaking callers. It compares the current and proposed JSON Schema contracts field by field, validates every supplied sample payload against the proposed contract, applies the caller's compatibility policy, and either refuses or emits a gated publish proposal. It never publishes anything itself.

Procedure

  1. Native data.digest binds the exact current schema, proposed schema, and sample set before any judgment, so the verdict is tied to specific bytes.
  2. Deterministic comparison walks both contracts: removed fields, type changes, fields that became required, new required fields, and narrowed enums are breaking; additive optional fields and expanded enums are notes.
  3. Native data.validate compiles both schemas and validates every sample against each contract using JSON Schema 2020-12, with external retrieval disabled. Coverage is reported honestly: paths no sample exercises are flagged, not assumed covered.
  4. The policy decides the verdict. Breaking changes are refused unless breaking_allowed is explicitly true, and policy required_fields must exist in the proposed contract.
  5. A compatible verdict emits a proposal with the three digests and changed paths, gated on a schema publisher or human approver. A refused verdict emits no proposal. live_write_performed is always false.

Invalid requests refuse with policy_result: invalid_input and findings rather than guessing. Missing required inputs fail at admission.

Output

schema_check (runx.schema_check.v1) carries decision, policy_result, breaking_changes, per-sample validation_results, migration_notes including coverage, the gated proposal or null, and validation.

Inputs are current_schema, proposed_schema, sample_payloads, and compatibility_policy.

What compatibility means

Sample validity is not a proof that every existing caller remains compatible. The inclusion comparison supports object properties, required fields, scalar types, enums and boolean additionalProperties. It compares root constraints as well as nested fields. A newly constrained enum and a newly closed object are changes that may reject existing callers.

The native validator supports the full self-contained schema, including minLength, numeric bounds, nested arrays, composition and local references. If a changed contract uses constraints outside the inclusion comparison's supported language, the result is refused with compatibility.unsupported findings, even if its samples happen to pass or breaking changes are allowed. Identical schemas need no inclusion inference but still compile and validate their samples. Formats are annotations. This skill never fetches remote schemas.

For example, adding minLength: 10 to a string with sample "x" fails native validation; it cannot receive a compatible verdict. Missing required fields, removed enum values and unknown comparison semantics remain visible. A proposal is not publication approval. Its digests bind the exact proposed change; the actual schema publisher owns authorization, publication and readback.

Published execution profile

The execution profile published with sha-a85b7a0b3f04, shown as its exact bytes.

Runner
  • check
Profile digestsha256:84a6ce0be8f9b0d8dd885b7eb895f61607638342cad3d1a2f8341be5ce2ebf57
skill: schema-check
version: "0.1.7"
catalog:
  kind: graph
  audience: public
  visibility: public
  category: code
  role: canonical
  execution: read
  completion: runtime_receipt
  approval: none
harness:
  files:
  - fixtures/support/composed.graph
  cases:
  - name: schema-check-additive-change-proposes
    operator_journeys:
    - mode: standalone
      confusors:
      - extract
      - skill-review
      request: Check whether this proposed contract change breaks existing callers before the schema is
        published.
      expected_outcome: Return a compatibility verdict with per-sample validation and a gated publish
        proposal, with no live write.
    - mode: composed
      request: Continue from this already checked schema change and its compatibility verdict.
      expected_outcome: Reuse the supplied verdict and digests without re-deriving the comparison.
      prior_evidence:
      - The current schema, proposed schema, samples, and policy supplied in the fixture.
      must_not_repeat:
      - Do not re-run the schema comparison already sealed in the verdict.
    inputs:
      current_schema:
        type: object
        required:
        - id
        properties:
          id:
            type: string
          status:
            type: string
            enum:
            - open
            - closed
      proposed_schema:
        type: object
        required:
        - id
        properties:
          id:
            type: string
          status:
            type: string
            enum:
            - open
            - closed
          note:
            type: string
      sample_payloads:
      - id: case-1
        status: open
      - id: case-2
        status: closed
        note: resolved by vendor
      compatibility_policy:
        breaking_allowed: false
        required_fields:
        - id
        versioning_rule: minor_on_additive
    expect:
      status: sealed
      steps:
      - digest-current
      - digest-proposed
      - digest-samples
      - validate-current
      - validate-proposed
      - check
      step_outputs:
        check:
          subset:
            schema_check:
              data:
                schema: runx.schema_check.v1
                decision: compatible
                policy_result: allowed
                breaking_changes: []
                proposal:
                  status: proposed
                  live_write_performed: false
                  changed_paths:
                  - $.note
                validation:
                  status: pass
                  findings: []
      receipt:
        schema: runx.receipt.v1
  - name: schema-check-breaking-change-refuses
    inputs:
      current_schema:
        type: object
        required:
        - id
        properties:
          id:
            type: string
          amount:
            type: number
      proposed_schema:
        type: object
        required:
        - id
        - amount
        properties:
          id:
            type: string
          amount:
            type: string
      sample_payloads:
      - id: case-1
        amount: 12.5
      compatibility_policy:
        breaking_allowed: false
        required_fields:
        - id
    expect:
      status: sealed
      steps:
      - digest-current
      - digest-proposed
      - digest-samples
      - validate-current
      - validate-proposed
      - check
      step_outputs:
        check:
          subset:
            schema_check:
              data:
                decision: refused
                policy_result: blocked_by_policy
                proposal: null
      receipt:
        schema: runx.receipt.v1
  - name: schema-check-invalid-samples-refuse
    inputs:
      current_schema:
        type: object
        properties:
          id:
            type: string
      proposed_schema:
        type: object
        properties:
          id:
            type: string
      sample_payloads: []
      compatibility_policy:
        breaking_allowed: false
    expect:
      status: sealed
      steps:
      - digest-current
      - digest-proposed
      - digest-samples
      - validate-current
      - validate-proposed
      - check
      step_outputs:
        check:
          subset:
            schema_check:
              data:
                decision: refused
                policy_result: invalid_input
                proposal: null
                validation:
                  status: fail
      receipt:
        schema: runx.receipt.v1
  - name: schema-check-needs-proposed-schema
    inputs:
      current_schema:
        type: object
        properties:
          id:
            type: string
      sample_payloads:
      - id: case-1
      compatibility_policy:
        breaking_allowed: false
    expect:
      status: failure
  - name: refuses-minlength-regression
    inputs:
      current_schema:
        type: string
      proposed_schema:
        type: string
        minLength: 10
      sample_payloads:
      - x
      compatibility_policy:
        breaking_allowed: false
    expect:
      status: sealed
      steps:
      - digest-current
      - digest-proposed
      - digest-samples
      - validate-current
      - validate-proposed
      - check
      step_outputs:
        check:
          subset:
            schema_check:
              data:
                decision: refused
      receipt:
        schema: runx.receipt.v1
  - name: refuses-unproved-array-compatibility
    inputs:
      current_schema:
        type: array
        items:
          type: number
      proposed_schema:
        type: array
        items:
          type: number
          minimum: 0
      sample_payloads:
      - - 1
        - 2
      compatibility_policy:
        breaking_allowed: false
    expect:
      status: sealed
      steps:
      - digest-current
      - digest-proposed
      - digest-samples
      - validate-current
      - validate-proposed
      - check
      step_outputs:
        check:
          subset:
            schema_check:
              data:
                decision: refused
      receipt:
        schema: runx.receipt.v1
  - name: accepts-integers-as-jsonschema-numbers
    inputs:
      current_schema:
        type: number
      proposed_schema:
        type: number
      sample_payloads:
      - 2
      compatibility_policy:
        breaking_allowed: false
    expect:
      status: sealed
      steps:
      - digest-current
      - digest-proposed
      - digest-samples
      - validate-current
      - validate-proposed
      - check
      step_outputs:
        check:
          subset:
            schema_check:
              data:
                decision: compatible
      receipt:
        schema: runx.receipt.v1
  - name: refuses-new-root-enum
    inputs:
      current_schema:
        type: string
      proposed_schema:
        type: string
        enum:
        - only
      sample_payloads:
      - only
      compatibility_policy:
        breaking_allowed: false
    expect:
      status: sealed
      steps:
      - digest-current
      - digest-proposed
      - digest-samples
      - validate-current
      - validate-proposed
      - check
      step_outputs:
        check:
          subset:
            schema_check:
              data:
                decision: refused
      receipt:
        schema: runx.receipt.v1
  - name: refuses-new-undeclared-required-field
    inputs:
      current_schema:
        type: object
      proposed_schema:
        type: object
        required:
        - new
      sample_payloads:
      - new: true
      compatibility_policy:
        breaking_allowed: false
    expect:
      status: sealed
      steps:
      - digest-current
      - digest-proposed
      - digest-samples
      - validate-current
      - validate-proposed
      - check
      step_outputs:
        check:
          subset:
            schema_check:
              data:
                decision: refused
      receipt:
        schema: runx.receipt.v1
runners:
  check:
    default: true
    inputs:
      current_schema:
        type: json
        required: true
        description: Current JSON Schema object contract callers depend on today.
      proposed_schema:
        type: json
        required: true
        description: Proposed JSON Schema object contract to check before publication.
      sample_payloads:
        type: json
        required: true
        description: Non-empty array of real payloads validated against the proposed contract.
      compatibility_policy:
        type: object
        required: true
        description: Compatibility policy for this contract; breaking changes are refused unless explicitly
          allowed.
        schema:
          additionalProperties: false
          properties:
            breaking_allowed:
              type: boolean
              description: Whether breaking changes may pass; defaults to refusal.
            required_fields:
              type: array
              maxItems: 100
              items:
                type: string
                minLength: 1
                maxLength: 500
              description: Field paths that must exist in the proposed contract.
            versioning_rule:
              type: string
              maxLength: 200
              description: Versioning rule recorded with the verdict.
    examples:
    - current_schema:
        type: object
        required:
        - id
        properties:
          id:
            type: string
      proposed_schema:
        type: object
        required:
        - id
        properties:
          id:
            type: string
          note:
            type: string
      sample_payloads:
      - id: case-1
      compatibility_policy:
        breaking_allowed: false
        required_fields:
        - id
    result_from:
    - check
    steps:
    - id: digest-current
      tool: data.digest
      inputs:
        value: $input.current_schema
    - id: digest-proposed
      tool: data.digest
      inputs:
        value: $input.proposed_schema
    - id: digest-samples
      tool: data.digest
      inputs:
        value: $input.sample_payloads
    - id: validate-current
      tool: data.validate
      inputs:
        schema: $input.current_schema
        values: $input.sample_payloads
    - id: validate-proposed
      tool: data.validate
      inputs:
        schema: $input.proposed_schema
        values: $input.sample_payloads
    - id: check
      label: compare contracts, validate samples, and gate the proposal
      inputs:
        current_schema: $input.current_schema
        proposed_schema: $input.proposed_schema
        sample_payloads: $input.sample_payloads
        compatibility_policy: $input.compatibility_policy
        current_digest: $steps.digest-current.digest_result.digest
        proposed_digest: $steps.digest-proposed.digest_result.digest
        samples_digest: $steps.digest-samples.digest_result.digest
        current_validation: $steps.validate-current.validation
        proposed_validation: $steps.validate-proposed.validation
      tool:
        module: schema-check.mjs
        export: checkSchemaChange
      outputs:
        schema_check:
          type: object
          schema:
            required:
            - schema
            - decision
            - policy_result
            - breaking_changes
            - validation_results
            - migration_notes
            - proposal
            - validation
            additionalProperties: false
            properties:
              schema:
                const: runx.schema_check.v1
              decision:
                type: string
                enum:
                - compatible
                - refused
              policy_result:
                type: string
                enum:
                - allowed
                - blocked_by_policy
                - invalid_input
              breaking_changes:
                type: array
                maxItems: 500
                items:
                  type: object
                  required:
                  - path
                  - old_contract
                  - new_contract
                  - policy_rule
                  additionalProperties: false
                  properties:
                    path:
                      type: string
                      minLength: 1
                      maxLength: 2000
                    old_contract:
                      type: string
                      minLength: 1
                      maxLength: 2000
                    new_contract:
                      type: string
                      minLength: 1
                      maxLength: 2000
                    policy_rule:
                      type: string
                      minLength: 1
                      maxLength: 200
              validation_results:
                type: array
                maxItems: 1000
                items:
                  type: object
                  required:
                  - sample_index
                  - valid
                  - errors
                  additionalProperties: false
                  properties:
                    sample_index:
                      type: integer
                      minimum: 0
                    valid:
                      type: boolean
                    errors:
                      type: array
                      maxItems: 500
                      items:
                        type: string
                        minLength: 1
                        maxLength: 2000
              migration_notes:
                type: array
                maxItems: 1000
                items:
                  type: object
                  required:
                  - path
                  - kind
                  - note
                  additionalProperties: false
                  properties:
                    path:
                      type: string
                      minLength: 1
                      maxLength: 2000
                    kind:
                      type: string
                      minLength: 1
                      maxLength: 200
                    note:
                      type: string
                      minLength: 1
                      maxLength: 2000
              proposal:
                type:
                - object
                - 'null'
                properties:
                  status:
                    const: proposed
                  gate:
                    type: string
                    minLength: 1
                    maxLength: 200
                  live_write_performed:
                    const: false
                  current_schema_digest:
                    type: string
                    pattern: ^sha256:[0-9a-f]{64}$
                  proposed_schema_digest:
                    type: string
                    pattern: ^sha256:[0-9a-f]{64}$
                  samples_digest:
                    type: string
                    pattern: ^sha256:[0-9a-f]{64}$
                  changed_paths:
                    type: array
                    maxItems: 500
                    items:
                      type: string
                      minLength: 1
                      maxLength: 2000
              validation:
                type: object
                required:
                - status
                - findings
                additionalProperties: false
                properties:
                  status:
                    type: string
                    enum:
                    - pass
                    - fail
                  findings:
                    type: array
                    maxItems: 50
                    items:
                      type: object
                      required:
                      - code
                      - message
                      additionalProperties: false
                      properties:
                        code:
                          type: string
                          minLength: 1
                          maxLength: 200
                        message:
                          type: string
                          minLength: 1
                          maxLength: 2000
      artifacts:
        named_emits:
          schema_check: schema_check

Published package and test evidence.

This exact version passed its recorded harness run: 11 checks passed · 0 failed.

Test result

Harness resultPassed
Tested versionsha-a85b7a0b3f04
Recorded result11 checks passed · 0 failed
Result sourceReported by the publisher (runx_registry_publish)
Suiterunx-harness
Test recorded
Declared cases9
Test recordOpen the recorded run
Inspect receipt referencessha256:ad985ac24cd3b4cd4859ad2a899d3610cc7c385eb9c7801f9b77bb0090656f85sha256:84479e5cfbf1dafc0c3f7dc11ccf4c8d33cafea3f733fcb09923ff14d6fb8e4fsha256:f6fd06243cd735dba385e1a23eba2c3db5e1d48a55266fdf42b1d9a56f1fc25dsha256:6407e23fe5c5239c41393cf1a1633092d4ac782b52485e6aa00dee04ca427f56sha256:214632b7dac4f2af7a9e71be8df39f6c017556594d4589d6775e71255e9153b1sha256:3547376a37ef72889afdf80cb0fbd2abfb2e4ade62ffaafac83b6ee8281e5009sha256:b6d6a8bfd66fa4ffa2c8eba441dea92661e163fb38677931f303a4ab4fd6c2e3sha256:846d65c4c0978bf2b304431cdc176a1b29f8eeaa278bad7227fe050f1a2776b8sha256:89df5efb6d921bb75bdaa4e871a43d62ce07d857a4e9c0ef56f2cb98dba51cddsha256:aef4ba7599f24ea11e725d1b84b10c3a92456e21544bfa3fb590e57407a856c8sha256:d9716bac8f5a6bd8048e7ead8b58f09974c5cfe62b13fe5140fe8ded13d9baaf

Package identity

Published revisionsha-a85b7a0b3f04
Content digestsha256:a85b7a0b3f0456115d77c09be42bf1bc1e1b8f28ead5d3f2a99515a794d3f61e
SKILL.md digestsha256:b29b3dcd62bbf160a8711e34d32329c2c9654bf3c76bc9229b94661feb76fae4
Execution profile digestsha256:84a6ce0be8f9b0d8dd885b7eb895f61607638342cad3d1a2f8341be5ce2ebf57
Publisher identityVerified publisher · runx
Trust tierVerified publisherRunx has verified this publisher. This tier is not a code assessment.
Attestations
  • Publisher · Verifiedrunx · 18 Oct 2026
Source provenanceNot published with this version

Version history

  1. 0.1.8Content digest sha256:99baca00ac4239a70c77ac97cf975ac8814267397d944eb7cd26592eb02aebab
  2. sha-a85b7a0b3f04ViewingContent digest sha256:a85b7a0b3f0456115d77c09be42bf1bc1e1b8f28ead5d3f2a99515a794d3f61e