Fix four tax/CLI correctness bugs from code reviewVerified
1. Mixed FIFO lots were taxed entirely as long-term when the oldest consumed lot was long-term. fifo-sell now returns per-lot consumed chunks (acq-date, units, cost), stored on the realized record; us-longterm-gain allocates proceeds across those lots by units and counts only the >1-year slices. A 10-old + 90-new share sale now reports the LT portion (700), not the whole gain (2500). 2. Net capital losses could reduce Canadian ordinary taxable income. compute- taxes now includes only 50% of POSITIVE net capital gains: ordinary income + 0.5*max(0, cg). A loss no longer lowers tax (it carries over, unmodelled). Also clamp the US long-term-gain slice to >= 0. 3. ledger discovery had a dead fallback: the hard-coded Homebrew path made the bare "ledger" fallback unreachable and broke non-Homebrew installs. Now: the resolved `command -v ledger' path if found, else bare "ledger" for run-program to resolve on PATH at exec time. 4. `chirp plan --years` default (15) disagreed with its help text (25); both are now 30, matching optimize-plan's default. Adds mixed-fifo-holding-period and capital-loss-not-ordinary regression tests. 114 checks pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By:
Claude Opus 4.8 (1M context) <noreply@anthropic.com>