Tearleads

root_audit_events API Postgres table

Every platform-operator action, in the order it happened.

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

Description

The /root routes record one row before they read or change anything, and a request whose row cannot be written is refused, so no operator lookup goes unrecorded. Every change to who holds root is recorded in the transaction that makes it: a signed Admins commit on the operator organization records root.access.grant / root.access.revoke for each administrator it adds or removes, and the API CLI records root.operatorOrganization.designate with the grants and revokes a designation implies. Rows are platform records, not organization data: an organization purge leaves them in place.

Indexes:

  • root_audit_events_occurred_at_id_idx backs the newest-first listing.
  • (actorUserId, occurredAt, id) backs the listing filtered to one subject id, which matches the actor, the target user, or the target organization.
  • (targetUserId, occurredAt, id) backs that filter's target-user match.
  • (targetOrganizationId, occurredAt, id) backs its target-organization match.

Columns

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

    Event id. The listing pages newest first by (occurredAt, id) and hands back the last returned event's id as its cursor.

  • actor_user_iduuid
    • nullable

    The identity that acted: the root identity that made the request, or the administrator who signed an Admins commit. Null when the API CLI acted with database credentials.

  • actiontext
    • not null

    What was done — a root operation id such as root.identities.get, or root.access.grant / root.access.revoke.

  • target_user_iduuid
    • nullable

    The identity or organization the action was about, when it named one.

  • target_organization_iduuid
    • nullable

    The identity or organization the action was about, when it named one.

  • filtertext
    • nullable

    The listing filters the operator applied, as a sorted query string (fingerprint=…, search=…); paging cursors are not recorded.

  • source_ip_addresstext
    • nullable

    The operator's request IP, when one was resolved.

  • occurred_attimestamp
    • not null
    • default now()

    When the action was recorded.

Indexes

  • root_audit_events_occurred_at_id_idx(occurred_at, id)
    • root_audit_events_actor_idx(actor_user_id, occurred_at, id)
      • root_audit_events_target_user_idx(target_user_id, occurred_at, id)
        • root_audit_events_target_organization_idx(target_organization_id, occurred_at, id)