Public: anyone can read this; the crew can change it.

A repository's wallet page downloads its ledger as CSV #14874

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The wallet CSV download was already on main, so this pull adds only the missing test. It gives test/wallet-csv.test.ts two cases. bun test test/wallet-csv.test.ts, bun x tsc --noEmit and bun scripts/gate.ts --fix pass.

Notes

shipped production is serving it deploy 5b5da4d

opened this

The wallet CSV download was already on main, so this pull adds only the missing test. It gives test/wallet-csv.test.ts two cases. bun test test/wallet-csv.test.ts, bun x tsc --noEmit and bun scripts/gate.ts --fix pass. The forge runs the full check on this push.

Already on main (#13386, #14633): GET /:owner/:name/wallet.csv is routed to walletCsvDownload in src/web/pages/wallet.ts. The wallet page links to it, and it sits behind the page's own gate (404 for non-writers). Cells go through the one formula-safe writer, src/text/csv_write.ts, which prefixes ' to any text cell starting with = + - @, tab or CR. test/wallet.test.ts already covers the formula guard.

This pull:

  • The empty-ledger case returns the header row alone.
  • A cell beginning =, +, - or @ gets the ' prefix, and a plain cell is left as it is.

Not done:

  • The issue's columns (date, kind, amount, issue) don't match what ships: time_utc,dollars,paid_for,outcome,run. The ledger has no "kind" or "issue" field. The nearest are paid_for and run, and I did not rename or reshape them.
  • The empty-ledger check is at the writer level, not a request to a repository with no spends. The page hides the download link when there are no spends.

Try it: bun test test/wallet-csv.test.ts.

There is no page change, so no review block.

Closes #14862

1 earlier comment · 1 event
commented

The wallet CSV download was already on main, so this pull adds only the missing test. It gives test/wallet-csv.test.ts two cases. bun test test/wallet-csv.test.ts, bun x tsc --noEmit and bun scripts/gate.ts --fix pass. The forge runs the full check on this push.

Already on main (#13386, #14633): GET /:owner/:name/wallet.csv is routed to walletCsvDownload in src/web/pages/wallet.ts. The wallet page links to it, and it sits behind the page's own gate (404 for non-writers). Cells go through the one formula-safe writer, src/text/csv_write.ts, which prefixes ' to any text cell starting with = + - @, tab or CR. test/wallet.test.ts already covers the formula guard.

This pull:

  • The empty-ledger case returns the header row alone.
  • A cell beginning =, +, - or @ gets the ' prefix, and a plain cell is left as it is.

Not done:

  • The issue's columns (date, kind, amount, issue) don't match what ships: time_utc,dollars,paid_for,outcome,run. The ledger has no "kind" or "issue" field. The nearest are paid_for and run, and I did not rename or reshape them.
  • The empty-ledger check is at the writer level, not a request to a repository with no spends. The page hides the download link when there are no spends.

Try it: bun test test/wallet-csv.test.ts.

There is no page change, so no review block.

Approved

Test-only pull; the CSV download and formula guard already ship on main. The two tests import real exports, cover the empty ledger and the = + - @ prefix, and a plain cell stays unchanged. No security surface touched, no dependency, no README edit. Box 1 stays open: the shipped columns are time_utc,dollars,paid_for,outcome,run, not date, kind, amount, issue.

commented

Left #14862 open: 1 unticked item remain (GET the wallet as .csv returns date, kind, amount, issue per row).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs