Expand description
cairn pds-admin {takedown, suspend, restore} (#99, Phase E) —
manual escape hatch for the PDS-admin bridge (#87).
Production path is policy-automation + label-emission firing the bridge automatically (the writer’s post-commit dispatch per #87). This subcommand exists for testing the bridge during Phase B verification and for operator one-off escalations — and explicitly does NOT skip the strike accounting / audit chain.
§Routing
HTTP-routed via tools.cairn.admin.{recordAction, revokeAction}
against the running cairn serve. Same pattern as cairn moderator action / cairn moderator revoke. The writer task’s
post-commit dispatch (introduced in #87) fires the
OzoneBackend call automatically when the action_type is
takedown / temp_suspension / indef_suspension.
Why HTTP not direct-DB: the bridge dispatch lives inside the
writer task. Direct-DB would either bypass the dispatch (wrong
semantics) or force the CLI to spawn a writer (heavyweight, and
conflicts with a running cairn serve). HTTP routes the action
through the canonical pipeline.
§--config purpose
The CLI loads the operator config to:
- Pre-flight check
[pds_admin].enabled = true. Without this check, a misconfigured operator would issue a recordAction, have it succeed, and only learn the bridge was disabled when looking at logs — the CLI catches the case upfront. - Read the DB path for the post-call
pds_admin_auditlookup (so the CLI can show the operator the bridge outcome).
The --config operator must point at the same config the
running cairn serve is using; otherwise the pre-flight check
is meaningless. v1.7 doesn’t enforce this — operator
responsibility.
§restore semantics
cairn-mod has no first-class “restore” action_type. Restoration
is a revoke_action of the most recent unrevoked
takedown / temp_suspension / indef_suspension. The CLI:
- Reads the most-recent unrevoked active suspension row from
subject_actions(direct DB). - Calls
tools.cairn.admin.revokeActionwith that row’s id via HTTP. - The writer’s post-commit dispatch fires
OzoneBackend::restore_account.
Operators wanting a specific action_id (rather than “most
recent”) should use cairn moderator revoke <action_id> —
cairn pds-admin restore <did> is the convenience case.
Structs§
- PdsAdmin
Audit View - Wire-shaped projection of one
pds_admin_auditrow for CLI output. Hash-chain columns (prev_hash,row_hash) and internal book-keeping are omitted; this is operator-facing. - PdsAdmin
Restore Outcome - Outcome of
cairn pds-admin restore. Wraps the revokeAction response plus the pds_admin_audit row (when a bridge-drivenrestore_accountcall fired). - PdsAdmin
Takedown Outcome - Outcome of
cairn pds-admin {takedown, suspend}. Wraps the recordAction response plus the just-fired pds_admin_audit row (when the bridge dispatch produced one).
Constants§
- PDS_
ADMIN_ DEFAULT_ REASON_ CODE - Reserved reason code recorded on every
cairn pds-admin-driven recordAction. Operators must declare this in[moderation_reasons]if they want manual bridge escalations to succeed; otherwise the writer surfacesReasonNotFoundand the CLI prints the underlying error.
Functions§
- find_
active_ suspension_ action_ id - Fetch the most-recent unrevoked active-suspension
subject_actionsrow for a subject. Used byrestoreto resolve the action_id to revoke. - find_
pds_ admin_ audit_ for_ action - Look up the
pds_admin_auditrow matching the precipitating action_id. ReturnsOk(None)when no audit row is found — either the bridge hasn’t dispatched yet (the CLI is racing the writer’s post-commit hook), or the bridge is disabled, or the dispatch produced anUnsupportedoutcome that wasn’t audit-logged. - format_
restore_ human - Human-readable two-line output for restore.
- format_
restore_ json - Single-line JSON for restore (tooling).
- format_
takedown_ human - Human-readable two-line output for takedown / suspend.
- format_
takedown_ json - Single-line JSON for takedown / suspend (tooling).
- restore
cairn pds-admin restore <did>— find the most-recent unrevoked takedown/suspension for the subject, revoke it via HTTP, then look up the bridge dispatch.- suspend
cairn pds-admin suspend <did>— record a temp_suspension (when--durationis set) or indef_suspension (otherwise) via HTTP. Same bridge-dispatch lookup as takedown.- takedown
cairn pds-admin takedown <did>— record a Takedown action via HTTP, then look up the bridge dispatch outcome.- verify_
pds_ admin_ enabled - Verify
[pds_admin].enabled = truein the loaded config. The CLI calls this before issuing the recordAction so a misconfigured operator gets a precise error pointing at the config block, rather than a successful recordAction with a silently-no-op bridge.