ReactiveDag.Attestation.Op (reactive_dag v0.16.0)

Copy Markdown View Source

The recompute of an ATTESTED cell — the derived view an attested combinator or a gate:d edge lowers to. Thin DB glue: read the three inputs, run the pure ReactiveDag.Attestation.Evaluation, write ordinary spine rows.

The cell's meta carries attested: %{over: raw_cell_id, requirement: %Requirement{}} (resolved at graph assembly). Inputs are [raw, eligibility, store leaf] — so a scan, a role change, or a signing all dirty this cell and the drain recomputes it the same way.

What it writes

One spine row per admission, in the requirement's status vocabulary — so verdict rollup, first-class coverage, and the freshness spine apply to attested views unchanged. The mapping depends on the view's MODE (spine_status/3):

  • :require (blocking, the default) — covered / pending / refused. A not-yet-signed row is withheld: consumers of the signed set read covered and see nothing for it.
  • :annotate (non-blocking) — covered / unsigned / refused. Best effort: an unsigned row FLOWS, distinguished from signed rather than withheld. A rejection still bites — data someone said is WRONG is a different thing from data nobody has vouched for, and passing it through as best-effort would launder the objection.

Affirmed rows are put with strength: "attested" in the writer opts: the spine-only default writer drops it (strength is a host extension column), a host writer stamps it — which keeps "the machinery assigns the strength" inside the existing CoordinationWriter seam.

Rows vanished from the raw cell are retired (delete): an attested view has no claim about data that no longer exists — the attestation RECORD survives in the store (append-only history), only the projection row goes.

Summary

Functions

The SCOPE INSTANCES of a filter-shaped requirement — {instance_key, key_scope} pairs, one view row each. Pure: {:filter, ks} yields the single instance (keyed by the requirement's instance_key); {:filter_by, fun} derives one per eligibility key (nil — or a clause that doesn't match the key — skips; deduped by instance key, first wins).

The admission → spine-status projection, per mode. Pure — the one place the blocking/non-blocking distinction lives (force evaluation is identical in both; a mode only changes what a not-yet-signed row projects to).

Functions

instances(req, eligibility)

@spec instances(ReactiveDag.Attestation.Requirement.t(), [String.t()]) :: [
  {String.t(), term()}
]

The SCOPE INSTANCES of a filter-shaped requirement — {instance_key, key_scope} pairs, one view row each. Pure: {:filter, ks} yields the single instance (keyed by the requirement's instance_key); {:filter_by, fun} derives one per eligibility key (nil — or a clause that doesn't match the key — skips; deduped by instance key, first wins).

spine_status(arg1, arg2, statuses)

@spec spine_status(:affirmed | :pending | :refused, :require | :annotate, map()) ::
  String.t()

The admission → spine-status projection, per mode. Pure — the one place the blocking/non-blocking distinction lives (force evaluation is identical in both; a mode only changes what a not-yet-signed row projects to).