Skip to content

fix(pulse): Finances tab reads 0 income/expenses off LifeOS's own shipped templates - #1779

Open
takanorinishida wants to merge 1 commit into
danielmiessler:mainfrom
takanorinishida:fix/pulse-finance-narrative-parsing
Open

fix(pulse): Finances tab reads 0 income/expenses off LifeOS's own shipped templates#1779
takanorinishida wants to merge 1 commit into
danielmiessler:mainfrom
takanorinishida:fix/pulse-finance-narrative-parsing

Conversation

@takanorinishida

Copy link
Copy Markdown

Two independent bugs in /api/life/finances, both hit by installs that follow the shipped USER/TELOS/FINANCES templates as-is (not specific to any one deployment's data):

  • parseCurrencyTable() always read the amount from column 1. LifeOS's own EXPENSES.md ships as | Category | Vendor | Amount | Frequency | Notes | — column 1 is Vendor (never numeric), column 2 is Amount. Every install using the shipped layout silently got 0 for every expense row.
  • INCOME.md ships as bulleted prose with no pipe-table at all (the code comment claiming it "leads with 'Annual Income Estimate'" doesn't match the shipped file), so parseCurrencyTable(incomeRaw) always returned [] and every install's income read as $0/¥0 — which then propagates into the Sankey, the 12-month trend, and the post-tax net.

Fix

  • parseCurrencyTable() now picks the amount column by header name ("amount", "annual", "monthly", "total", "cost", "value"), falling back to column 1 when no header matches so tables that already worked are unaffected. When a Frequency/Cadence/Period column is present, its value now annualizes a per-period amount via the existing cadenceToMonthly() instead of taking the cell at face value.
  • Per-source income bullets use inconsistent ad hoc keys ("Gross per period", "Current MRR", "Per-engagement amount", ...), too heterogeneous to sum reliably, so this doesn't attempt that. Instead a new parseCurrencyBullet() reads the one number both the shipped template and hand-written files anchor on — the "## Expected Monthly Total" section's headline bullet — only as a fallback when the table is empty.

Non-destructive

Both changes only add coverage for inputs that previously parsed to 0/[] — nothing that already extracted a nonzero number changes.

Verification

Ran both parsers against the shipped USER/TELOS/FINANCES/{INCOME,EXPENSES}.md templates (still correctly yield nothing — placeholder $X,XXX text has no digits) and against a filled-in real install: income moved from ¥0 to the correct ¥4,800,000/year, expenses correctly read ¥1,524,000/year off the Amount column instead of the Vendor column.

🤖 Generated with Claude Code

…pped templates

Two independent bugs in /api/life/finances, both hit by installs that
follow the shipped USER/TELOS/FINANCES templates as-is (not specific
to this deployment's data):

- parseCurrencyTable() always read the amount from column 1. LifeOS's
  own EXPENSES.md ships as `| Category | Vendor | Amount | Frequency |
  Notes |` — column 1 is Vendor (never numeric), column 2 is Amount.
  Every install using the shipped layout silently got 0 for every
  expense row. Now picks the amount column by header name ("amount",
  "annual", "monthly", "total", "cost", "value"), falling back to
  column 1 when no header matches so tables that already worked are
  unaffected. When a Frequency/Cadence/Period column is present, its
  value now annualizes a per-period amount via the existing
  cadenceToMonthly() instead of taking the cell at face value.

- INCOME.md ships as bulleted prose with no pipe-table at all (the
  code comment claiming it "leads with 'Annual Income Estimate'"
  doesn't match the shipped file), so parseCurrencyTable(incomeRaw)
  always returned []  and every install's income read as $0/¥0 —
  which then propagates into the Sankey, the 12-month trend, and the
  post-tax net. Per-source income bullets use inconsistent ad hoc keys
  ("Gross per period", "Current MRR", "Per-engagement amount", ...),
  too heterogeneous to sum reliably, so this doesn't attempt that.
  Instead it reads the one number both the shipped template and
  hand-written files anchor on: the "## Expected Monthly Total"
  section's headline bullet, only as a fallback when the table is
  empty.

Both changes only add coverage for inputs that previously parsed to
0/[] — nothing that already extracted a nonzero number changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVzLJHrJPj5Phmh1vaLUBV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant