Skip to main content

Module whatif

Module whatif 

Source
Expand description

what-if sell (task #43) — §43 READ-ONLY hypothetical-sale tax planning. Opens the vault, runs the pure deterministic projection, and calls btctax_core::whatif::sell with the synthetic sale. Appends NOTHING, writes NO side-table row, calls no session.save() (the vault is byte-identical after — the whatif_never_persists KAT). Tax decision-support (consequences), NOT buy/sell advice.

Ad-hoc profile. With --filing-status + --income (+ optional --magi/--carryforward-in) the plan runs against a NON-persisted TaxProfile so a user can plan without tax-profile set; with no ad-hoc flags it falls back to the stored Session::tax_profile(year). [R0-M4] --magi defaults to --income (a floor — NEVER $0, which would silently suppress every NIIT disclosure); the caller prints the caveat when the default is used.

Structs§

AdhocProfile
A validated ad-hoc (non-persisted) profile spec built from the what-if sell flags. filing_status
HarvestOutcome
The outcome of what-if harvest: the report + whether --magi defaulted to --income.
SellOutcome
The outcome of what-if sell: the report + whether the ad-hoc --magi defaulted to --income (so the renderer/caller can print the “MAGI assumed = ordinary income” caveat).

Functions§

adhoc_profile
Build a NON-persisted TaxProfile from the ad-hoc spec (mirrors placeholder_tax_profile, but user-supplied). [R0-M4] magi_excluding_crypto defaults to income when --magi is omitted — NEVER $0 (a $0 floor would silently suppress every NIIT disclosure).
harvest
what-if harvest — READ-ONLY harvest optimizer. Resolves the profile (ad-hoc if supplied, else the stored one for the harvest year), builds the HarvestRequest, and calls the core segment-walk optimizer. No save().
map_whatif_err
Map a WhatIfError to a user-facing CliError (mirrors cmd::optimize::map_opt_err).
parse_harvest_target
Parse --target: zero-ltcg | fifteen-ltcg | gain=$X | tax=$X (X >= 0; $/commas optional).
sell
what-if sell — READ-ONLY hypothetical sale. Resolves the profile (ad-hoc if supplied, else the stored one for the sale year), builds the SellRequest, and calls the core engine. No save().