feat: bound AI-plan work to resource-control and stop zeroing missing tokens

Record the FIN-WP-0007 split after checking resource-control: they keep
intelligence resource identity and provision-level class I metering;
session tokens stay with State Hub; work-effectiveness is a reporting
join. Missing token counts are now unknown, not zero.
This commit is contained in:
tegwick 2026-08-15 19:01:45 +02:00
parent 004c041dc0
commit 09ef7fa967
10 changed files with 326 additions and 38 deletions

View file

@ -20,6 +20,20 @@ from fin_hub.services.ledger import (
FIXTURES = Path(__file__).parent / "fixtures"
def test_ledger_import_anthropic_cost_only_does_not_require_tokens(tmp_path: Path):
ledger = tmp_path / "ledger.db"
source = tmp_path / "anthropic-cost-only.csv"
source.write_text(
"model,cost,currency,usage_date\nclaude-opus-4-20250514,20.00,USD,2026-08-01\n",
encoding="utf-8",
)
result = import_csv(source, "anthropic", ledger_path=ledger)
assert result.rows_imported == 1
rollups = monthly_summary(ledger_path=ledger)
assert rollups[0].currency == "USD"
assert rollups[0].total == pytest.approx(20.0)
def test_ledger_import_and_monthly_summary(tmp_path: Path):
ledger = tmp_path / "ledger.db"
set_opening_balance(ledger, 12000.0)