Tearleads

access_manifest_principal_head_projection API Postgres table

Indexed referenced-principal heads for an access manifest.

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

Description

This is a derived cache over accessManifests.referencedPrincipalHeads. Container/document access verification still checks the signed source manifest and the referenced principal policy heads. The projection exists so reads can find manifests involving a principal without scanning JSON.

Indexes:

  • (principalType, principalId) supports principal-oriented lookup.
  • (manifestHash, principalType, principalId) is unique because a manifest references one current head per principal. It also serves loading all principal heads for a manifest.

Columns

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

    Surrogate database primary key.

  • manifest_hashtext
    • not null

    Access manifest whose principal-head array this row expands.

  • object_kindtext
    • not null

    Object kind copied from the manifest.

  • object_iduuid
    • not null

    Object id copied from the manifest.

  • principal_typetext
    • not null

    Referenced managed principal kind.

  • principal_iduuid
    • not null

    Referenced principal id.

  • versionbigint
    • not null

    Principal state version committed by the manifest.

  • key_epochbigint
    • not null

    Principal key epoch committed by the manifest.

  • state_hashtext
    • not null

    Principal state hash committed by the manifest.

  • key_fingerprinttext
    • not null

    Principal key fingerprint committed by the manifest.

Keys and constraints

  • Check access_manifest_principal_head_projection_key_epoch_range
    "key_epoch" >= 1 AND "key_epoch" <= 9007199254740991 AND "key_epoch" = CAST("key_epoch" AS BIGINT)
  • Check access_manifest_principal_head_projection_version_range
    "version" >= 1 AND "version" <= 9007199254740991

Indexes

  • access_manifest_principal_projection_principal_idx(principal_type, principal_id)
    • access_manifest_principal_projection_unique_idx(manifest_hash, principal_type, principal_id)
      • unique