docsConcepts

Data Validation Lifecycle

Overview

memQL uses a three-state validation lifecycle for data records: draft, checked, and confirmed. This replaces the old staging/production concept split with a unified v1:data:record concept where data visibility is governed by validation state and configurable policies.

Vocabulary

TermMeaning
DraftData is being worked on. Volatile. Not usable.
CheckedSynthetically validated by a synthetic identity. May be usable if the policy allows.
ConfirmedHuman validated by a human identity. Fully valid. Always usable.
CheckForward action: a synthetic identity validates data (draft -> checked).
ConfirmForward action: a human identity validates data (checked -> confirmed).
RevertBackward action: move data to a previous state (confirmed -> checked, checked -> draft, etc.).
PolicyPer-concept configuration defining validation requirements.
LogAudit trail of all state transitions.

State Machine

text
┌─────────┐ check ┌─────────┐ confirm ┌───────────┐
│ DRAFT │ ─────────> │ CHECKED │ ──────────> │ CONFIRMED │
│ │ │ │ │ │
└─────────┘ <───────── └─────────┘ <────────── └───────────┘
revert revert
  • Draft -> Checked: Requires synthetic identity check(s) meeting policy threshold
  • Checked -> Confirmed: Requires human identity confirmation(s) meeting policy threshold
  • Any state -> Draft/Checked: Revert by identity with sufficient role (per policy)
  • Editing data: Automatically resets to draft (prior validations invalidated)

Identity Requirements

ActionRequired Identity TypeNotes
CheckSyntheticv1:identity:identity with type="synthetic"
ConfirmHumanv1:identity:identity with type="human"
RevertHuman or SyntheticMust meet revertMinRole from policy

Concepts

v1:data:record

Unified data record with validation state. Key fields:

  • validationState — enum: draft, checked, confirmed (default: draft)
  • checkCount / confirmCount — running tallies
  • lastCheckedBy / lastCheckedAt — last synthetic check metadata
  • lastConfirmedBy / lastConfirmedAt — last human confirm metadata
  • All original data fields: data, label, recordType, spaceId, importSource, etc.

v1:data:policy

Per-recordType validation configuration:

  • targetRecordType — which record type this policy applies to
  • spaceId — optional space scope (null = global)
  • requiredChecks — number of synthetic checks needed (default: 1)
  • requiredConfirmations — number of human confirmations needed (default: 1)
  • checkedDataUsable — whether checked records are usable live (default: false)
  • revertMinRole — minimum role to revert records (default: admin)

v1:data:log

Audit trail for state transitions:

  • recordId — which record
  • action — check, confirm, or revert
  • fromState / toState — state before and after
  • identityId / identityType — who did it
  • note — optional reason

Queries

QueryPurpose
recordsByStateFilter records by validation state, space, type
usableRecordsGet records usable per policy (confirmed + optionally checked)
validationLogAudit trail for a record or space
detectConflictsFind confirmed records with matching natural keys
policyGet the validation policy for a record type

Mutations

MutationPurpose
createRecordCreate a new record in draft state
createRecordBatchBatch-create records in draft state
updateRecordUpdate record data (resets to draft)
deleteRecordSoft-delete a record
checkRecordSynthetic check (increments count, may transition to checked)
confirmRecordHuman confirm (increments count, may transition to confirmed)
revertRecordRevert to a previous state
setPolicyCreate or update a validation policy

Events

EventTrigger
graph.node.created.v1:data:recordNew record created (automatic)
data.record.checkedRecord synthetically checked
data.record.confirmedRecord human confirmed
data.record.revertedRecord reverted to previous state
data.conflicts.detectedConflict found with existing confirmed records

Policy Examples

Strict (default): Requires 1 synthetic check + 1 human confirmation. Checked data is not usable.

text
requiredChecks: 1, requiredConfirmations: 1, checkedDataUsable: false

Synthetic-sufficient: For low-risk data where synthetic validation is enough for live use.

text
requiredChecks: 1, requiredConfirmations: 1, checkedDataUsable: true

Multi-reviewer: For high-stakes data requiring multiple validations.

text
requiredChecks: 3, requiredConfirmations: 2, checkedDataUsable: false

Skip synthetic check: For data that goes directly to human review.

text
requiredChecks: 0, requiredConfirmations: 1, checkedDataUsable: false