recon_gen.common.l2.derived

Computed views over a loaded L2Instance (M.1a.4).

Holds pure-function derivations that expose values the SPEC declares conceptually but doesn’t store directly on the primitives. Today’s single citizen is posted_requirements_for: the SPEC says every leg has a PostedRequirements set composed of three sources — integrator- declared posted_requirements on the Rail, auto-derived TransferKey fields from any containing TransferTemplate, and parent_transfer_id when a Required-true chain entry points at the rail (directly or via its template). Storing the resolved set on the Rail would force the loader to compute it, baking dependency order into the type system; a computed view keeps the input primitives clean and the derivation testable in isolation.

Pure functions over an L2Instance — no I/O, no side effects, no mutation.

Functions

posted_requirements_for(instance, rail_name)

Return the resolved PostedRequirements set for rail_name.

recon_gen.common.l2.derived.posted_requirements_for(instance, rail_name)[source]

Return the resolved PostedRequirements set for rail_name.

Unions three sources per the SPEC’s “PostedRequirements” subsection:

  1. The Rail’s own posted_requirements (integrator-declared).

  2. TransferKey fields for any TransferTemplate where this rail appears in leg_rails (auto-derived from the template’s grouping rule — a leg can’t be Posted without naming the grouping values).

  3. parent_transfer_id if this rail is the singleton child of any Chain row, OR if a TransferTemplate containing this rail is the singleton child of any Chain row. Under the Z.A grammar collapse, a singleton-children row encodes “required” semantics (parent firing always invokes this child) — every firing IS a chain firing, so parent_transfer_id is always populated. A multi-children (XOR) row makes parent_transfer_id optional — only one of the siblings fires per parent invocation.

Output is deduped and sorted lexicographically — deterministic across runs, integrator-declared overlap with TransferKey auto-derivation collapses cleanly.

Raises KeyError if rail_name doesn’t match any declared rail.

Return type:

tuple[Identifier (str), ...]

Parameters: