PropertyDamage.Progress (PropertyDamage v0.2.0)

View Source

The progress-projection envelope (DR-022).

A %PropertyDamage.Progress{} is a derived projection of an operation's authoritative state at a checkpoint, fanned out to consumers (the verbose: printer, a user on_progress: callback, telemetry). It carries cross-cutting metadata plus an operation-specific :data payload.

The payload's struct type is the discriminator — there is deliberately no kind/operation field, because both are derivable from the payload and carrying them would invite drift. classify/1 is the single site that maps a payload struct to its {operation, kind}.

Progress is a view of authoritative state, never its source: results and metrics are authoritative (an operation's return value), and a terminal *Result payload carries a copy of that result for consumers.

Summary

Functions

Whether a progress value is an intermediate update or a terminal result.

Wrap a payload struct in a progress envelope.

The operation a progress value belongs to.

The telemetry event name for a progress value: [:property_damage, operation, kind].

Types

kind()

@type kind() :: :progress | :result

operation()

@type operation() :: :test_run | :load_test | :mutation | :differential

payload()

t()

@type t() :: %PropertyDamage.Progress{
  at: integer() | nil,
  data: payload(),
  elapsed_ms: non_neg_integer() | nil,
  run_id: term()
}

Functions

kind(progress)

@spec kind(t()) :: kind()

Whether a progress value is an intermediate update or a terminal result.

new(data, opts \\ [])

@spec new(
  payload(),
  keyword()
) :: t()

Wrap a payload struct in a progress envelope.

Options: :at (system time when projected), :elapsed_ms (since the operation started), :run_id (correlation id for the operation invocation).

operation(progress)

@spec operation(t()) :: operation()

The operation a progress value belongs to.

telemetry_event(progress)

@spec telemetry_event(t()) :: [atom(), ...]

The telemetry event name for a progress value: [:property_damage, operation, kind].