Skip to main content

Module eventref

Module eventref 

Source
Expand description

Parse CLI references back into core types. The primary case is the canonical EventId string the engine prints (EventId::canonical()): import|<src>|<source_ref…>, conflict|<src>|<source_ref…>|<fp>, decision|<seq>. source_ref itself may contain | (adapters mint direction-scoped refs like out|cb-send), so import rejoins parts[2..] and conflict takes the LAST part as the fingerprint.

Functions§

parse_date_arg
parse_dispose_kind
Parse a bulk-reclassify-outflow --kind argument. Accepts ONLY sell/spend; REJECTS gift and donate (and any other value) — the structural scope-lock [Q2]: GiftOut/Donate need a per-row donee and (for Donate) a qualified-appraisal FMV, so a uniform-across-many-rows bulk substitution of a market close price is semantically wrong. Those stay single-item (reclassify-outflow).
parse_event_id
parse_income_kind
parse_lot_id
<event-id-canonical>#<split-sequence>LotId.
parse_lot_pick
<lot-id>:<sat>LotPick.
parse_nonneg_usd_arg
Parse a USD amount that must be >= 0 — a cost basis, FMV, proceeds, fee, or price (UX-P4-4a). A DISTINCT helper (NOT parse_usd_arg), so the legitimately-signed flags — MAGI, --other-net-capital-gain, the ad-hoc --income/--magi — keep the unguarded parser (guard per-flag, never in the shared parser; SPEC §3.3(a) [G-I5, T-M1]). No legitimate negative exists: §1012 basis, §1016 adjustments floor at zero, §301(c)(2)-(3)/§733 excess-of-basis is gain — never negative basis. Zero stays allowed (the app’s conservative self-transfer default). This ALSO closes the --basis=-N clap =-form bypass, since the guard is on the parsed value, not clap’s --prefix detection. field names the flag in the refusal.
parse_pos_sell_arg
Parse a --sell sats amount that must be > 0 (UX-P4-4a [G2-1]): a <= 0 sell survives the pool coverage check and renders a fictional LOSS estimate. Wraps the core parse_sell_arg (no sign guard).
parse_usd_arg
Exact USD (NFR5): string → Decimal, never float.
parse_wallet_id
exchange:PROVIDER:ACCOUNT | self:LABEL.