← Files note Workspace|ROGNALIAARCHIVED FILE

skills/note-tracker/references/schemas/metrics-history-event.schema.json

3.78 KB · Oct 3, 2026 · 06:35 UTC

↓ Download file

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:rognalia:note-workspace:schema:metrics-history-event:1",
  "title": "note Workspace metrics history event",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version", "event_type", "request_id", "payload_sha256", "workspace_id",
    "run_id", "collection_mode", "observed_at", "recorded_at", "article", "metrics",
    "note", "external_actions"
  ],
  "properties": {
    "schema_version": {"const": 1},
    "event_type": {"const": "metrics_observed"},
    "request_id": {"type": "string"},
    "payload_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "workspace_id": {"type": "string", "pattern": "^nw-[a-z0-9][a-z0-9-]{5,63}$"},
    "run_id": {"type": "string"},
    "collection_mode": {"enum": ["manual", "scheduled"]},
    "observed_at": {"type": "string", "format": "date-time"},
    "recorded_at": {"type": "string", "format": "date-time"},
    "article": {"$ref": "#/$defs/article"},
    "metrics": {
      "type": "array",
      "minItems": 3,
      "maxItems": 3,
      "items": {"$ref": "#/$defs/metric"}
    },
    "note": {"type": ["string", "null"]},
    "external_actions": {"const": []}
  },
  "$defs": {
    "article": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "origin", "article_id", "article_revision", "registry_event_sha256",
        "title", "public_url", "published_at"
      ],
      "properties": {
        "origin": {"enum": ["workspace_draft", "existing_public_article"]},
        "article_id": {"type": "string", "pattern": "^article-[a-z0-9][a-z0-9-]{2,63}$"},
        "article_revision": {"type": ["integer", "null"], "minimum": 1},
        "registry_event_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
        "title": {"type": "string", "minLength": 1, "maxLength": 200},
        "public_url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://(?:www\\.)?note\\.com/(?:[A-Za-z0-9_-]+/)?n/[A-Za-z0-9_-]+$",
          "maxLength": 1000
        },
        "published_at": {"type": ["string", "null"], "format": "date-time"}
      },
      "allOf": [{
        "if": {"properties": {"origin": {"const": "workspace_draft"}}, "required": ["origin"]},
        "then": {
          "properties": {
            "article_revision": {"type": "integer", "minimum": 1},
            "registry_event_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
          }
        },
        "else": {
          "properties": {
            "article_revision": {"type": "null"},
            "registry_event_sha256": {"type": "null"}
          }
        }
      }]
    },
    "metric": {
      "type": "object",
      "additionalProperties": false,
      "required": ["metric", "status", "value", "source", "reason"],
      "properties": {
        "metric": {"enum": ["views", "likes", "comments"]},
        "status": {"enum": ["available", "unavailable", "not_visible", "fetch_failed", "not_applicable"]},
        "value": {"type": ["integer", "null"], "minimum": 0},
        "source": {"enum": ["note_public_page", "note_creator_dashboard", "manual_user_report", "not_observed"]},
        "reason": {"type": ["string", "null"], "maxLength": 500}
      },
      "allOf": [{
        "if": {"properties": {"status": {"const": "available"}}, "required": ["status"]},
        "then": {
          "properties": {
            "value": {"type": "integer", "minimum": 0},
            "reason": {"type": "null"},
            "source": {"enum": ["note_public_page", "note_creator_dashboard", "manual_user_report"]}
          }
        },
        "else": {
          "properties": {
            "value": {"type": "null"},
            "reason": {"type": "string", "minLength": 1, "maxLength": 500}
          }
        }
      }]
    }
  }
}

SHA-256: e091bfa1f9984853718647b2abbbb019395024b76e86459ed4e4878fc6782de0