Skip to main content

Module render

Module render 

Source
Expand description

Text rendering of CLI outputs (FR9 verify, FR4 report/show) + FR10 CSV export. Pure string-building over engine data — the CLI displays; the engine computes (NFR4/NFR5).

Structs§

ElectionLine
One entry in the MethodElection standing-order history reported by verify.
EventRow
UX-P4-11: one row of events list — a decidable event and its decision status. The reff is the canonical event reference (EventId::canonical()) a reconcile verb accepts verbatim.
VerifyReport
Structured FR9 outcome (so tests assert on data, not stdout, and main keys the exit code).

Enums§

PseudoDisclosure
UX-P4-1: the pseudo-disclosure channel for a tax-year figure — which, if any, deliberately-synthetic input the number rides on. Carries the FULL §3.1 predicate (pseudo_active() OR PseudoPlaceholder) so a caller cannot thread a single disjunct and silently drop the other (SPEC r2-N3). The two active channels are mutually exclusive by PRECEDENCE — Synthetic (a pseudo synthetic lot/FMV; pseudo_active(), i.e. pseudo_synthetic_count > 0) is chosen ahead of Placeholder (computed on the all-$0 pseudo placeholder profile; mode on, nothing stored, count == 0) — even though the underlying states can co-occur.

Constants§

FORM_8283_AGGREGATION_CAVEAT
The standing Section A/B aggregation note — emitted as the first (comment) line of form8283.csv and reused by any text/advisory path. Reflects the §170(f)(11)(F) year-aggregate implementation: all BTC is “similar property”; the YEAR-total BTC donation deduction determines Section A/B uniformly for all rows. CCA 202302012 confirms the readily-valued exception does not apply to crypto, so a year-aggregate > $5,000 requires a qualified appraisal.

Functions§

