Worked Examples
Apply cross-application schemas — Sustainable Catalyst Platform Core
Apply versioned cross-application schemas by validating object identity, field meaning, scientific units, compatibility ranges, authorization, and provenance before data moves between Sustainable Catalyst services. This developer guide provides the native Platform Core exchange contract, a reproducible consumer validation example, rejection tests, and read-only database diagnostics for safe, traceable research handoffs.
Application: Sustainable Catalyst Platform Core
Component: Cross-Product Contracts, Evidence Exchange & Research Handoffs
Status: Source-reviewed developer procedure; offline validation only; staging and production verification pending.
Source baseline: 59b8444365525a58fd4f6a7e29a20d712769e1a2
Estimated reading time: 22–28 minutes
Purpose: Apply versioned cross-application schemas to research and administrative objects without changing their original meaning, authority, provenance, units or rights. Use a staged compatibility gate to reject incompatible data before import, derived-object creation or publication.
Goal
Establish a deterministic, testable compatibility decision before a research object crosses from a producing application to a consuming application. The consumer must either (a) accept a versioned contract with preserved identity, quantity semantics, rights, and provenance, or (b) reject the input with a stable error code and no partial import, public disclosure, or implicit source mutation.
Acceptance rule: compatible = schema_valid AND supported_contract AND authoritative_identity AND units_compatible AND provenance_complete AND rights_authorized AND replay_consistent. These are proposed consumer-side acceptance gates, not one atomic check currently implemented by Platform Core. Any false or unknown gate must block the intended consumer import or publication until explicitly resolved.
Expected deliverables are a pinned schema and source commit, a producer-to-consumer field mapping, an explicit unit and version policy, a sanitized positive/negative test report, and a recorded decision for each receiving product.
1. Purpose and acceptance boundary
Use this procedure to apply an explicit data contract when a producer such as Lab, Workbench, Knowledge Library, Workspace, or Site Intelligence exchanges a research object with another application. Interoperability requires more than parsable JSON: identity, field meaning, physical quantity, version compatibility, rights, provenance, and receipt semantics must remain stable from origin to consumer.
The desired outcome is a validated, authorized handoff whose receiving service either accepts the declared contract and records its provenance or rejects it with a reproducible diagnostic. Acceptance must never imply publication approval, causal validity, scientific correctness, or authority to mutate the source.
Scope: Platform Core code reviewed at commit 59b8444365525a58fd4f6a7e29a20d712769e1a2. The included checker is an illustrative offline consumer adapter, not an installed Platform Core validator. No production endpoint was exercised.
2. Distinguish the real contracts from proposed validation profiles
The repository contains several complementary contracts rather than one universal cross-application schema. Read the actual declared contract and the consumer-specific profile before constructing or replaying a handoff.
| Surface | Repository-backed behavior | Important boundary |
|---|---|---|
| Cross-Product Evidence Exchange v2.14.0 | /v1/exchange: reference-first packages, receipts, idempotency and governed snapshots |
No automatic delivery or truth promotion |
| Research Context Handoff v2.91.0 | Reference-first research context and declared routes; preserve revision and state | Does not authorize access or execute a receiving workflow |
| Unified Research Runtime Contract v2.96.0 | Shared capability/operation declarations for specialist products | Core does not become the scientific executor |
| Cross-Product Intelligence Handoff v3.94.0 | Preserves epistemic state, provenance, contradictions, review gates | Acceptance is not evidence validation |
| Runtime Data Interchange v3.39.0 | Candidate runtime exchange description and Arrow/Parquet contract support | Does not certify an installed native Arrow/Parquet conversion provider |
| Example measurement adapter in this article | Strict JSON Schema, unit and version compatibility checks | Not a deployed or official Platform Core contract |
Source references: Cross-Product Evidence Exchange, Research Context Handoff, Unified Research Runtime Contract and Intelligence Handoff.
Prerequisites
- Identify origin and target products, organization/owner scope, project identifier, object identifier, object version, contract identifier and producer release. Never treat a display title as a canonical ID.
- Confirm the actor has permission to read the source and create the intended private handoff. Do not equate possession of an API key with object-level authorization.
- Record the consumer’s accepted contract version interval, required fields, unit registry, allowed data classifications and audience. Reject an unknown version rather than guessing.
- Capture the source object’s revision, source licensing/rights, provenance references, content hash algorithm, and expected audience before any transformation.
- Use synthetic or explicitly authorized fixtures, a throwaway staging database, a nonsecret correlation ID and a rollback plan. Capture the exact source commit and migration state.
- Verify the installed integration is enabled and its schema/contract versions match the documented source baseline. Repository code is not proof of deployment.
Recommended evidence manifest fields: origin_product, target_product, source_object_ref, source_object_version, contract_key, contract_version, owner_scope, rights_ref, source_hash, producer_release, consumer_release, trace_id, validation_result and timestamp_utc. This manifest is a suggested operational record, not the native Core package schema.
Requirements
Before applying the procedure, confirm all of the following controls. A missing item should be treated as an environment or contract readiness failure, not bypassed by weakening validation.
| Control | Required evidence | Failure response |
|---|---|---|
| Authoritative source | Canonical subject type and ID, source version, owner scope, producing service, source retrieval reference. | Reject unresolved or cross-owner references; do not synthesize identities. |
| Pinned contract | Schema $id, draft, immutable file checksum, producer release, consumer-supported version interval. |
Reject an unknown schema or unsupported major version. |
| Field and unit policy | Field definitions, nullability, numerical representation, dimensional basis, canonical unit, conversion factor and rounding rule. | Reject incompatible dimensions or ambiguous units; do not reinterpret the value silently. |
| Security and rights | Authenticated actor, object-level permission, origin/target scope, classification, rights/license reference and intended audience. | Fail closed; redact diagnostics and hold private/unreviewed objects out of public output. |
| Integrity and replay | Canonicalized test input or documented serialization recipe, SHA-256 digest, idempotency key and expected retry policy. | Reject changed-content replay; preserve source and prior accepted package. |
| Reproducible environment | Python 3.10+, jsonschema>=4.18,<5, synthetic fixtures, pinned commit and isolated staging DB for integration tests. |
Do not use production writes to establish a test baseline. |
Native versus proposed controls: the source-reviewed cross-product-exchange-package-v1.schema.json provides the native package-envelope structure. The stricter unit, version-window, source-rights and payload-hash checks in sc_example_measurement_v1.schema.json and schema_guard.py are illustrative consumer adapter controls, not a claim about the deployed Platform Core API.
4. Locate and pin an authoritative schema
Pin schemas to a signed/reviewed release or immutable commit, and validate their $schema, $id, required fields, and type declarations. The published URL inside an $id is an identifier; a validator must not assume it is a safe network fetch target. Use trusted local copies or an approved schema registry.
# From an authorized checkout of the Platform Core repository:
git rev-parse HEAD
python3 -m json.tool schemas/cross-product-exchange-package-v1.schema.json >/dev/null
python3 -m json.tool schemas/runtime-data-interchange-v1.schema.json >/dev/null
python3 -m json.tool schemas/research-unified-runtime-contract-v1.schema.json >/dev/null
# Review the pinned source before running a write against staging.
For this article, schemas/cross-product-exchange-package-v1.schema.json is the authoritative repository schema for the native package creation request. It checks envelope structure but is not a complete semantic validator for scientific units or downstream compatibility. Compare the schema with the router model and the service constraints.
Cause
Typical schema integration failures can originate in distinct layers. Diagnose the first failed boundary rather than retrying mutations or collapsing every error into “invalid schema.”
| Symptom | Likely cause | Discriminating test |
|---|---|---|
| HTTP 401/403 | Authentication, scope, or capability rejected | Check authorized identity and nonsecret request ID; no automatic retry |
| HTTP 404 | Unknown object, withheld private object, disabled route, or wrong revision | Compare private authorized lookup with public projection; do not leak existence |
| HTTP 422 | Pydantic/JSON Schema structural error or semantic service rejection | Capture field-level error and exact schema revision |
| Consumer accepts but values change | Unit mismatch, encoding, null semantics, timezone, or precision loss | Roundtrip known quantities and compare exact Decimal values |
| Unexpected duplicate or stale handoff | Reused idempotency key with changed payload, or cached/stale source version | Compare package hash and idempotency key with original operation |
| Valid JSON but incorrect science | Wrong dimension/basis, unreviewed assumptions, missing source lineage | Run independent domain-specific semantic controls |
| Public data leak | Rights inherited incorrectly or nested source payload not redacted | Negative-test every public projection and export |
| Partial consumer state | Acknowledged receipt without validated downstream object | Inspect receipt, target record, trace, and independent import status |
6. Preserve canonical identity and version identity
An object identifier represents a persistent logical object; a version identifier represents a specific immutable revision or release. A source-record ID, Core entity ID and receiving-product local ID may legitimately differ. Store an explicit mapping and its evidence rather than overwriting one identifier with another.
{
"source_authority": "lab",
"source_object_ref": "lab:dataset:synthetic-001",
"source_object_version": "v1",
"consumer_product": "workbench",
"consumer_local_ref": "workbench:dataset:synthetic-009",
"mapping_type": "derived_from",
"mapping_review": "synthetic-fixture-only",
"source_content_sha256": "<64-hex-characters-if-computed>"
}
The example mapping above is explanatory and is not a registered Core schema. An identity collision is not resolved by choosing the shortest ID, latest timestamp, or most convenient string. Preserve authoritative origin, source version and provenance for adjudication.
7. Native Core package: minimal reference-first request
This is a structurally valid example request shape for POST /v1/exchange/packages. It will succeed only if the referenced canonical subject actually exists and the caller has write authorization; the values below are deliberately synthetic and are not resolvable on a live server.
{
"origin_product": "lab",
"target_product": "workbench",
"title": "Synthetic evidence handoff",
"purpose": "Contract interoperability smoke test",
"visibility": "internal",
"idempotency_key": "synthetic-exchange-001",
"items": [{
"artifact_type": "dataset",
"subject_type": "scientific-asset",
"subject_id": "<authorized-canonical-scientific-asset-id>",
"snapshot_mode": "reference",
"evidence_role": "inherited",
"provenance": {"run_ref": "synthetic-run:001"}
}],
"provenance": {"requested_by": "synthetic-acceptance-test"}
}
The service verifies known product and subject types, restricts item counts to 100, checks subject existence and audience visibility for public packages, rejects secret-like metadata keys, and limits snapshots. It stores a deterministic hash and supports pull-based acknowledgments. It does not automatically convert units or validate the scientific semantics of the underlying payload.
8. Validate the native request without writing
Before submitting to a Core endpoint, validate the request locally using the pinned repository schema. This structural gate is necessary but insufficient; the service layer has additional rules for actual subject existence, audience, snapshots, and idempotency. Do not call the production write endpoint merely to test whether a package shape parses.
import json
from pathlib import Path
from jsonschema import Draft202012Validator
schema = json.loads(Path('schemas/cross-product-exchange-package-v1.schema.json').read_text())
payload = json.loads(Path('synthetic_core_request.json').read_text())
Draft202012Validator.check_schema(schema)
errors = sorted(Draft202012Validator(schema).iter_errors(payload), key=lambda e: str(e.path))
for err in errors:
print(list(err.path), err.message)
assert not errors, 'Structural contract rejected'
Copy the sample request above to synthetic_core_request.json. This example requires jsonschema 4.x. It has not been run against your Core deployment. JSON Schema’s format handling can differ between validators; enforce date-time, URI and UUID semantics explicitly when needed.
9. Define field meaning and scientific quantity before transport
Cross-application contracts must define the scientific quantity kind, not just a numeric value. Distinguish a carbon stock from an annual flux, carbon mass from CO₂ mass, observed from modelled values, and gross removal from net removal. These are different measurands and must not be silently interchanged.
| Contract field | Required interpretation | Example failure |
|---|---|---|
kind |
Quantity kind: co2_removal_mass versus co2_removal_flux |
Treating a stock as a rate |
unit |
Declared unit code with a governed dimension and conversion | Converting kg_C into kg_CO2 without documented stoichiometric assumptions |
basis |
Gross/net, dry/wet, system boundary and denominator basis | Comparing net and gross outcomes |
observed_at |
Offset-aware timestamp plus reporting period semantics | Local midnight mistaken for UTC |
classification |
Observed, modelled, synthetic, or literature-derived | Publishing a synthetic fixture as observational evidence |
provenance |
Source, method, version, transformations, uncertainties | Hashing a result with no reproducible method |
The companion example deliberately defines kg_CO2 and t_CO2 as local illustrative vocabulary, not as certified UCUM expressions or a deployed Sustainable Catalyst unit registry. For physical unit conventions see the BIPM SI Brochure.
10. Quantitative unit conversion with exact arithmetic
Use decimal arithmetic and explicit unit dictionaries. For equivalent quantity kinds:
value(target unit) = value(source unit) × conversion factor(source → target). The factor for t_CO2 → kg_CO2 is 1,000. A flux basis must additionally preserve area and time denominators.
from decimal import Decimal
# Local demonstration only: not the Platform Core unit registry.
source_value = Decimal('1.250')
co2_kg = source_value * Decimal('1000')
assert co2_kg == Decimal('1250.000')
# This is a different dimension and cannot be converted via the same factor.
assert 'kg_C' not in {'kg_CO2', 't_CO2'}
Reject unknown unit codes and incompatible dimensions. Do not silently apply molecular-weight factors, change per hectare per year to per square meter, or drop uncertainty intervals. Record explicit conversion operations and governing assumptions.
11. Establish an explicit consumer version window
Compare contract versions as structured versions, not strings. A consumer supporting a range [1.0.0, 2.0.0) may accept 1.2.0 but must reject 2.0.0 unless a reviewed migration exists. Application release numbers and contract versions are independent: Core 4.x does not imply that every product adapter supports a 4.x contract.
from schema_guard import semver_triplet
producer = semver_triplet('1.2.0')
minimum = semver_triplet('1.0.0')
maximum = semver_triplet('2.0.0')
assert minimum <= producer < maximum
The local example intentionally supports only strict X.Y.Z numeric versions. Full SemVer prereleases and build metadata require a standards-compliant parser. See Semantic Versioning 2.0.0. Compatibility is an explicit contract test, not a guarantee from version numbering alone.
12. Model a strict consumer adapter contract
The package includes sc_example_measurement_v1.schema.json, a strict JSON Schema 2020-12 example with additionalProperties: false on nested envelopes. It defines source/target scope, versions, audience, rights, measurement, and provenance. This is not an official Platform Core schema or a deployed endpoint.
{
"schema_ref": "sc.example.cross-application-measurement.v1",
"contract_version": "1.2.0",
"idempotency_key": "synthetic-handoff-001",
"source": {"product": "lab", "release": "0.0.0-test",
"scope": "synthetic-project:001",
"object_ref": "lab:dataset:synthetic-001", "object_version": "v1"},
"target": {"product": "workbench", "scope": "synthetic-project:001",
"audience": "internal", "min_contract_version": "1.0.0",
"max_contract_version_exclusive": "2.0.0"},
"measurement": {"kind": "co2_removal_mass", "value": "1.250",
"unit": "t_CO2", "basis": "net_removed",
"classification": "synthetic", "observed_at": "2026-11-21T00:00:00Z"},
"rights": {"cleared": true, "allowed_audiences": ["internal"],
"license_ref": "synthetic-demo-only"},
"provenance": {"source_refs": ["library:source:synthetic-001"],
"method_ref": "method:mass-calculation", "method_version": "1",
"measurement_sha256": "<actual-hash-written-by-fixture-generator>"}
}
The illustrative hash placeholder above is resolved in the packaged fixture. All example IDs are synthetic. Do not paste the placeholder into a validator and expect it to pass.
13. Run the included compatibility checker
The self-contained developer example validates JSON Schema syntax, the consumer version window, owner scope, declared audience and rights, timezone awareness, dimension-safe conversions, content digest, and source-lineage references. The diagnostic output uses stable error codes and JSON paths; no external service is called.
python3 -m pip install 'jsonschema>=4.18,<5'
python3 make_fixtures.py
python3 schema_guard.py fixtures/valid.json
python3 schema_guard.py fixtures/wrong_dimension.json # expected exit 1
python3 -m unittest -v test_schema_guard.py
Run from the extracted package directory. A valid fixture prints "valid": true and 1250.000 kg_CO2. An intentionally invalid fixture exits nonzero and identifies the broken boundary. This checker is offline only; it does not authenticate to Core, approve rights, verify scientific observations, or resolve external source records.
Procedure
Producer validation must run before the handoff is made; consumer validation must run again before importing. The receiver must not trust the producer’s self-reported validated status. Compare the exact contract ID, version, object version, payload digest, rights and declared science semantics at both boundaries.
producer object + revision
-> validate source rights and canonical identity
-> validate native Core package request
-> write governed reference-first package (staging only)
-> read back package and hash
-> consumer checks contract/version/scope/rights
-> consumer validates units, basis, provenance, numeric precision
-> nonmutating import preview
-> human-authorized import or explicit rejection
-> receipt + destination object mapping + audit correlation
Use a dedicated rejected result with nonsecret diagnostics for contract mismatch; never coerce an incompatible payload into a generic “success” response.
15. Validate provenance, content hashes and replay semantics
Hashes prove integrity under a specified encoding recipe; they do not prove source accuracy or scientific validity. The companion checker hashes the measurement object with UTF-8 JSON, sorted keys and compact separators. Core uses a similar deterministic serialization in its exchange service, but neither should be described as RFC 8785 JSON Canonicalization Scheme without an explicit conformance test.
from schema_guard import digest
from pathlib import Path
import json
p = json.loads(Path('fixtures/valid.json').read_text())
assert digest(p['measurement']) == p['provenance']['measurement_sha256']
An idempotency key means “same logical request,” not “discard conflicting changes.” The Core v2.14 exchange service returns an existing package for the same origin, target and key. Because that early return does not recompare the new payload with the stored package, receiving teams should flag key reuse with changed content before invoking the write endpoint. The companion function find_replay_conflicts checks this locally; a production service must enforce it durably under concurrent requests.
16. Cross-product authorization and rights gate
A receiving product must check both the caller’s privilege and the data owner’s authorization, including project tenancy, consent/rights conditions, target audience, retention, source restrictions and publication status. A public exchange request must not upgrade private materials to public visibility merely because a structural schema accepted the request.
- Default unknown rights to a blocked or review-required state.
- Distinguish project/team scope from object visibility and audience grants.
- Apply field-level redaction to all nested snapshots, provenance, receipts and derived-output references.
- Return permission-safe errors without publishing hidden object titles or private source identifiers.
- Audit contract denial, but keep raw credentials, private research text and sensitive data out of public logs.
The Core exchange service rejects non-public canonical subjects from public packages, with subject-type-specific visibility checks. That is a boundary, not a substitute for a full cross-product rights and export review.
17. Handle partial payloads, nulls and field extensions
Define missing, explicit null, zero, empty array and empty string separately. A missing required field is not equivalent to an observed zero. Reject unknown semantic fields unless the contract has a documented extension bag that is explicitly ignored by older consumers. Never silently drop units, uncertainty, provenance, rights, or state markers in an adapter.
The repository’s research-unified-runtime-contract-v1.schema.json and runtime-data-interchange-v1.schema.json allow additional properties, whereas the example measurement schema is deliberately strict. Neither permissive nor strict behavior can be assumed across all contracts: validate against the particular consumer agreement.
18. Handle receipts, derived objects and publication transitions
Core exchange receipts distinguish acknowledged, accepted, rejected and derived. A receipt records a target action; it does not establish that the destination scientifically validated the output. Preserve derived_object_id, inherited provenance and the source object’s authority.
{
"target_product": "workbench",
"state": "derived",
"derived_object_id": "<actual-target-object-id>",
"note": "Synthetic example: schema and semantic checks completed",
"metadata": {"contract_version": "1.2.0", "review_status": "test-only"}
}
This is a sample request body for the existing POST /v1/exchange/packages/{package_id}/receipts route. Do not send it until the target record exists and the appropriate actor has authorization. No automatic downstream project provisioning or scientific truth promotion follows from the receipt.
19. Observe schema failures with nonsecret diagnostics
Capture a correlation ID and the smallest safe error detail needed to reproduce the failure. Standardized local failure codes in the attached checker include E_SCHEMA, E_VERSION_RANGE, E_SCOPE, E_RIGHTS, E_UNIT, E_HASH, E_TIMEZONE, E_LINEAGE, and E_REPLAY. These are example diagnostic codes, not deployed Platform Core API codes.
{
"trace_id": "synthetic-trace-001",
"contract": "sc.example.cross-application-measurement.v1",
"contract_version": "1.2.0",
"status": "rejected",
"code": "E_UNIT",
"path": "$.measurement.unit",
"message": "Unit is not convertible to the expected quantity kind"
}
Record producer/consumer release, schema checksum, validator implementation version, object reference (where permitted), and a sanitized failure category. Do not log raw payloads by default.
20. Read-only PostgreSQL reconciliation for native exchange packages
On an authorized staging database, reconcile package, item and receipt counts with the application’s returned representation. The following queries use Core table names verified in source and do not modify records. Parameterize :package_id using your SQL client; do not concatenate untrusted IDs into SQL.
SELECT p.id, p.origin_product, p.target_product,
p.idempotency_key, p.visibility, p.state, p.package_hash,
COUNT(DISTINCT i.id) AS item_count,
COUNT(DISTINCT r.id) AS receipt_count
FROM cross_product_exchange_packages AS p
LEFT JOIN cross_product_exchange_items AS i ON i.package_id = p.id
LEFT JOIN cross_product_exchange_receipts AS r ON r.package_id = p.id
WHERE p.id = :package_id
GROUP BY p.id, p.origin_product, p.target_product,
p.idempotency_key, p.visibility, p.state, p.package_hash;
SELECT ordinal, subject_type, subject_id, canonical_uri,
snapshot_mode, item_hash, evidence_role, truth_precedence
FROM cross_product_exchange_items
WHERE package_id = :package_id
ORDER BY ordinal;
SELECT target_product, state, derived_object_id, created_at
FROM cross_product_exchange_receipts
WHERE package_id = :package_id
ORDER BY created_at;
A present receipt is not proof the receiving data passed its semantic schema. Resolve the referenced destination object through authorized target APIs and compare its persisted unit, dimension, source version and provenance. Avoid dumping snapshot JSON into tickets or public error logs.
21. Compatibility matrix and test taxonomy
Maintain a matrix by producer release, consumer release, contract version, rights profile, quantity kind and expected result. A “supported version” flag is evidence only after the exact matrix entry passes tests and is associated with a reviewed release.
| Case | Input / condition | Required result |
|---|---|---|
| PASS-01 | 1.2.0 within consumer [1.0.0,2.0.0) | Accept, preserve source version |
| PASS-02 | 1.250 t_CO2 | Normalize to 1250.000 kg_CO2 with recorded factor |
| PASS-03 | Explicit public rights and allowed audience | Permit only eligible public projection after all rights checks |
| FAIL-01 | 2.0.0 excluded from consumer interval | Reject: version range |
| FAIL-02 | kg_C supplied for CO₂ mass | Reject: quantity mismatch |
| FAIL-03 | Source and target scope differ | Reject unless separately authorized mapping exists |
| FAIL-04 | Payload altered after hashing | Reject: hash mismatch |
| FAIL-05 | Same idempotency key, changed payload | Reject replay conflict; preserve original |
| FAIL-06 | Rights unclear or prohibited audience | Reject or require human review |
| FAIL-07 | Missing source version or method | Reject: incomplete provenance |
| FAIL-08 | Unknown future field in strict adapter | Reject: structural schema |
22. Test persistence, concurrency and backward compatibility
The offline harness does not exercise races or persistence. Staging tests should send simultaneous requests with the same idempotency key; inspect the unique constraint and compare the stored package hash with every contender. Test a safe retry of the identical request and an intentionally changed-content retry. Verify that the same accepted source produces the same consumer record after reload and that old consumers reject or safely ignore only documented compatible extensions.
- Install the candidate release and apply migrations in isolated staging.
- Record source object and package snapshots; generate a valid contract.
- Run the validator in producer and consumer contexts.
- Attempt negative and concurrent operations using synthetic IDs.
- Restart the consumer, reload the record, and verify unchanged unit, value, source ID, content hash, audience, and provenance.
- Inspect the receipt and destination’s own audit record; verify denied/public views reveal no private fields.
- Restore prior staging snapshot only through an approved rollback procedure; record what changed and what did not.
Troubleshooting
Use the first failing contract boundary to choose the recovery path. Preserve the failing request hash, correlation ID, API response status, actor scope, producer and consumer versions, and sanitized test fixture before rerunning an operation. Native service error codes and deployment-specific HTTP mappings can differ from the examples below.
| Symptom | How to isolate the cause | Safe corrective action |
|---|---|---|
| Request rejected by a schema validator (typically 422) | Run the exact JSON against the pinned Draft 2020-12 contract; inspect JSON Pointer paths for missing fields or extra properties. | Fix the producing serializer or negotiate the correct contract. Do not strip fields required for provenance. |
| Native schema passes but Core rejects the package | Check registered origin/target products, allowed subject type, actual subject existence, public visibility and sensitive-field restrictions. | Repair references or authorization in the authoritative service; do not alter the JSON Schema merely to circumvent service checks. |
| Consumer reports incompatible version | Compare the producer’s precise contract version with the consumer’s declared accepted window, including feature flags and schema revision. | Use a reviewed mapping or a compatible producer release; reject unknown major versions. |
| Converted values differ | Verify dimensions, input/output unit codes, conversion factors, Decimal arithmetic, precision and rounding policy. | Correct the adapter conversion table and rederive a new version; preserve the original quantity and source reference. |
| Duplicate receipt or changed-content replay | Compare the new request hash with the persisted package hash and the same origin/target/idempotency key; inspect receipts without replaying writes. | Stop and reconcile the existing package. New content requires an explicitly new revision and idempotency key. |
| Unexpected public visibility or incomplete rights | Inspect the source object’s effective rights, package visibility and consumer’s public projection; test unauthorized access with synthetic objects. | Disable publication/export, quarantine the affected derived object, and repair the rights gate before retry. |
| Partial import, stale cache or lost provenance | Compare source ID/version/hash to destination ID/version, persisted receipt, last accepted snapshot and cache revision. | Reconcile durable records and invalidate only scoped caches; use a guarded staging restore when needed. |
Offline reproduction (safe and read-only): run from the companion package directory. The invalid fixture is expected to exit nonzero.
python3 -m unittest -v test_core_schema.py test_schema_guard.py
python3 validate_core_request.py synthetic_core_request.json
python3 schema_guard.py fixtures/valid.json
python3 schema_guard.py fixtures/wrong_dimension.json # expected failure
Decision order: (1) identify producer, consumer and contract; (2) classify structural versus semantic failure; (3) verify identity and rights; (4) compare raw and normalized numerical data; (5) inspect receipt and idempotency history; (6) retest with a new synthetic fixture; (7) re-enable the blocked handoff only after a recorded staging acceptance. The readonly_exchange_diagnostics.sql companion supplies package/item/receipt correlation queries; confirm actual table prefixes and permissions before use.
Escalation packet: attach schema checksum, sanitized input/output JSON, expected/actual validation codes, relevant source commits, explicit version ranges, transformation recipe, nonsecret trace ID and rollback evidence. Never attach credentials, unrestricted source snapshots, private research data, or personally identifying case material.
Resolution
Use the smallest reversible correction at the failing contract boundary. A schema mismatch is not fixed by deleting provenance, rewriting source identifiers, loosening public rights, disabling a validation check, or silently recasting units.
| Failure | Safe resolution |
|---|---|
| Schema parse/type mismatch | Correct the producer adapter or pin a supported contract; retain original payload and revision |
| Unsupported contract version | Select a reviewed compatible adapter or keep handoff pending; do not guess migration |
| Unit/basis mismatch | Add documented semantic conversion in target adapter and record factor, dimension and assumptions |
| Scope/rights denied | Resolve authorization or leave blocked; do not copy private data into another tenancy |
| Stale object version | Re-resolve authoritative version and compare change log; invalidate only scoped cache |
| Hash mismatch | Quarantine staged import, recover original evidence and recompute under declared byte recipe |
| Idempotency collision | Preserve original package; issue a new reviewed request/key if business intent truly changed |
| Receipt inconsistent | Reconcile target object and receipt non-destructively; record corrective event and provenance |
For an active incident, stop publication/delivery of the affected artifact, save a sanitized reproducer and package/receipt IDs, identify the owner and remediation, and resume only after regression tests pass. Never overwrite an immutable accepted artifact in place.
Verification
Release acceptance requires both structural and semantic checks on the producer and receiving product. The user-facing Knowledge Base article can be published while these deployed checks remain pending; that is not a verification pass.
- Structural: pinned JSON Schema passes; required fields, types, nested restrictions and supported version window enforced.
- Scientific semantics: values, quantities, unit conversions, temporal basis, precision, uncertainty, and data classification preserved.
- Identity: authoritative object ID and source version remain resolvable; any derived identity mapping is explicit and non-destructive.
- Rights: private/unreviewed materials cannot appear in public package snapshots, receipts, logs, or derived projections.
- Integrity: payload digest verified under a documented encoding recipe; tampering and changed-content idempotent retry are rejected.
- Persistence: accepted package, receipt and destination object agree after restart and after repeat requests.
- Negative paths: test invalid fields, incompatible schema, wrong dimension, scope violation, missing provenance, unauthorized actor and partial dependency failure.
- Evidence: record source commit, deployed release, schema checksum, environment, fixture IDs, actual stdout/stderr, reviewer decision, and rollback artifact.
Current result: offline companion tests passed in the authoring environment; production and cross-product integration verification have not been performed. The code baseline has not been verified as the live deployed version.
25. Security and implementation limitations
The example checker only recognizes a small synthetic vocabulary. It does not perform identity-provider validation, PostgreSQL transactions, concurrency control, consent adjudication, scientific calibration, schema registry trust, network retrieval, or PII pattern auditing. The source Core package schema is deliberately less restrictive than the sample consumer adapter and cannot be used alone to certify science or rights.
If runtime dependencies cannot resolve, return a bounded, safe error and preserve the original source/version. Do not automatically fetch arbitrary $ref URLs or schema identifiers from untrusted objects: schema retrieval can become a server-side request forgery or supply-chain risk.
26. Technical references and source links
- Platform Core — Cross-Product Exchange router (pinned source)
- Platform Core — Cross-Product Exchange service (pinned source)
- Platform Core — native package JSON Schema (pinned source)
- Platform Core — exchange contract test fixtures (pinned source)
- Platform Core — Unified Runtime JSON Schema
- Platform Core — Runtime Data Interchange JSON Schema
- Platform Core — Research Context Handoff
- Platform Core — Intelligence Handoff
- Platform Core — Computational Provider Contract
- JSON Schema Core, Draft 2020-12
- JSON Schema Validation, Draft 2020-12
- Semantic Versioning 2.0.0
- BIPM SI Brochure
- RFC 8785 — JSON Canonicalization Scheme
