Skip to content

fix(ai-export): include estimated future earnings in export tables (#553)#572

Merged
Gregable merged 2 commits into
mainfrom
worktree-fix-ai-export-future-earnings
Jul 4, 2026
Merged

fix(ai-export): include estimated future earnings in export tables (#553)#572
Gregable merged 2 commits into
mainfrom
worktree-fix-ai-export-future-earnings

Conversation

@Gregable

@Gregable Gregable commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

A user reported that estimated earnings for 2026+ were missing from the "Copy for AI assistant" .md export, even though their effect (an increased AIME) was present.

Root cause: Recipient keeps historical earnings (earningsRecords) and estimated future earnings (futureEarningsRecords) separately. The AIME is computed from both (EarningsManager concatenates them before selecting the top 35), but ai-export.ts only rendered earningsRecords. Three spots had the same omission:

  • the AIME indexed-earnings table (rows couldn't account for the printed AIME total)
  • the eligibility credits table (status line could cite future earnings the table never showed)
  • the earnings1= param for the embedded indexed-earnings chart link

Fix: a single allEarningsRecords() helper merging both collections in year order, used at all three call sites. Future records are already reindexed by EarningsManager, so index factors, credits, and top-35 flags are valid on them.

Testing

  • New regression test: recipient with 3 simulated future years must show those years in the AIME table (fails on main with expected 35 to be 38)
  • Full suite: 2046 tests pass; npm run quality clean

)

The AIME total blends historical and estimated future earnings, but the
export's AIME table, eligibility credit table, and chart-embed earnings1
param only rendered historical records — so estimated years vanished from
the .md while their effect on the AIME remained.

Claude-Session: https://claude.ai/code/session_016dAFQiMEPD7RREkLEzFVJw
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 4, 2026

Copy link
Copy Markdown

Deploying social-security-tools with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8e53b74
Status: ✅  Deploy successful!
Preview URL: https://f2773dbb.social-security-tools.pages.dev
Branch Preview URL: https://worktree-fix-ai-export-futur.social-security-tools.pages.dev

View logs

…ears

Review follow-up: assert the credit table extends into estimated years
and caps cumulative at 40, and that the chart-embed earnings1 param
carries the estimated years.

Claude-Session: https://claude.ai/code/session_016dAFQiMEPD7RREkLEzFVJw
@Gregable Gregable merged commit 32db87f into main Jul 4, 2026
5 of 6 checks passed
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