Fixed assets carry federal tax basis beside book value; tests sweep stale temp dirs

- core: TaxBasisRule (cost IRC 1012, carryover IRC 723, personal-use conversion Treas. Reg. 1.168(i)-4(b)), TaxBasis with the contributor's adjusted basis, Asset::tax_basis and ::built_in_gain (IRC 704(c)); the register gains tax rule, contributor basis, tax basis, built-in gain, total tax basis, missing count (rules.md B-25; sources vendored in docs/spec/sources/irs-partnership-basis.md)
- store: asset.tax_basis_set journaled, replayed, projected (schema v10)
- mcp: books.set_asset_tax_basis; register_asset takes tax_basis_rule and contributor_basis, checked before anything registers (found by the spec-blind suite); list_assets and the register export (json, csv) carry tax basis; instructions say to record it for every asset
- import: the register's XLSX and PDF gain the federal tax basis table with citations
- viewer: tax basis on the Assets page, the asset page (a Tax basis card), the report, the journal, and Needs attention for assets without one
- just: check and the mutation recipes sweep this user's test book dirs older than an hour (killed runs had left 23 GB in RAM-backed /tmp)
- docs: the parties, attachments, TIN vault, completeness engine, and updates designs (docs/parties-and-attachments.md)
- tests: spec-blind tax basis suites in core, store, MCP; register PDF/XLSX and viewer tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWVo7x3UHw5kwCUaWxiejX
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-10-15 13:30:09 -06:00
1 parent 6adc7b34c7
commit ba7373bdb8
30 files changed
+3240 -93

No files matched your search

+42
View File
@@ -1459,6 +1459,7 @@ impl Ledger {
tag: None,
serial: None,
acquired_by: None,
tax: None,
},
);
Ok(id)
@@ -1656,6 +1657,47 @@ impl Ledger {
Ok(())
}
/// Record an asset's federal tax basis: the rule, and for a member's
/// contribution the member's adjusted basis. Book figures don't change.
///
/// ```text
/// GOAL: the register carries tax basis beside book value, so book and
/// tax never get confused and the CPA sees both.
/// SOURCE: docs/spec/rules.md B-25; docs/spec/sources/
/// irs-partnership-basis.md.
/// INVARIANTS:
/// 1. Cost takes no contributor basis; Carryover and
/// PersonalUseConversion require one.
/// 2. A contributor basis is non-negative, in cents at most.
/// 3. A refusal MUST leave the books unchanged.
/// SCENARIOS:
/// 1. IF the asset is unknown, or 1 or 2 fails: SHOULD refuse with
/// UnknownAsset or InvalidTaxBasis.
/// 2. IF set again: the new record replaces the old (the journal
/// keeps both).
/// ```
pub fn set_asset_tax_basis(
&mut self,
id: AssetId,
tax: assets::TaxBasis,
) -> Result<(), LedgerError> {
self.check_asset_tax_basis(id, tax)?;
self.assets.get_mut(&id).expect("checked").tax = Some(tax);
Ok(())
}
/// The validation behind [`Self::set_asset_tax_basis`].
pub fn check_asset_tax_basis(
&self,
id: AssetId,
tax: assets::TaxBasis,
) -> Result<(), LedgerError> {
if !self.assets.contains_key(&id) {
return Err(LedgerError::UnknownAsset(id));
}
tax.check().map_err(LedgerError::InvalidTaxBasis)
}
/// The asset whose current tag is `tag`, ignoring case.
pub fn asset_by_tag(&self, tag: &str) -> Option<&Asset> {
let id = self.asset_tags.get(&assets::tag_key(tag))?;