Threadline.Continuity (Threadline v1.0.0)

Copy Markdown View Source

Threadline.Continuity documents the post-install capture boundary that starts each table's audit history at its first trigger-fired mutation.

T₀ means there are no AuditChange rows for a table until the first real trigger-fired mutation after capture is installed. There is no pre-trigger history — operators must not expect retroactive audit rows for data that existed before triggers were live.

Consequently, Threadline.row_history/3 returns [] for a primary key until that first post-install mutation produces an audit_changes row.

Coverage checks reuse Threadline.Health.trigger_coverage/1 (catalog queries only); this module does not duplicate pg_trigger / pg_tables inspection.

See guides/brownfield-continuity.md for the operator checklist and compliance notes.

Summary

Functions

Returns :ok when table_name exists and has a Threadline capture trigger; raises ArgumentError when the table, schema, or trigger is missing, and KeyError when the required :repo option is missing.

Returns {:ok, iodata()} containing a human-readable, read-only explanation of brownfield cutover steps. Raises KeyError when the required :repo option is missing.

Types

assert_capture_ready_opt()

@type assert_capture_ready_opt() :: Threadline.repo_opt() | {:schema, String.t()}

An option accepted by assert_capture_ready!/2.

explain_cutover_opt()

@type explain_cutover_opt() :: Threadline.repo_opt()

An option accepted by explain_cutover/1.

Functions

assert_capture_ready!(table_name, opts)

@spec assert_capture_ready!(String.t(), [assert_capture_ready_opt()]) :: :ok

Returns :ok when table_name exists and has a Threadline capture trigger; raises ArgumentError when the table, schema, or trigger is missing, and KeyError when the required :repo option is missing.

Bare table names resolve to the public host schema by default. Pass schema: "support" for a selected host schema, or pass a schema-qualified identifier such as "support.tickets".

Options

  • :repo — Ecto.Repo module. Required.
  • :schema — host schema string. Optional. Selects the schema for a bare table name.

Returns

  • :ok — the table exists and has an enabled Threadline capture trigger.
  • Raises ArgumentError when the table or schema is unknown or the trigger is absent.

Other option keys are ignored.

explain_cutover(opts)

@spec explain_cutover([explain_cutover_opt()]) :: {:ok, iodata()}

Returns {:ok, iodata()} containing a human-readable, read-only explanation of brownfield cutover steps. Raises KeyError when the required :repo option is missing.

Options

  • :repo — Ecto.Repo module. Required for compatibility with continuity checks.

Returns

  • {:ok, iodata()} — the cutover checklist as newline-separated text.

Other option keys are ignored.