recon_gen.common.l2.probe
Probe fetcher — BT.2’s observed-row side.
fetch_probe_rows queries <prefix>_transactions filtered to one
L2 slice (rail / template / chain parent) within an operator-selected
date window. Returns a ProbeResult with up to limit rows
ordered by posting DESC + the total matching row count so the page
can render “Showing 10 of 1,247”.
Three slice kinds:
rail — narrows on
rail_name = <name>. The most common case; every transaction carries a rail_name.transfer_template — narrows on
template_name = <name>. Only template-bundled transfers carry a non-NULL template_name; standalone rail firings have NULL there.chain — narrows on rows whose
rail_nameORtemplate_namematches the chain’s parent. Picks up parent firings on either side (parents can be either a Rail or a TransferTemplate per SPEC).
The fetcher is pure SQL — no contract evaluation, no per-cell ✓/✗
decoration. The companion evaluate_predicate helper applies a
single ColumnPredicate to a ProbeRow so the render layer can
paint each cell; both directions stay decoupled so a CLI / Triage
surface can reuse the same primitives.
Severability: imports the SQL dialect + the async pool protocol + the BT.5 contract types. No html/render dependency.
Functions
|
Apply one |
|
Fetch observed transactions matching the slice + window. |
Classes
|
Probe page payload: up to |
|
One observed transaction row. |
- class recon_gen.common.l2.probe.ProbeResult(rows, total_count)[source]
Bases:
objectProbe page payload: up to
limitrows + total matching count.rowsis ordered byposting DESCso the most recent activity is visible first (matches the operator’s mental model when debugging “did the ETL just run”).total_countis the pre-limit COUNT(*) so the page can render “Showing N of M” without a second round-trip.- Parameters:
rows (tuple[ProbeRow, ...])
total_count (int)
- total_count: int
- class recon_gen.common.l2.probe.ProbeRow(transaction_id, rail_name, template_name, account_role, amount_direction, transfer_parent_id, posting, metadata)[source]
Bases:
objectOne observed transaction row.
Columns mirror
<prefix>_transactions’s contract-relevant subset (the columns BT.5’s predicates reference).metadatais the raw JSON text — predicate evaluation does the per-key extraction.- Parameters:
transaction_id (str)
rail_name (str | None)
template_name (str | None)
account_role (str | None)
amount_direction (str)
transfer_parent_id (str | None)
posting (datetime)
metadata (str | None)
- account_role: str | None
- amount_direction: str
- metadata: str | None
- posting: datetime
- rail_name: str | None
- template_name: str | None
- transaction_id: str
- transfer_parent_id: str | None
- recon_gen.common.l2.probe.evaluate_predicate(predicate, row)[source]
Apply one
ColumnPredicateto aProbeRow.- Return type:
bool|None- Returns:
Trueif the predicate holds on the row.Falseif the predicate is contradicted.Noneif the predicate’s column has no value to evaluate against (e.g. a NULLaccount_roleon a row whose contract expects anaccount_role IN {…}membership — not a violation per se, but also not a confirmation; render with “—“).
- Parameters:
predicate (ColumnPredicate)
row (ProbeRow)
Metadata keys (
column = "metadata.<key>") are evaluated by a naive JSON-text search for the key — the same shape SPEC §F4’s SQL/JSON path expressions use. Robust enough for the probe surface; Triage (BT.4) does proper JSON_VALUE extraction via SQL.
- async recon_gen.common.l2.probe.fetch_probe_rows(pool, prefix, *, kind, name, date_from, date_to, dialect, limit=25)[source]
Fetch observed transactions matching the slice + window.
- Parameters:
pool (
AsyncConnectionPool) – AsyncConnectionPool against the demo DB.prefix (
str) – L2 instance prefix.kind (
Literal['rail','transfer_template','chain']) – Slice discriminator.name (
str) – The L2-declared identifier (rail name / template name / chain parent name).date_from (
date) – Inclusive window start (posting >= date_from 00:00).date_to (
date) – Inclusive window end (posting < date_to 23:59:59.999…). Passed asposting <= <date_to> 23:59:59to dodge timezone / sub-second-precision footguns on Oracle.dialect (
Dialect) – SQL dialect; drives column-name case folding.limit (
int) – Row cap; default 25 (the page table size).
- Return type:
- Returns:
ProbeResultwith rows ordered by posting DESC + the pre-limit total count.