StatifierBlocks.Compiled (StatifierBlocks v0.34.0)

Copy Markdown View Source

What one successful compile produced (ADR-0004 decision 1).

Nothing in here is written back into the document. ADR-0001 decision 2 forbade storing derived data in the document and named the provenance map specifically. A host stores this artifact beside the document or recomputes it - both are correct, and decision 6's determinism is what makes them equivalent.

Decision 1's five fields, and what each is for:

  • scxml - the generated bytes. Chart identity hashes exactly these (st-ADR-0052), so they are identity-bearing and the serializer that wrote them is identity-bearing code.
  • provenance - StatifierBlocks.Provenance, keyed by state id for runtime highlighting and by byte span for routing findings back to the block that caused them (decision 5).
  • record - StatifierBlocks.CompilationRecord, the join between document identity and chart identity (decision 7). Given a running session, look up by chart_identity and get the document, the revision, and the map.
  • invoke_types - the sorted set of invoke type strings appearing in the generated SCXML (decision 8). Published unconditionally, because it is a fact about the compile and nothing else. The real fix for the two-registry gap is the host comparing this against its st-ADR-0051 registration at deploy time, when it knows both; this field is what makes that a one-liner.
  • warnings - findings that did not fail the compile: upstream's own warnings (st-ADR-0033) mapped through provenance, and decision 8's optional invoke-type lint when the caller asked for it.

One field beside them, from ADR-0014 decision 3:

  • accepts - the document's own accepts list, exactly as written: the names of the external events the document declares it accepts. A pass-through the compile reads nothing from and judges nothing about; [] means the document declares nothing. Whether each name is one the chart can take is a host's publish-time question (ADR-0014 decision 4), asked over scxml and this list together.

And one from ADR-0008's amendment of 2026-09-22, A5:

  • interface - what this document offers a parent that invokes it, and what it relies on from each child it invokes: see interface/0. Recorded on every compile, whatever the chart-use option, and a function of the same inputs the SCXML is. It adds nothing to the SCXML, so nothing to chart identity, and it is not carried onto StatifierBlocks.CompilationRecord. The package reads it in one place, StatifierBlocks.Graph, whose two checks a host's publish step calls.

Summary

Types

One block of this document that names another document to run (ADR-0008's amendment of 2026-09-22, A1's parent side).

The document's side of the parent/child interface (A1, A5).

t()

Types

child_reference()

@type child_reference() :: %{
  block_id: StatifierBlocks.Block.id(),
  document_id: String.t(),
  routes_on: [String.t()],
  reads: [String.t()],
  unresolved: String.t() | nil
}

One block of this document that names another document to run (ADR-0008's amendment of 2026-09-22, A1's parent side).

  • block_id - the referencing block, which a finding about this reference is anchored on.
  • document_id - the document the block names in its chart field.
  • routes_on - the child outcomes the block routes on: a core.subchart's outcomes as StatifierBlocks.Core.Subchart.child_outcomes/1 reads them, so ["done"] when the author listed none. A core.map routes on none of its child's outcomes, so [].
  • reads - the child done-data keys the block reads: the members a core.map's collect_type marks required, when it resolves to members - its inline arm, or a name the compile's :datamodel declares. A core.subchart reads none, so [].
  • unresolved - the collect_type name, trimmed, of a core.map whose collect_type is a name the compile was given no :datamodel to resolve: the keys it reads are then unchecked, not absent, and reads is []. nil for the inline arm, an absent or blank collect_type, a name read against a supplied :datamodel and every core.subchart (ADR-0008's second amendment of 2026-09-22, U2).

interface()

@type interface() :: %{
  declared_outcomes: [String.t()],
  declared_donedata_keys: [String.t()],
  references: [child_reference()]
}

The document's side of the parent/child interface (A1, A5).

  • declared_outcomes - the outcomes the document's root block declares: the set a :child_use compile gives one top-level <final> each.
  • declared_donedata_keys - the names the root block type's donedata_type/1 declares, which a :child_use compile emits as <param>s.
  • references - one child_reference/0 per block that names another document, in document pre-order.

t()

@type t() :: %StatifierBlocks.Compiled{
  accepts: [String.t()],
  interface: interface(),
  invoke_types: [String.t()],
  provenance: StatifierBlocks.Provenance.t(),
  record: StatifierBlocks.CompilationRecord.t(),
  scxml: binary(),
  warnings: [StatifierBlocks.Compiler.Finding.t()]
}