Tearleads

principal_policy_checkpoints Client SQLite table

Durable organization ownership for every managed-principal cache, and its monotonic anti-rollback pin. Policy caching records the owner before any pin, so a row with a null version, state hash, and update time is owned but not pinned; the pin readers treat it as no checkpoint.

Declared in packages/client-sdk/src/data/sqlite/schema/principalPolicySchema.ts

Columns

  • principal_typetext
    • not null

    Managed principal kind: group or organization.

  • principal_idtext
    • not null

    Managed principal id.

  • organization_idtext
    • not null

    Organization that owns the principal's cache; an organization principal owns itself. Writes from another organization are refused.

  • versioninteger
    • nullable

    Pinned head version. It only advances; null when not pinned.

  • state_hashtext
    • nullable

    Hex SHA-256 state hash pinned at version; a different hash at the same version is refused. Null when not pinned.

  • updated_attext
    • nullable

    ISO-8601 time the pin was last written; null when not pinned.

Keys and constraints

  • Primary key(principal_type, principal_id)

DDL

The statements the client runs to create this table and its indexes.

CREATE TABLE IF NOT EXISTS "principal_policy_checkpoints" (
  "principal_type" TEXT NOT NULL,
  "principal_id" TEXT NOT NULL,
  "organization_id" TEXT NOT NULL,
  "version" INTEGER,
  "state_hash" TEXT,
  "updated_at" TEXT,
  PRIMARY KEY ("principal_type", "principal_id")
);