Home Contact
Universal Substratev1.4
/
For agents Markdown

32. API, event, query, SDK, and conformance implementation

The developer surface must make the safe path the easy path. Canonical writes are narrow; expressive reads operate over policy-bound projections; high-volume artifacts use direct upload plus manifests; events are at-least-once; every consequential action…

Concept & directionLNK

The developer surface must make the safe path the easy path. Canonical writes are narrow; expressive reads operate over policy-bound projections; high-volume artifacts use direct upload plus manifests; events are at-least-once; every consequential action returns an auditable receipt. OpenAPI or AsyncAPI documents describe transport contracts but remain subordinate to immutable RTracer schemas and vocabularies.

#32.1 HTTP resource conventions

SurfaceRequest contractResponse contract
POST /v1/recordsIdempotency-Key, exact Content-Type/schema, optional request signature201 record receipt; 200 exact retry; 409 equivocation/conflict
GET /v1/records/{id}authorization, representation media typeCanonical record or policy projection; immutable ETag
GET /v1/entities/{id}projection, validAt, knownAt, minimumCheckpointAudience-specific entity view plus explanation/checkpoint
GET /v1/entities/{id}/timelinerecord families, cursor snapshot, time filters and conflict modeStable page with next cursor bound to same ledger watermark
POST /v1/querybounded typed query AST, cost budget, projection policyResults, truncation/cost, input checkpoint and explanation
POST /v1/artifacts/uploadsmedia type, size, digest/algorithm, policy and purposeShort-lived upload capability; no semantic record yet
POST /v1/telemetry/segmentsartifact confirmation and SegmentManifestManifest receipt, quality disposition and checkpoint
POST /v1/actionsproposal, requested grant, confirmation mode and idempotencyInert action ID and policy evaluation, never implicit execution
POST /v1/auctions/{id}/bidsbidder session, amount/currency, eligibility evidence and idempotencyImmutable bid admission/rejection receipt and trusted time
GET /v1/eventsconsumer, partition, after sequence, event kinds and projection policyAt-least-once ordered partition stream with checkpoint

#32.2 Request integrity, concurrency, and caching

  • Idempotency-Key is scoped to tenant, authenticated principal and operation family; reuse with different canonical request bytes is equivocation.
  • Mutable workflow resources use ETag/If-Match on their projection version; canonical records themselves are immutable.
  • HTTP message signatures may protect selected request components, but authorization still evaluates current grants and context.
  • GET responses identify projection/schema/policy version, validAt/knownAt and checkpoint; cache keys include all of them plus disclosure class.
  • Sensitive responses default to no-store or private caching. A public cache never receives private source fields before redaction.
  • Retries use bounded exponential delay and Retry-After where declared; clients never retry non-idempotent connector effects without a stable action ID.

#32.3 Problem response profile

Table
Problem Details-compatible error - illustrative JSON
{
  "type": "https://schemas.rtracer.example/problems/port-incompatible/v1",
  "title": "Connection ports are incompatible",
  "status": 422,
  "detail": "The requested fuel outlet cannot connect to an electrical-power inlet.",
  "instance": "urn:rtracer:problem:018f...",
  "code": "RTR-CONFIG-PORT-004",
  "stage": "graph-validation",
  "recordPath": "/body/edges/3",
  "constraintRef": "shape:rtracer.port-compatibility/v2#medium",
  "retryable": false,
  "correlationId": "018f...",
  "safeContext": {"expectedFamily": "electricalPower", "receivedFamily": "fluid"}
}

Human detail is not parsed by clients. Stable code, stage, path, constraint and retryability drive program behavior. Errors do not expose whether an inaccessible entity, bid, telemetry stream or private profile exists.

#32.4 Typed query algebra

OperatorMeaningRequired limit
entityresolve one or more opaque entity rootstenant/policy scope and maximum seed count
asOfvalidAt and knownAt temporal sliceexplicit defaults; bounded historical window
recordsfilter typed record families, truth lanes, status and authoritymaximum result/page and stable snapshot
traversefollow named relationship/graph edgesdepth, edge kinds, node count, cycle behavior and time
configurationselect snapshot, diff, installed item or topologyexact configuration or declared current projection
matchRecipeevaluate versioned TypeRecipe against facetsexplanation and indeterminate/conflict behavior
aggregatecount/sum/min/max/histogram over permitted valuesprivacy threshold, unit compatibility and uncertainty rule
searchtext/facet/geospatial discovery over a disclosure-safe indexranking version, location precision and no private inference
explainreturn inputs, policy decisions, derivations and truncationredact explanation edges independently where needed

#32.5 Event contract

Table
Canonical admission-event transport v1.4
CanonicalAdmissionEvent {
  profile, eventId, eventKind: "ledger.record-admitted.v1",
  ledgerId, tenantId, logicalShardId, chainEpoch, commitSequence,
  streamId, streamSequence, recordId, recordDigest,
  receiptId, receiptDigest, correlationId?, causationId?,
  recordedAt, eventDataDigest
}

One admitted record produces exactly one canonical admission event.
brokerPartitionKey = tenantId || logicalShardId || chainEpoch
Delivery is at-least-once; retries preserve eventId and canonical bytes.
Derived stream topics MUST NOT advance canonical shard checkpoints.
ChangeEvent {
  eventId,
  tenantId,
  partition,
  ledgerSequence,
  eventKind,
  recordId,
  recordType,
  subjectIds[],
  recordedAt,
  canonicalRecordDigest,
  disclosureClass,
  transportAttempt,
  traceContext?
}

Rules: event payload never replaces the canonical record; consumers may fetch
the authorized representation. Delivery is at-least-once. Order is guaranteed
only inside the declared partition. Replays keep the same semantic event ID.

#32.6 Import and export dossier

Package partRequired content
manifestexport ID, producing system, tenant/subject scope, purpose, time, format, pack/schema lock and file digests
recordscanonical records and proofs or authorized projections with loss/disclosure manifest
artifactsincluded bytes, external references, unavailable/withheld markers, rights and encryption/key instructions
vocab/schemaall non-public or non-guaranteed definitions required for offline interpretation
orderingledger ranges, checkpoints and dependency graph so imports can detect gaps
privacyaudience, legal/purpose basis, redactions, location precision, expiry and onward-use duties
import receiptsource dossier digest, mappings, created candidates/records, conflicts, quarantines and information loss

#32.7 SDK requirements

SDK areaContract
generated typeswire models generated from locked schemas; unknown extensions preserved as bytes/structured value
canonicalizerofficial conformance vectors; reject ambiguous input before hashing or signing
validatorlocal schema/context/shape registry, resource limits, structured findings and no network fetch
auth clientshort-lived credentials, current grant/purpose, request integrity, revocation handling and no secret logging
idempotencyautomatic stable key per logical operation and durable retry state for connector effects
paginationsnapshot-bound cursors, checkpoint awareness and transparent rate/backpressure handling
telemetrystream/chunk writer, schema lock, sequence/clock metadata, digest and resumable upload
observabilitytrace context and opaque correlation IDs; sensitive identifiers excluded from labels

#32.8 Conformance harness and release gates

  1. Validate positive and negative examples for every schema and graph shape, including maximum-size and malformed-input cases.
  2. Run canonicalization vectors across every supported language; digests and rejection outcomes must match exactly.
  3. Run append/idempotency/outbox fault injection at every transaction boundary and verify no partial canonical state.
  4. Replay every projection from empty state and compare canonical outputs/checkpoints with a golden corpus.
  5. Run privacy non-interference tests: hidden fields/edges must not leak through status, count, ranking, timing, errors or cache keys.
  6. Run agent/market authorization matrices for grant expiry, transfer, revocation, confirmation, money limits and connector retries.
  7. Restore ledger, registry, key metadata and artifacts from independent backup; regenerate graph/search/feed views within target RTO.
  8. Publish schema/pack/API versions, migration/loss manifests, security review, SLO changes and conformance evidence before activation.

#32.9 Reference deployment slices

SliceDeployable boundaryExit proof
S0 identity/evidenceentity, ledger, identifier claims, artifacts, schema registry and owner vaultKUN, RC car and blimp import/export/replay with conflicts
S1 configuration/lifesnapshots, parts/ports, modification, maintenance, wash/media and conditionComplete before/after and due-history reconstruction
S2 telemetrycapture session, manifests, object/lake storage, derived metrics and privacy projectionRaw-to-summary reproducibility and clock/dropout fixtures
S3 public vehicleprofile, timeline, spotting claim, followers, grounded drafts and event discoveryNo private-location or unsupported-fact leakage
S4 governed actiongrant/policy engine, confirmations, connectors, ticket/training/merch and receiptsEvery effect reconciles or compensates under retry
S5 marketappraisal/listing/offers/auction/bids/transaction and provider adaptersSerialized close, eligibility, authority and settlement tests
S6 ecosystempack registry, SDKs, federation/import/export and partner/tenant governanceUnknown pack round-trip and portable dossier restore