3.0 KiB
Schema Drift Map
This document records the naming drift between the protocol schemas, the L1 cloud-core migration skeleton, the audit chain, the evidence chain, and the deploy manifest example. It is a closure artifact for M0 audit work only.
Scope
- protocol:
protocol/schemas/*.json - DB migration:
internal/db/migrations/0001_cloud_core_skeleton.sql - audit event:
protocol/schemas/audit-event.schema.json - evidence chain:
protocol/evidence-chain.md - evidence record:
protocol/schemas/evidence-record.schema.json - deploy manifest:
deploy/deploy.json - deploy schema:
deploy/deploy.schema.json
The source of truth for machine checks is protocol/schema-drift-map.json.
This page is the human summary.
Aligned Fields
The following IDs are already aligned at the protocol layer and are carried through the current examples:
projectIdoperationIdauditIdtraceIdevidenceIdserviceIdenvironmentresourceIdsessionIdfamily:gatewaySessionId,agentSessionId,workerSessionId- evidence chain roots:
chainId,schemaVersion,scenario,title - evidence chain collections:
hardwareOperation,auditEvents,traceEvents,evidenceRecords
Known Gaps
These are the places where the L1 skeleton still drifts from protocol naming and needs a real persistence fix before production data is written:
audit_events.request_idshould becometraceIdaudit_events.actorshould split intoactorTypeandactorIdaudit_events.sourceshould becomeactorIdaudit_events.operationshould becomeactionaudit_events.targetshould split intotargetTypeandtargetIdaudit_events.timestampshould becomeoccurredAtevidence_records.evidence_typeshould becomekindevidence_records.metadata_json.sha256needs a first-class persisted targethardware_operations.operation_json.resourceIdneeds a tested mapping pathhardware_operations.operation_json.capabilityIdneeds a tested mapping path
Evidence Chain
The evidence chain fixture set is already internally coherent. It binds the root IDs to the protocol schemas without changing the storage model:
chainIdanchors the fixtureoperationIdties hardware, audit, trace, and evidence togethertraceIdthreads through audit and trace events and is copied into evidence metadatagatewaySessionId,agentSessionId, andworkerSessionIdstay consistent where they appearhardwareOperation,auditEvents,traceEvents, andevidenceRecordseach point back to their schema counterparts
Impact
The current examples and validators are sufficient for audit evidence and MVP closure, but they are not a persistence contract. The drift map is intentionally read-only so later implementation work can pick one of two paths:
- rename the real storage columns to match the protocol, or
- keep the current skeleton and add a tested mapping layer before writes.
Validation
Run:
node --check scripts/validate-schema-drift-map.mjs
node scripts/validate-schema-drift-map.mjs