Tearleads

principal_history_progress API Postgres table

Locally authenticated verification hints, never principal authority by themselves. Only the server's private progress key can validate the sealed prefix; the plain columns merely locate candidates. Losing these rows costs bounded re-verification and must not require a principal repair write.

Declared in packages/api-shared/src/schema/principalHistoryProgress.ts

Columns

  • iduuid
    • primary key
    • not null
    • default gen_random_uuid()

    Surrogate database primary key.

  • principal_typetext
    • not null

    Managed principal kind: organization or group.

  • principal_iduuid
    • not null

    Principal whose signed state history was verified.

  • verification_kindtext
    • not null

    policy when the principal's own policy chain was verified, or authority when a group's history was verified as the external admin authority for another principal's states.

  • protection_idtext
    • not null

    Hex SHA-256 naming the server key, rule revisions, and verification kind that sealed progress. Lookups use the current value, so rows sealed under another key or revision are never read.

  • input_hashtext
    • not null

    Hex SHA-256 of the principal and the earlier heads the verification was asked to retain. Progress is reused only for the same input.

  • versionbigint
    • not null

    Principal state version the saved progress verified through. A lookup takes the highest version at or below the head it verifies.

  • state_hashtext
    • not null

    State hash of the verified head at version.

  • key_epochbigint
    • not null

    Key epoch of the verified head at version.

  • key_fingerprinttext
    • not null

    Key fingerprint of the verified head at version.

  • progresstext
    • not null

    Sealed verifier snapshot, v3.<iv>.<ciphertext> with base64 parts: AES-GCM under a key derived from a server secret. A restored snapshot must match this row's head columns before it is used.

  • updated_attimestamp
    • not null
    • default now()

    Server-side timestamp of the latest write of this row.

Keys and constraints

  • Check principal_history_progress_key_epoch_range
    "key_epoch" >= 1 AND "key_epoch" <= 9007199254740991 AND "key_epoch" = CAST("key_epoch" AS BIGINT)
  • Check principal_history_progress_version_range
    "version" >= 1 AND "version" <= 9007199254740991
  • Check principal_history_progress_kind
    "verification_kind" IN ('policy', 'authority')

Indexes

  • principal_history_progress_version_idx(principal_type, principal_id, verification_kind, input_hash, protection_id, version)
    • unique