recon_gen.common.spine.transfer_template
TransferTemplate firing (broad-mode) family — ViolationGenerator only.
AY.2.b promotion of common/l2/seed.py::TransferTemplatePlant (M.3.10g + broad-mode plant kind). This is a SEED-COLOR generator: it plants ONE shared Transfer firing of an L2-declared TransferTemplate so the L2 Flow Tracing dashboard’s Transfer Templates sheet has visible content for each declared template.
The OLD _emit_transfer_template_rows carries picker-layer sophistication (chain_children resolution + per-firing transfer_key synthesis + per-leg-origin table). The spine generator stays minimal — emit a clean firing of a single resolved template. The picker layer (post-AY.4) composes multiple generators + handles chain children + metadata cascade through helpers reused across the broad-mode plants.
Per the AY.2.b evidence-currency layering:
intended returns a CoverageObservation keyed on (template_name, transfer_id, firing_seq) — “I planted a firing of template T.” No matching Invariant (the L2 Flow Tracing surface reads template firings directly; “this template fired” isn’t a violation shape).
Like RailFiringGenerator, the rail-kind discriminator (first leg_rail of the template) lives on the generator as is_two_leg: bool; the factory’s scenario_for_template resolves the kind from the L2 instance + pre-populates the right fields. The template’s transfer_key metadata fields land at the picker layer (each firing needs distinct synthetic values per the SPEC’s “same transfer_key joins one shared Transfer” rule — picker-layer concern, not generator-layer).
Classes
|
Smart constructor namespace for TransferTemplateGenerator. |
|
Emit one Posted firing of an L2-declared TransferTemplate. |
- class recon_gen.common.spine.transfer_template.TransferTemplateFactory(prefix='spec_example')[source]
Bases:
objectSmart constructor namespace for TransferTemplateGenerator.
Resolves a TransferTemplate by name + its first leg_rail’s kind from the L2 instance, then builds a generator that plants one firing in the kind-appropriate shape.
- Parameters:
prefix (str)
- name: ClassVar[str] = 'transfer_template_firing'
- prefix: str = 'spec_example'
- scenario_for_template(template_name, *, source_account_id=None, destination_account_id=None, amount=100.0, firing_seq=1, anchor_day=datetime.date(2030, 1, 1), instance=None)[source]
Resolve template_name to a TransferTemplate + the first leg_rail’s kind; build a generator that plants one firing.
Synthetic account defaults match RailFiringFactory’s shape: deterministic per-template strings when not supplied. Picker layer threads real materialized-account identifiers post-AY.4.
Raises ValueError when the template / leg_rail isn’t declared on the L2.
- Return type:
- Parameters:
template_name (str)
source_account_id (str | None)
destination_account_id (str | None)
amount (float)
firing_seq (int)
anchor_day (date)
instance (L2Instance | None)
- class recon_gen.common.spine.transfer_template.TransferTemplateGenerator(template_name, rail_name, is_two_leg, source_account_id, destination_account_id, amount, single_leg_direction, firing_seq, anchor_day, prefix='spec_example')[source]
Bases:
objectEmit one Posted firing of an L2-declared TransferTemplate.
Rail kind branches on is_two_leg (set by the factory from the template’s first leg_rail kind):
Two-leg: debit on source + credit on destination, both carrying template_name=template_name. Net = 0 (matches the template’s expected_net).
Single-leg: one leg on source in the resolved direction, carrying template_name=template_name. Net = ±amount (the L1 SQL surfaces as ‘Imbalanced’ against expected_net = 0 — accurate for a bare single-leg cycle).
intended returns a CoverageObservation keyed on (template_name, transfer_id, firing_seq). No matching Invariant.
- Parameters:
template_name (str)
rail_name (str)
is_two_leg (bool)
source_account_id (str)
destination_account_id (str | None)
amount (float)
single_leg_direction (Literal['Debit', 'Credit'])
firing_seq (int)
anchor_day (date)
prefix (str)
- amount: float
- anchor_day: date
- property claimed_accounts: frozenset[str]
- destination_account_id: str | None
- emit(conn, *, scenario_id=None)[source]
- Return type:
None- Parameters:
conn (SyncConnection)
scenario_id (str | None)
- firing_seq: int
- property intended: CoverageObservation
- is_two_leg: bool
- prefix: str = 'spec_example'
- rail_name: str
- single_leg_direction: Literal['Debit', 'Credit']
- source_account_id: str
- template_name: str
- property transfer_id: str