Skip to content

Export a monthly cloud cost review - #84

Merged
JetSquirrel merged 2 commits into
mainfrom
feat/monthly-report
Nov 3, 2026
Merged

JetSquirrel merged 2 commits into
mainfrom
feat/monthly-report

Conversation

@JetSquirrel

Copy link
Copy Markdown
Owner

Closes #79

Adds Export report to Overview on desktop. Pick a month and a file, and it saves one self-contained HTML file to read, print to PDF or share.

What's in the report

  • Summary: net cost, the change from last month, usage and credits.
  • What the figures leave out: a month still in progress, missing FX rates, usage rows with no amount, and an inventory that was never scanned or only partly scanned.
  • Investigation: cost by service against last month, then by region and by business line.
  • Evidence: forecast and budgets (or that they were skipped), Data Health warnings, the first Insights findings with their evidence, and each source's channel and last ingest.

src/report.rs is pure composition, and every figure comes from a query the pages already read, so there is no second calculation. It carries no credentials or raw payloads, loads nothing external, and escapes all provider text. The same data and timestamp give the same bytes.

Worth a look in review

  • No provider or account filters. The issue lists them as optional. The month-level queries behind Overview cover the whole ledger, so filtering would mean new queries or totals that stop matching the screen. Every report covers all accounts, and I'd do filters as a follow-up.
  • No on-screen preview or CSV. The picker goes straight to a file. The issue makes the CSV optional, but its guidance does describe a preview, so that part is a gap.
  • Not on the web demo. The button is hidden there because there's no save dialog. The composition compiles for wasm and nothing calls it yet.
  • A month in progress shows no percent change. Comparing three days with a whole month read as "-82.7%", so the report states both figures instead. It does not use the same-days rule the Overview headline uses.
  • Service rows gain a "Credits and other amounts" row when they don't reach the net total. The existing query drops net-negative services, so without this row the column doesn't add up.
  • Insights are judged with today's inventory, even for a past month, because the ledger keeps only the latest scan. The report gives the scan's date.
  • Merging with Freeze a billing period as an immutable month-end snapshot #82 and Reconcile invoices against the ledger #83: CHANGELOG.md conflicts with both, and src/ui/mod.rs conflicts with Reconcile invoices against the ledger #83. Both are adjacent additions, so keep both sides. exact_amount is copied unchanged from Freeze a billing period as an immutable month-end snapshot #82, so src/ui/fmt.rs merges cleanly.

Testing

Run locally on Windows against this branch:

  • cargo test: 574 passed, 2 ignored. New tests cover data gaps, credits and negative amounts, empty months, months in progress, partial scans, markup in provider text and identical output. Currency handling is covered only through formatting; the conversion itself happens in the existing queries.
  • cargo clippy --all-targets -- -D warnings and cargo fmt --check: clean.
  • cargo +nightly-2026-07-28 check --lib --target wasm32-unknown-unknown: passes. This is a type-check, not the full build-web.sh.
  • One throwaway run against real queries, not committed: demo data in in-memory databases, then load_report for a closed month, an open month and an empty month. I read all three outputs. That run found the two problems above, the table total and the misleading percent. Both fixes came after it and are covered by unit tests, but I did not repeat the run.

There is no committed test of load_report itself, because the ledger connection is global.

Not tested in a real window. Nothing here has been clicked, and I haven't seen the HTML in a browser or a print preview. Please check on desktop, using demo data:

  • Export report opens the picker on the newest ended month, and Cancel and Escape do nothing.
  • Choosing a file saves it, and the path appears beside the button.
  • The totals match Overview for the current month.
  • The file reads well in a browser and prints cleanly to PDF.
  • The button and its message fit in the Overview header at minimum window width and in 简体中文.

🤖 Generated with Claude Code

Closes #79

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JetSquirrel
JetSquirrel merged commit a74b208 into main Nov 3, 2026
4 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.

feat(report): export a monthly cloud cost review [P1]

1 participant