# Threadline v0.5.0 - Table of Contents

Audit platform for Elixir teams using Phoenix, Ecto, and PostgreSQL

## Pages

- Overview
  - [Threadline](readme.md)

- Integrations
  - [Threadline ↔ Sigra integration](sigra.md)

- Reference
  - [Integration Contracts](integration-contracts.md)
  - [Performance](performance.md)
  - [Threadline domain reference](domain-reference.md)
  - [Operator Surface](operator-surface.md)
  - [Upgrade Path](upgrade-path.md)
  - [Brownfield continuity with Threadline capture](brownfield-continuity.md)
  - [Production checklist (Threadline)](production-checklist.md)
  - [Threadline Incident Playbook](incident-playbook.md)
  - [Getting started with Threadline in a Phoenix SaaS app](getting-started-saas.md)
  - [Adoption pilot backlog](adoption-pilot-backlog.md)
  - [Audit table indexing cookbook](audit-indexing.md)

- Project
  - [Contributing to Threadline](contributing.md)
  - [Changelog](changelog.md)

## Modules

- [Threadline.Capture.Migration](Threadline.Capture.Migration.md): SQL DDL for the Threadline audit schema.
- [Threadline.Capture.RedactionPolicy](Threadline.Capture.RedactionPolicy.md): Validates trigger redaction options at codegen time (Mix / `TriggerSQL`).
- [Threadline.Capture.TriggerCaptureConfig](Threadline.Capture.TriggerCaptureConfig.md): Shared loader for `config :threadline, :trigger_capture`.
- [Threadline.Capture.TriggerSQL](Threadline.Capture.TriggerSQL.md): Generates PL/pgSQL trigger DDL for Threadline audit capture.
- [Threadline.ChangeDiff](Threadline.ChangeDiff.md): Pure projection of a single captured row change into deterministic, JSON-friendly maps.
- [Threadline.Health.Policy](Threadline.Health.Policy.md): Validates `:expected_uncovered_tables` and `:audit_anyway` configuration
for `Threadline.Health.trigger_coverage/1`'s third bucket.
- [Threadline.Investigation](Threadline.Investigation.md): Higher-level investigation helpers layered on top of Threadline query primitives.
- [Threadline.Investigation.IncidentBundle](Threadline.Investigation.IncidentBundle.md): One transaction-focused incident bundle with linked context and packaged diffs.

- [Threadline.Investigation.IncidentChange](Threadline.Investigation.IncidentChange.md): One bundled incident change with raw linked structs and a packaged diff.

- [Threadline.Investigation.LinkedChange](Threadline.Investigation.LinkedChange.md): One investigation change row with linked transaction and optional action context.

- [Threadline.Investigation.LinkedTransaction](Threadline.Investigation.LinkedTransaction.md): One transaction-oriented investigation slice with optional action metadata.

- [Threadline.OperatorSurface](Threadline.OperatorSurface.md): Namespace for the Threadline operator surface — the opt-in mountable
LiveView surface that turns Threadline's investigation contracts into
one-click answers for documented support questions.
- [Threadline.OperatorSurface.Components.SurfaceHeader](Threadline.OperatorSurface.Components.SurfaceHeader.md): Surface-wide header showing a coverage-drift badge that links to
`/audit/coverage`.
- [Threadline.OperatorSurface.Controllers.ExportController](Threadline.OperatorSurface.Controllers.ExportController.md): HTTP-side parity controller for the operator-surface "Download CSV / JSON
/ NDJSON" affordances. Three actions (`csv/2`, `json/2`, `ndjson/2`); each
dispatches through one private `dispatch/3` so the format-vs-transport
branching is in one place.
- [Threadline.OperatorSurface.Coverage.OnMount](Threadline.OperatorSurface.Coverage.OnMount.md): `live_session` `on_mount/4` callback that drives polled trigger-coverage
for every LV in the `:threadline` session.
- [Threadline.OperatorSurface.Coverage.Snapshot](Threadline.OperatorSurface.Coverage.Snapshot.md): Snapshot of `Threadline.Health.trigger_coverage/1` results for the operator
surface coverage dashboard and surface-header pill.
- [Threadline.OperatorSurface.ExportAuthPlug](Threadline.OperatorSurface.ExportAuthPlug.md): Conn-shaped authorize plug for the Threadline operator-surface export
endpoints. Conn-shaped twin of `Threadline.OperatorSurface.Auth.on_mount/4`.
- [Threadline.OperatorSurface.Exports.Filename](Threadline.OperatorSurface.Exports.Filename.md): Canonical filename for operator-surface exports.
- [Threadline.OperatorSurface.Exports.FilterParams](Threadline.OperatorSurface.Exports.FilterParams.md): Parses a string-keyed URL params map into a keyword list ready for
`Threadline.Query.validate_timeline_filters!/1`.
- [Threadline.OperatorSurface.Live.ActorLive](Threadline.OperatorSurface.Live.ActorLive.md)
- [Threadline.OperatorSurface.Live.TransactionLive](Threadline.OperatorSurface.Live.TransactionLive.md)
- [Threadline.OperatorSurface.Scope](Threadline.OperatorSurface.Scope.md): Host-owned query scoping helpers for operator-surface flows.

- [Threadline.OperatorSurface.Style](Threadline.OperatorSurface.Style.md): Provides isolated CSS for the Threadline Operator Surface.

