Repository navigation
feat: wallet-by-wallet basis engine with Form 8949 and Schedule D output - #1
Merged
Merged
Conversation
Phase 0 of the AI tax filing plan: the computation the whole thing is downstream of. No LLM in the path, so no section 7216 disclosure surface. Encodes the rules that are easy to get wrong: - Wallet-scoped lot pools. A disposal may only consume lots in its own wallet (Rev. Proc. 2024-28 ended universal pooling). - Covered-security determination: broker wallet AND acquired on or after 2026-01-01 AND never transferred. Moving a lot out of a broker clears it, because no broker knows its basis afterwards. - Form 8949 box selection (A-F) from term, 1099 expectation and covered status; totals carried onto the matching Schedule D lines. - Long-term needs MORE than one year, not exactly one year. - Transfers preserve basis and acquisition date and are not dispositions, but a network fee paid in the asset is. - Missing basis is surfaced as a flagged zero-basis lot, never invented. Money and quantities are scaled bigints, never floats. A fully consumed lot hands over its remaining micro-dollars, so lot splits cannot create or destroy basis. Rows round to cents individually and totals sum the rounded rows, so a printed page reconciles. Tests run on node:test via native type stripping: no vitest, no esbuild, and therefore no pnpm build-script approval needed in CI. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8AUW9tvZThwikBRgqVHLg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 0 of the AI tax filing plan: the computation everything else is downstream of. Pure, deterministic, dependency-free — and with no model in the path, it carries no IRC §7216 disclosure surface.
What it encodes
UNKNOWNin the date-acquired column, plus a warning.strict: truethrows instead.Correctness
Money and quantities are scaled bigints (6 and 18 decimals), never floats. A fully consumed lot hands over every remaining micro-dollar, so lot splits cannot create or destroy basis. Rows round to cents individually and totals sum the rounded rows, so a printed page always reconciles.
37 tests, all passing, covering the holding-period boundary, wallet isolation, basis conservation across repeated partial disposals, proceeds allocation with no drift, and all six box combinations.
Toolchain note
Tests run on
node:testusing Node's native TypeScript type stripping. That drops vitest and esbuild entirely, which also sidesteps pnpm 11 refusing to run build scripts without approval —pnpm run <script>was failing onERR_PNPM_IGNORED_BUILDSbefore this change.Not included, deliberately
Wash sales (§1091 covers stock and securities), income recognition for staking/mining/airdrops, and price lookup. Each would change reported numbers on a judgment call that belongs upstream.
🤖 Generated with Claude Code
https://claude.ai/code/session_01R8AUW9tvZThwikBRgqVHLg