-
Notifications
You must be signed in to change notification settings - Fork 1
Publish execution receipt schema files #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "$id": "https://commandlayer.org/schemas/execution/execution.receipt.schema.json", | ||
| "title": "CLAS Execution Receipt v1", | ||
| "description": "Scoped execution and private settlement receipt for clas.execution.receipt.v1.", | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "required": ["schema", "receipt_id", "verb", "agent", "action", "proofs"], | ||
| "properties": { | ||
| "schema": { "const": "clas.execution.receipt.v1" }, | ||
| "receipt_id": { "type": "string", "minLength": 1 }, | ||
| "parent_receipt_id": { "type": ["string", "null"], "minLength": 1 }, | ||
| "root_receipt_id": { "type": ["string", "null"], "minLength": 1 }, | ||
| "chain_id": { "type": ["string", "null"], "minLength": 1 }, | ||
| "verb": { "type": "string", "minLength": 1 }, | ||
| "agent": { "type": "string", "minLength": 1 }, | ||
| "action": { "type": "string", "minLength": 1 }, | ||
| "input": true, | ||
| "output": true, | ||
| "execution": { | ||
| "type": "object", | ||
| "additionalProperties": true, | ||
| "properties": { | ||
| "status": { "type": "string", "minLength": 1 }, | ||
| "duration_ms": { "type": "integer", "minimum": 0 } | ||
| } | ||
| }, | ||
| "settlement": { | ||
| "type": "object", | ||
| "additionalProperties": true, | ||
| "required": ["payment_ref", "payee_commitment"], | ||
|
Comment on lines
+29
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The privacy warning explicitly says not to publish fields such as Useful? React with 👍 / 👎. |
||
| "properties": { | ||
| "payment_ref": { "type": "string", "minLength": 1 }, | ||
| "payee_commitment": { "type": "string", "pattern": "^sha256:[A-Za-z0-9+/=_:-]+$" }, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The schema describes Useful? React with 👍 / 👎. |
||
| "amount": { "type": ["string", "number"] }, | ||
| "currency": { "type": "string", "minLength": 1 }, | ||
| "rail": { "type": "string", "minLength": 1 } | ||
| } | ||
| }, | ||
| "metadata": { | ||
| "type": "object", | ||
| "additionalProperties": true | ||
| }, | ||
| "proofs": { | ||
| "type": "array", | ||
| "minItems": 1, | ||
| "items": { "$ref": "#/$defs/proof" } | ||
|
Comment on lines
+44
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because Useful? React with 👍 / 👎. |
||
| } | ||
| }, | ||
| "$defs": { | ||
| "proof": { | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "required": ["type", "covers", "signer_id", "signature"], | ||
| "properties": { | ||
| "type": { "enum": ["execution", "settlement"] }, | ||
| "covers": { | ||
| "type": "array", | ||
| "minItems": 1, | ||
| "items": { "type": "string", "minLength": 1 } | ||
| }, | ||
| "canonicalization": { "type": "string", "default": "json.sorted_keys.v1" }, | ||
| "hash": { | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "required": ["alg", "value"], | ||
| "properties": { | ||
| "alg": { "type": "string", "minLength": 1 }, | ||
| "value": { "type": "string", "minLength": 1 } | ||
| } | ||
| }, | ||
| "signer_id": { "type": "string", "minLength": 1 }, | ||
| "signature": { | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "required": ["alg", "value"], | ||
| "properties": { | ||
| "alg": { "type": "string", "minLength": 1 }, | ||
| "kid": { "type": "string", "minLength": 1 }, | ||
| "value": { "type": "string", "minLength": 1 } | ||
| } | ||
| } | ||
| }, | ||
| "allOf": [ | ||
| { | ||
| "if": { "properties": { "type": { "const": "execution" } }, "required": ["type"] }, | ||
| "then": { "properties": { "covers": { "not": { "contains": { "const": "settlement" } } } } } | ||
|
Comment on lines
+86
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For Useful? React with 👍 / 👎. |
||
| }, | ||
| { | ||
| "if": { "properties": { "type": { "const": "settlement" } }, "required": ["type"] }, | ||
| "then": { "properties": { "covers": { "contains": { "const": "settlement" } } } } | ||
|
Comment on lines
+90
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The docs describe the settlement signer as covering only Useful? React with 👍 / 👎. |
||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "family_id": "execution", | ||
| "family_name": "Execution Receipts", | ||
| "family_status": "live", | ||
| "version": "v1", | ||
| "schemas": [ | ||
| { | ||
| "schema": "clas.execution.receipt.v1", | ||
| "kind": "receipt", | ||
| "path": "/schemas/execution/execution.receipt.schema.json", | ||
| "description": "Scoped execution receipt with optional private settlement attestation." | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,32 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| SRC_ROOT="${1:-../clas/schemas/trust-verification}" | ||
| DEST_ROOT="${2:-public/schemas/trust-verification}" | ||
| SRC_BASE="${1:-../clas/schemas}" | ||
| DEST_BASE="${2:-public/schemas}" | ||
| FAMILIES=("trust-verification" "execution") | ||
|
|
||
| if [[ ! -d "$SRC_ROOT" ]]; then | ||
| echo "Source directory not found: $SRC_ROOT" >&2 | ||
| if [[ ! -d "$SRC_BASE" ]]; then | ||
| echo "Source directory not found: $SRC_BASE" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| mkdir -p "$(dirname "$DEST_ROOT")" | ||
| rm -rf "$DEST_ROOT" | ||
| mkdir -p "$DEST_ROOT" | ||
| mkdir -p "$DEST_BASE" | ||
|
|
||
| cp -a "$SRC_ROOT"/. "$DEST_ROOT"/ | ||
| for family in "${FAMILIES[@]}"; do | ||
| src="$SRC_BASE/$family" | ||
| dest="$DEST_BASE/$family" | ||
|
|
||
| echo "Synced CLAS trust-verification schemas" | ||
| echo "Source: $SRC_ROOT" | ||
| echo "Destination: $DEST_ROOT" | ||
| find "$DEST_ROOT" -type f | sort | ||
| if [[ ! -d "$src" ]]; then | ||
| echo "Source family directory not found: $src" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| rm -rf "$dest" | ||
| mkdir -p "$dest" | ||
| cp -a "$src"/. "$dest"/ | ||
|
|
||
| echo "Synced CLAS $family schemas" | ||
| echo "Source: $src" | ||
| echo "Destination: $dest" | ||
| find "$dest" -type f | sort | ||
| done |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| const assert = require('node:assert/strict'); | ||
| const fs = require('node:fs'); | ||
| const path = require('node:path'); | ||
| const test = require('node:test'); | ||
|
|
||
| const schemaPath = path.join(process.cwd(), 'public', 'schemas', 'execution', 'execution.receipt.schema.json'); | ||
| const manifestPath = path.join(process.cwd(), 'public', 'schemas', 'execution', 'manifest.json'); | ||
| const indexPath = path.join(process.cwd(), 'public', 'schemas', 'index.json'); | ||
|
|
||
| test('execution receipt schema is published under public schemas', () => { | ||
| const schema = JSON.parse(fs.readFileSync(schemaPath, 'utf8')); | ||
|
|
||
| assert.equal(schema.properties.schema.const, 'clas.execution.receipt.v1'); | ||
| assert.equal(schema.$id, 'https://commandlayer.org/schemas/execution/execution.receipt.schema.json'); | ||
| assert.ok(schema.required.includes('proofs')); | ||
| }); | ||
|
|
||
| test('execution manifest and schema index expose the execution family', () => { | ||
| const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); | ||
| const index = JSON.parse(fs.readFileSync(indexPath, 'utf8')); | ||
|
|
||
| assert.equal(manifest.family_id, 'execution'); | ||
| assert.equal(manifest.schemas[0].path, '/schemas/execution/execution.receipt.schema.json'); | ||
| assert.ok(index.families.some((family) => family.family_id === 'execution' && family.manifest_path === '/schemas/execution/manifest.json')); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both the scoped execution docs and the execution receipt demo model valid
clas.execution.receipt.v1receipts withactionas an object containing fields likenameandinput_hash, but this newly published schema only accepts a non-empty string here. Consumers who fetch the public schema linked from the docs and validate those advertised receipt shapes will reject them before any proof-scope checks run, so the schema should accept the documented object shape or the examples should be changed.Useful? React with 👍 / 👎.