- [Threadline.Policy.RedactionPresenter](Threadline.Policy.RedactionPresenter.md): Shared redaction drift presenter for Mix and LiveView parity.
- [Threadline.Query](Threadline.Query.md): Ecto query implementations for the Threadline public API.
- [Threadline.Query.ActorHistoryPage](Threadline.Query.ActorHistoryPage.md): One keyset page from the actor history query layer.

- [Threadline.Query.TimelinePage](Threadline.Query.TimelinePage.md): One keyset page from the timeline query layer.

- [Threadline.Semantics.Migration](Threadline.Semantics.Migration.md): DDL helpers for the Threadline semantics schema (Phase 2).
- [Threadline.Verify.CoveragePolicy](Threadline.Verify.CoveragePolicy.md): Pure policy for comparing `Threadline.Health.trigger_coverage/1` output with
host-configured expected audited table names.

- Core API
  - [Threadline](Threadline.md): Audit platform for Elixir teams using Phoenix, Ecto, and PostgreSQL.
  - [Threadline.Export](Threadline.Export.md): CSV and JSON export for audited row changes.
  - [Threadline.Retention](Threadline.Retention.md): Batched retention purge for `audit_changes` and empty `audit_transactions`.
  - [Threadline.Retention.Policy](Threadline.Retention.Policy.md): Validates **`config :threadline, :retention`** before purge runs.
  - [Threadline.Semantics.ActorRef](Threadline.Semantics.ActorRef.md): Value object representing the actor who performed an audited operation.
  - [Threadline.Semantics.AuditContext](Threadline.Semantics.AuditContext.md): Execution context for an audited request or job.

- Integration
  - [Threadline.Continuity](Threadline.Continuity.md): Brownfield cutover helpers for honest **T₀** semantics with Threadline capture.
  - [Threadline.Health](Threadline.Health.md): Health checks for Threadline infrastructure.
  - [Threadline.Job](Threadline.Job.md): Helpers for propagating audit context through background job `args` maps.
  - [Threadline.Plug](Threadline.Plug.md): Plug that extracts `AuditContext` from a `Plug.Conn` and stores it in
`conn.assigns[:audit_context]`.
  - [Threadline.Telemetry](Threadline.Telemetry.md): Telemetry integration helpers for Threadline.

- Integrations
  - [Threadline.Integrations.Sigra](Threadline.Integrations.Sigra.md): Soft-dependency adapter for deriving Threadline audit context from Sigra state.

- Operator Surface (Optional In-Tree)
  - [Threadline.OperatorSurface.Auth](Threadline.OperatorSurface.Auth.md): Authentication contract for the Threadline operator surface.

  - [Threadline.OperatorSurface.Router](Threadline.OperatorSurface.Router.md): Provides the `threadline_operator_surface/2` macro to mount the
Threadline LiveView interface within a Phoenix router.

- Schemas
  - [Threadline.Capture.AuditChange](Threadline.Capture.AuditChange.md): Ecto schema for the `audit_changes` table.
  - [Threadline.Capture.AuditTransaction](Threadline.Capture.AuditTransaction.md): Ecto schema for the `audit_transactions` table.
  - [Threadline.Semantics.AuditAction](Threadline.Semantics.AuditAction.md): Ecto schema for the `audit_actions` table.

## Mix Tasks

- [mix threadline.health.coverage](Mix.Tasks.Threadline.Health.Coverage.md): Shows trigger coverage as reported by `Threadline.Health.trigger_coverage/1`,
with a three-section table (default) or JSON output (`--json`).
- [mix threadline.policy.show](Mix.Tasks.Threadline.Policy.Show.md): Shows configured versus deployed redaction policy drift for Threadline capture
triggers, using the shared `Threadline.Policy.RedactionPresenter`.

- Mix Tasks
  - [mix threadline.continuity](Mix.Tasks.Threadline.Continuity.md): Brownfield capture cutover helper — honest T0 semantics (see `guides/brownfield-continuity.md`).
  - [mix threadline.export](Mix.Tasks.Threadline.Export.md): Loads application config, starts the configured Ecto repo, and writes an export file
using `Threadline.Export` — **no** ad-hoc `Ecto.Query` in this task (parity with
`mix threadline.retention.purge`).
  - [mix threadline.gen.triggers](Mix.Tasks.Threadline.Gen.Triggers.md): Generates an Ecto migration that installs Threadline audit triggers on the
specified tables.
  - [mix threadline.incident](Mix.Tasks.Threadline.Incident.md): Loads application config, starts the configured Ecto repo, and fetches
the incident bundle for a given transaction ID.
  - [mix threadline.install](Mix.Tasks.Threadline.Install.md): Generates an Ecto migration file for the Threadline audit schema.
  - [mix threadline.retention.purge](Mix.Tasks.Threadline.Retention.Purge.md): Delegates to `Threadline.Retention.purge/1` after loading application config and
starting the configured Ecto repo (same resolution pattern as `mix threadline.verify_coverage`).
  - [mix threadline.verify_coverage](Mix.Tasks.Threadline.VerifyCoverage.md): Verifies that tables listed in application config have Threadline audit
triggers installed, using the same catalog queries as `Threadline.Health.trigger_coverage/1`.