build_verify
describe_inbound_class
UX-P4-7: SCREEN-ONLY human summary of an InboundClass decision payload (income / received gift / self-transfer). Replaces the raw {:?} Debug dump (SelfTransferMine { basis: Some(19000.00), acquired_at: Some(2026-01-01) }) that the CLI bulk-void preview + TUI void list truncated mid-field. Like pseudo_tag [R0-I4], this is for the terminal ONLY — the CSV/form writers MUST NOT call it (they emit stable machine tags via *_tag), so no human phrasing can leak into an export file.
describe_outflow_class
UX-P4-7: SCREEN-ONLY human summary of an OutflowClass decision payload. Same screen-only rule as describe_inbound_class — never called by a CSV/form writer.
fee_treatment_display
Stable display tag for LotMethod (FIFO/LIFO/HIFO — uppercase, human-readable). UX-P4-12(e): a human label for the TP8 self-transfer fee treatment, instead of the raw Debug variant name (TreatmentC/TreatmentB) leaking on screen.
filing_status_tag
Stable display tag for FilingStatus (lowercase, matches the CLI value-enum strings).
lot_method_display
method_election_lines
The MethodElection standing-order history, sorted by decision_seq for a stable total order; each note marks in-force / voided / backdated. Shared by verify’s Standing-orders block and config’s forward-method read-back (UX-P4-12(c)).
no_lots_message
UX-P4-9: the shared “insufficient balance” message for a what-if sell/harvest whose wallet pool cannot cover the sale. Names the AVAILABLE balance, the wallet, and the as-of date so the refusal is legible; available == 0 is the honest “no BTC” case (an empty wallet), distinct from mere insufficiency (lots exist but fall short). Used by BOTH the CLI (cmd::whatif::map_whatif_err) and the interactive TUI panel (btctax_tui::whatif_panel::refusal_message) so the two surfaces read identically. SCREEN-ONLY.
provenance_label
The §4.12 provenance label for the resolved profile — printed on the full-return output so a reviewer can audit which source produced the figures (p2-provenance-printing).
render_accept_outcome
Render an AcceptOutcome (Task 10 optimize accept): one line per persisted LotSelection (with the appended decision id to pass to reconcile void for revocation, and the §A.5 basis label) and one line per skipped disposal (with the gate reason). A persisted attestation is noted inline on the AttestedRecording rows.
render_advisories
Render the Phase-5 full-return advisories (SPEC §3.4 / §9.2) — the loud, non-gating notes that a favorable credit was omitted conservatively (your tax is OVERSTATED), or that a disclosure is yours to make. Never changes a number and never changes the exit code.
render_consult
Render a ConsultReport (Task 11 / §C.3 Mode-2 read-only pre-trade what-if) for the optimize consult command. Returns a String with:
render_donation_appraisal_advisory
§170(f)(11)(F) year-aggregate appraisal advisory (D2) — render-time only.
render_dual_report
Render the §6 dual report: the absolute filed-return liability (Form 1040, WITH crypto) and the crypto-attribution DELTA are different questions — shown together, labeled, and NEVER reconciled to the dollar (SPEC §6). Only produced for a ReturnInputs-provenance year (a full 1040 exists). delta is the same TaxOutcome the crypto-delta block already showed above. Provenance is printed here (§4.12). ★ The absolute block renders the PRINTED figures — the whole-dollar, cross-footing lines the filed PDF carries — not the exact-cents computation behind them (ARCH-P6 Q3).
render_events_list
UX-P4-11: render the events list table. Ref-first per row (so it is trivially copyable), then kind @ date, amount, and the bracketed decision status. Read-only display.
render_file_reports
FR1/FR2: per-source drop/unclassified counts + the append/duplicate/conflict tally.
render_gift_advisory
P2-C Task 3 (D3): Form 709 gift per-donee advisory (§2503(b) annual exclusion applied independently per donee, not in aggregate).
render_optimize_proposal
Render a OptimizeProposal (Mode-1 what-if) for the optimize run command. Returns a String containing the proposal header, any approximate banner, the aggregate tax delta, per-disposal rows (with proposed selection + compliance status + persistability), and the R0-M2 caveat footer.
render_report
FR4 render: holdings (always current) + realized disposals/removals/income (year-filtered).
render_schedule_d
P2-B Task 3: render the RAW pre-netting Schedule D part totals (Part I ST, Part II LT) for year, mirroring render_tax_outcome. These are the Form 8949/Schedule D part totals BEFORE §1222/§1211/§1212 netting + carryforward — that netting is applied in the tax computation (report --tax-year), and the netted figures are shown by render_tax_outcome above.
render_schedule_se
P2-D Task 2 / Chunk B (Schedule SE): render the standalone §1401 SE-tax block for year as an informational block that does NOT feed engine B (TaxResult::total_federal_tax_attributable is UNCHANGED by SE tax).
render_tax_outcome
Task 9 (B.5) + Task 10 (M4): render the TaxOutcome for report --tax-year <y>. Exact Decimal Display; no float (NFR5). B-M2 fold: surfaces the ordinary-rate attributable delta so the three printed attributable components visibly reconcile to total_federal_tax_attributable.
render_verify
render_whatif_harvest
Render a what-if harvest HarvestReport (task #43). Headlines the MAX BTC to sell (N*), the binding constraint, the realized ST/LT split at N*, which §1(h) bracket the surviving preferential dollars land in, the exact marginal federal tax, and the MANDATORY disclosures — the §1212(b) carryforward delta/burn, the §1411 NIIT kink (a 0%/15% answer can still cost +3.8%), and the plateau note. The answer is engine-verified. magi_caveat prints the ad-hoc “MAGI assumed = ordinary income” note.
render_whatif_sell
Render a what-if sell SellReport (task #43). Headlines the MARGINAL federal tax (the sale’s OWN effect — withhyp − baseline), then the §1(h) bracket + room, the effective rate (or n/a for a loss), the §1212 carryforward disclosure (delta-based — the this-year ordinary offset AND the amount carried, NEVER a hard-coded $3,000), and the §1411 NIIT delta with its sign. magi_caveat prints the ad-hoc-profile “MAGI assumed = ordinary income” note. Read-only; the vault is never touched.
voided_targets
The set of decision targets that a VoidDecisionEvent has voided (for election notes + selection counting). Shared by verify and config (UX-P4-12(c)).
wallet_label
exchange:provider:account | self:label (the same grammar eventref::parse_wallet_id accepts).
write_csv_exports
FR10: write the projected ledger as CSV (the NFR2 plaintext exception). One row per disposal/removal leg (flattened) + one per lot/income record. Exact values (Decimal/i64) as strings (NFR5). Each CSV is opened via fsperms::open_owner_only (0o600 on Unix) so decrypted PII matches the hardened permissions already applied to snapshot.sqlite by the store crate. The out-dir is created owner-only (0o700) if absent; when the dir PRE-EXISTS, open_owner_only still forces 0o600 on each new CSV file (the hole that Writer::from_path + umask would leave).
write_form_8275_txt
BG-D8 (Task 14): write the Form 8275 disclosure (form_8275.txt, 0o600) — by its OWN name — alongside the year’s form artifacts whenever a promoted DISPOSAL leg files in year. Writes NOTHING for a year with no promoted disposal leg (disclosure_8275None).
write_form_csvs
Write the year-scoped form artifacts for year into out_dir.