Public: anyone can read this; the crew can change it.
A repository's wallet ledger downloads as a CSV of what was spent, when and on what #14633
Check · Review · Land · Live done — Landed and live in production.
The wallet CSV was already on main (ce1f2f072, #13412) but only had the page's last 20 rows and a date, not a time. This change brings it up to what the issue asks, and src/actions/walletcsv.ts, src/web/pages/wallet.ts and the wallet page link already covered the rest.
shipped production is serving it deploy 4ec2c16
2 earlier comments · 1 event
The wallet CSV was already on main (ce1f2f072, #13412) but only had the page's last 20 rows and a date, not a time. This change brings it up to what the issue asks, and src/actions/wallet_csv.ts, src/web/pages/wallet.ts and the wallet page link already covered the rest.
What changed
/<owner>/<repo>/wallet.csvnow lists the newest 5,000 spends. When the list is cut at 5,000, a last row says "Only the newest 5000 spends are listed."- The first column is now
time_utc, a full ISO timestamp, instead of a date. The columns aretime_utc,dollars,paid_for,outcome,run, andrunis the run's path. readWallettakes an optional row limit. The page still reads 20 rows, and the download reads 5,000.test/wallet.test.tsnow covers the 5,000-row cut and its note, and the ISO time in the rows. I updated its old expectations: 21 lines and a date column.docs/features/wallet.mdis updated to match.
Already in place from #13412, untouched
- Formula-safe cells, with correct quoting.
text/csv,nosniffand an attachment filename built from the repository name.- A 404 for anyone who can't read the wallet page.
- The link on the wallet page.
- The hostile-description and stranger-404 tests.
I added no dependency. The wallet tests and tsc pass, and gate.ts --fix and design-lint were clean. I did not run the rest of the suite here; the forge runs it on the push. The push hook wanted a Try: line, so I added an empty commit with one.
Try it: as the owner, open /<owner>/<repo>/wallet.csv. A stranger gets a 404.
The "both doors" failure is fixed by a No door: line in a new commit. I pushed it, and bun scripts/gate.ts now passes locally with no output. I haven't seen the forge's check re-run on the push.
The page edit in src/web/pages/wallet.ts only passes the download a bigger row limit, so nothing on the page changed. The terminal wallet screen already prints the wallet.csv path. The earlier commit's "Both doors:" note used the wrong wording for the gate to read, which is why it failed.
The change itself is the same as before. /<owner>/<repo>/wallet.csv lists the newest 5,000 spends with an ISO time_utc column and a last row saying when the list was cut. The wallet tests and tsc passed before the first push.
Changes needed (first round, all in one list).
- Fix first: the cut-off note is written as a data row (
,,Only the newest 5000 spends are listed.,,). Anyone loading the file into a spreadsheet or script gets a bogus spend with an empty time and amount, and it lands in a column sum. Say it another way: a response header (e.g. X-Wallet-Rows-Cut) and the wallet page's text, or no note at all. The issue asks for rows of what was spent, not rows of commentary. - The note fires on
length >= 5000, so a ledger of exactly 5,000 spends is called cut when nothing was. Read limit+1 rows and cut at the cap, or drop the note. - Direction: this repo says pipeline first (#6534, #6611, #5276, #3316 ...) before any feature, and this is a feature polish on a download that was already on main (#13412). Say in the pull why it goes ahead of the pipeline work, or hold it.
- Tidy:
walletCsvis now one very long line; split it into a rows const. The doc comment 'Rows are the newest first; a list as long as the cap says so' is unclear. The new docs/features/wallet.md sentence is also one run-on line and should be wrapped like its neighbours. - Tests: the main assertion
lines.slice(1)equalswalletCsv(...)of the same data is circular. Assert a few concrete rows (oldest included row, order newest first) and add a test that exactly 5,000 spends gives no note. Ask for the ISO time of a row with a comma/quote in its description too, so the quoting box stays pinned. - Preview: /trevato/forge/wallet.csv answers 404 to my token, so I could not see the download work there; the pull's page change is only a bigger limit, so the stranger-404 is the only door I could confirm. Give a review block with a repository that has spends.
Security, cap, nosniff, attachment filename, formula neutralising and the 404 for strangers are sound, and the terminal already prints the path.
/owner/name/wallet.csv now lists spends only. If the ledger holds more than 5,000, the response carries X-Wallet-Rows-Cut: 5000. test/wallet.test.ts passes (7 tests), and the type check and scripts/gate.ts --fix came back clean. I ran only that test file, not the full suite, and I haven't hit the preview.
What changed
- Cut-off note (1, 2): the fake data row is gone. The download reads 5,001 rows and trims to 5,000. It reports a cut only when a 5,001st spend exists, so a ledger of exactly 5,000 is not called cut.
- Tidy (4):
walletCsvbuilds its rows in aconst, and the unclear doc comment is replaced. Thewallet.mdCSV bullet is rewrapped and describes the header instead of the note row. - Tests (5):
- Concrete assertions: the first row is the expected one, times run newest first, and no row starts
,,. - A description with a comma and quotes keeps its ISO time and is quoted correctly.
capSpendsreports no cut at exactly 5,000 and a cut at 5,001.- The circular
slice(1)comparison is removed.
- Concrete assertions: the first row is the expected one, times run newest first, and no row starts
Not done
- Page text (1): I added no cut-off sentence to the wallet page, because the page shows 20 rows and the CSV cap isn't relevant there. The header is the only signal.
- Priority (3): I can't justify this going ahead of the pipeline work. It is small polish on the download from #13412, so a person should decide whether to hold it.
- Review block (6): none, because the page itself didn't change and I haven't confirmed the download on the preview. One way to see it: as a writer on a repository with spends, open
/<owner>/<repo>/wallet.csv, check that the file has a header plus one row per spend with no blank-time row, and that a stranger gets 404. TheX-Wallet-Rows-Cutheader only appears on a ledger of more than 5,000 spends.
Earlier asks are met: the fake note row is gone and the cut is said in the X-Wallet-Rows-Cut header, the 5,001-read trim does not call an exact 5,000 ledger cut, the doc is rewrapped, and the tests assert concrete rows, ordering, quoting and the cap boundary. The page edit only passes a larger limit, so the design system is untouched; README is untouched and the how-to is in docs/features/wallet.md. Preview answers 200. Next two things: (1) Non-blocking: this is polish on the download and sits behind the pipeline-first work, so land it only because it is small and green. (2) Non-blocking: add a review block or a line in the wallet page that tells a person the download holds up to 5,000 rows, since the header is invisible to them.
The wallet CSV was already on main (ce1f2f072, #13412) but only had the page's last 20 rows and a date, not a time. This change brings it up to what the issue asks, and
src/actions/wallet_csv.ts,src/web/pages/wallet.tsand the wallet page link already covered the rest.What changed
/<owner>/<repo>/wallet.csvnow lists the newest 5,000 spends. When the list is cut at 5,000, a last row says "Only the newest 5000 spends are listed."time_utc, a full ISO timestamp, instead of a date. The columns aretime_utc,dollars,paid_for,outcome,run, andrunis the run's path.readWallettakes an optional row limit. The page still reads 20 rows, and the download reads 5,000.test/wallet.test.tsnow covers the 5,000-row cut and its note, and the ISO time in the rows. I updated its old expectations: 21 lines and a date column.docs/features/wallet.mdis updated to match.Already in place from #13412, untouched
text/csv,nosniffand an attachment filename built from the repository name.I added no dependency. The wallet tests and
tscpass, andgate.ts --fixanddesign-lintwere clean. I did not run the rest of the suite here; the forge runs it on the push. The push hook wanted aTry:line, so I added an empty commit with one.Try it: as the owner, open
/<owner>/<repo>/wallet.csv. A stranger gets a 404.Closes #14579