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§
- Election
Line - One entry in the
MethodElectionstanding-order history reported byverify. - Event
Row - UX-P4-11: one row of
events list— a decidable event and its decision status. Thereffis the canonical event reference (EventId::canonical()) areconcileverb accepts verbatim. - Verify
Report - Structured FR9 outcome (so tests assert on data, not stdout, and
mainkeys the exit code).
Enums§
- Pseudo
Disclosure - 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 ofPlaceholder(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
InboundClassdecision 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. Likepseudo_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
OutflowClassdecision payload. Same screen-only rule asdescribe_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
MethodElectionstanding-order history, sorted bydecision_seqfor a stable total order; eachnotemarks in-force / voided / backdated. Shared byverify’s Standing-orders block andconfig’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/harvestwhose wallet pool cannot cover the sale. Names the AVAILABLE balance, the wallet, and the as-of date so the refusal is legible;available == 0is 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 10optimize accept): one line per persistedLotSelection(with the appended decision id to pass toreconcile voidfor revocation, and the §A.5 basis label) and one line per skipped disposal (with the gate reason). A persisted attestation is noted inline on theAttestedRecordingrows. - 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 theoptimize consultcommand. 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).deltais the sameTaxOutcomethe 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 listtable. 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 theoptimize runcommand. 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, mirroringrender_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 byrender_tax_outcomeabove. - render_
schedule_ se - P2-D Task 2 / Chunk B (Schedule SE): render the standalone §1401 SE-tax block for
yearas an informational block that does NOT feed engine B (TaxResult::total_federal_tax_attributableis UNCHANGED by SE tax). - render_
tax_ outcome - Task 9 (B.5) + Task 10 (M4): render the
TaxOutcomeforreport --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 tototal_federal_tax_attributable. - render_
verify - render_
whatif_ harvest - Render a
what-if harvestHarvestReport(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_caveatprints the ad-hoc “MAGI assumed = ordinary income” note. - render_
whatif_ sell - Render a
what-if sellSellReport(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_caveatprints 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
VoidDecisionEventhas voided (for election notes + selection counting). Shared byverifyandconfig(UX-P4-12(c)). - wallet_
label exchange:provider:account|self:label(the same grammareventref::parse_wallet_idaccepts).- 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 tosnapshot.sqliteby 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 thatWriter::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 inyear. Writes NOTHING for a year with no promoted disposal leg (disclosure_8275→None). - write_
form_ csvs - Write the year-scoped form artifacts for
yearintoout_dir.