{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "product-event.schema.json", "title": "ProductEvent", "description": "One product event (REL-04, R4), measured without mixing records: cohort says whose it is (account, guest, machine, internal, qa) and every count is per cohort; machine, internal and qa never count as people. Only technical public ids, a stage, a latency bucket and an experiment/version: no question text, e-mail, passage, free URL or token, and the subject is a pseudonym (sp_ + HMAC), never the account id. A measurement event exists only with consent 'measurement'; 'essential' events are the ones the product needs to work. Erasure removes a pseudonym's events and stays in force after a restore (privacy/erasure.py).", "type": "object", "additionalProperties": false, "required": [ "schema_version", "event_id", "kind", "cohort", "subject_ref", "tenant_id", "consent", "occurred_at" ], "properties": { "schema_version": { "$ref": "common.schema.json#/$defs/schema_version" }, "event_id": { "type": "string", "pattern": "^ev_[0-9a-f]{24}$" }, "kind": { "enum": [ "context_ready", "analyst_started", "analyst_completed", "analyst_cancelled", "analyst_failed", "citation_opened", "evidence_opened", "scenario_completed", "first_lock_confirmed", "result_viewed_revision", "follows_changed" ] }, "cohort": { "enum": [ "account", "guest", "machine", "internal", "qa" ] }, "subject_ref": { "description": "Pseudonym of the subject (HMAC under a server key); null for a machine.", "type": [ "string", "null" ], "pattern": "^sp_[0-9a-f]{32}$" }, "tenant_id": { "$ref": "common.schema.json#/$defs/id" }, "consent": { "enum": [ "essential", "measurement" ] }, "occurred_at": { "$ref": "common.schema.json#/$defs/utc" }, "object_id": { "description": "A public technical id the event is about (testId, answer id, revision id).", "$ref": "common.schema.json#/$defs/id" }, "stage": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,31}$" }, "latency_bucket": { "enum": [ "lt_1s", "1_5s", "5_20s", "gt_20s" ] }, "experiment": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{0,47}$" }, "version": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$" } } }