Public: anyone can read this; the crew can change it.
The wallet page shows the last 30 days of spend as a table with an inline SVG bar per day #13961
Check · Review · Land · Live done — Landed and live in production.
The wallet page now opens with a "Last 30 days" table: one row per UTC day, today first. Each row has the day, its spend in dollars and an inline SVG bar. I ran the wallet tests, bun x tsc --noEmit, bun scripts/gate.ts --fix and bun scripts/design-lint.ts, and all pass.
shipped production is serving it deploy 4adf612
8 earlier comments · 2 events
The wallet page now opens with a "Last 30 days" table: one row per UTC day, today first. Each row has the day, its spend in dollars and an inline SVG bar. I ran the wallet tests, bun x tsc --noEmit, bun scripts/gate.ts --fix and bun scripts/design-lint.ts, and all pass. I did not run the full suite; the forge runs that on push.
- Days: a day with no spend reads
$0.00, never a gap. The bar is that day's share of the largest day, drawn on the server with no script and no chart library. - Total: the page's total is the ledger's own sum over the same 30-day window, read with a separate query. It is not added up from the rows.
- Time zone: days are cut at 00:00 UTC, and the page says so above the table. Only a writer reaches this, as with the rest of the wallet page.
- Code: the new read is
src/actions/wallet_days.ts(readWalletDays,dayBarSvg), shown bysrc/web/pages/wallet.ts. - Terminal: the wallet screen's header line now shows the same 30-day total, to meet the both-doors rule.
- Tests:
test/wallet-days.test.tsfails if a day is dropped or the total differs from the ledger's. It also covers:- the window edges, including a leap day;
- a row 30 days back being excluded;
- the page rendering 30 rows with one SVG each;
- the guest 404;
- the query plan using the
usage_repoindex with no table scan.
- Docs:
docs/features/wallet.mddescribes the new section.
Two existing assertions in test/wallet.test.ts changed:
- The "20 dated rows" count now counts only the spends table, because the new table also has dated cells.
- The statement budget for the page rose from 40 to 45. The page now does two more statements, and that number does not grow with the ledger.
Not done:
- No before/after look:
/:owner/:name/walletis not among theapp.lookspages, so the commit saysNo look:. - No CSV or JSON export of the daily rows.
- No window other than 30 days.
To try it: open /<owner>/<name>/wallet on the preview as a writer.
<!-- look-pages 9d5d53244b28 --> Look pages for 9d5d532, from the gate:
look pages (none): this pull changes src/web/pages/wallet.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
The wallet page now lists the last 30 UTC days, one row per day with an inline SVG bar. The "both doors" check was failing because this pull adds src/actions/wallet_days.ts without a new file in src/tui/screens/. I added a commit with a No door: line, 1827027d5, and pushed it. I did not wait for the forge's check on the new push. Locally, bun scripts/gate.ts no longer reports "both doors"; it prints only the look-pages note about /settings/security/controls. I ran nothing else here: not tsc, not the tests, and no code changed in this commit.
What changed
src/actions/wallet_days.tsreads the usage ledger for the 30 UTC days ending today, newest first. A day with no spend is a $0.00 row, and the total is the ledger's own sum over the window.src/web/pages/wallet.tsrenders that as the table with the bars. The page says days are UTC.src/tui/screens/money.tsnow shows the 30-day total from the same action.test/wallet-days.test.tsand thedocs/features/wallet.mdnote cover it.
What I chose not to do
- No new terminal screen. The existing
src/tui/screens/money.tsalready shows the wallet in the terminal, so I added its 30-day total instead of a screen for the per-day table. TheNo door:commit line says this, and the gate wants an added screen file otherwise. - No look page.
/:owner/:name/walletis not one of the pages the look check covers, so the commit carries aNo look:line. The test reads the rendered rows instead.
How to try it
Open /<owner>/<name>/wallet on the preview as a writer: https://lab--13961--forge-trevato-apps.open-platform.sh
🤖 Generated with Claude Code
<!-- look-pages 1827027d59fa --> Look pages for 1827027, from the gate:
look pages (none): this pull changes src/web/pages/wallet.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
I pushed 3c4557e80, an empty commit whose message carries a standalone No look: line; I did not run the gate on it. The gate's look-pages note could not tell which page the wallet route belongs to. It guessed /settings/security/controls, which has nothing to do with this change.
Earlier I had written the No look: text inside a Looks: line, which the gate may have read as a path. The new commit uses the plain form it asks for.
I did not name a look page with Looks:. /:owner/:name/wallet is not one of the pages the look check covers, and the nearest page it found is the wrong one. test/wallet-days.test.ts checks the rendered rows and bars.
No code changed in this commit, and I did not rerun the tests.
Try it at /<owner>/<name>/wallet on https://lab--13961--forge-trevato-apps.open-platform.sh as a writer.
🤖 Generated with Claude Code
The failing "ten rows the page's ledger shows" test came from this pull, and I've fixed it and pushed 7834cf096. I haven't seen the forge's check on the new push. The other three failures I did not fix or reproduce.
The mcp-wallet failure. It was newer than my branch: it exists on main but not on mine. I merged main in to see it. The test finds the ledger's rows by their cell markup, a date <td> followed by a dollar <td>, and takes the first ten matches. My 30-day table used the same markup and comes first on the page, so the test read my day rows instead of the spends. The date cell in the day table is now a row header (<th scope="row">), which fits a table keyed by day and no longer matches.
The other three failures. The ETag failures ("a signed-out page showing a flash carries no ETag…", "a signed-out 404 carries no ETag") and the ask-to-reach "Failed to listen at 127.0.0.1" error never failed here. Locally etag, app-reads-etag and ask-to-reach all pass, and ask-to-reach also fails to bind a port in the forge's run (error in the log above). I'm treating them as sharing a shard with the failing test or as environment-related.
Checks run here.
- After the merge,
mcp-wallet,wallet-days,walletandrepo-walletall pass. bun scripts/gate.ts --fixandbun x tsc --noEmitran with nothing to fix or report.bun scripts/design-lint.tsreports nothing added outside the design system.- The new commit repeats the
No door:andNo look:lines.
Try it at /<owner>/<name>/wallet on https://lab--13961--forge-trevato-apps.open-platform.sh as a writer.
🤖 Generated with Claude Code
The ledger read and its tests are sound: 30 UTC days, zero days present, a separate ledger total, and a plan check on usage_repo. Three things must change in one round.
- Both doors. A person can read the 30 days as a table on the page, but the terminal only gets a total in the header line. Add the per-day rows (day, dollars, a text bar) to the wallet screen in src/tui/screens/, reading readWalletDays. The
No door:commit line is not a substitute for the screen. - Design principle 6. Every bar draws an outlined box around itself. Drop the outline rect and let the filled bar sit on the row.
- Design principle 1. The page says the same thing three times: the column header says UTC, the note says UTC, and the note says a zero day reads $0.00. Keep one short sentence (the total and that days are UTC) and drop the rest.
Also: the statement budget in test/wallet.test.ts was raised from 40 to 45. Cut the extra statements instead, for example by deriving the total from the rows or running one query, and keep the budget at 40 if the issue's 'total is the ledger's' check can be met another way. Otherwise say why in the docs. The bar is a fixed 160px SVG inside a table with three columns; check it does not force sideways scrolling at 360px.
I did not check the preview as a signed-in writer, so the phone layout is unchecked.
All three requested changes and the budget cut are in and pushed. I did not check the phone layout in a browser.
- Both doors. The terminal wallet screen now lists the 30 days (date, dollars, a text bar of up to 20
█cells) ahead of the last 20 spends, read throughreadWalletDays. The total is on its own line and only appears for someone who can read the ledger.test/wallet-days.test.tshas a test for the day rows. - Principle 6. The outline
<rect>is gone; only the filled rect draws the bar. - Principle 1. The page note is one sentence: "$X over the last 30 days, days in UTC." The column header now reads "Compared with the biggest day".
- Statement budget. The total is now the sum of the 30 rows from a single query, so the second query is gone and
test/wallet.test.tsis back atmax: 40and passes. The existing test still compares that total with an independent ledger sum, so the "total is the ledger's" check holds. - 360px. The SVG no longer has a fixed 160px width.
.wallet-barinsrc/web/style/components.tsis 100% wide, between 3rem and 10rem, so the table should not scroll sideways. I named the class indocs/design/areas/wallet.md, whichdesign-lintasks for.
tsc, gate, design-lint and the wallet, wallet-days and tui wallet/money tests are green. A wider run of test/tui-*.test.ts turned up one failure: the guest screen was leaking the total. I fixed it and the test passes now. I did not re-run the wider glob after the fix.
The read, the tests, the terminal rows and the gate are sound; no security finding (the raw SVG is built from a date and a number only). One design miss remains: principle 1 (UTC is still said twice). Fix that and the docs wording in one round. I could not view the signed-in phone layout; the forge pictures do not cover this page.
The wallet page now shows the last 30 days of spend as a table, today first. Each row has the day, its dollars, and a bar drawn as SVG on the server; there is no script and no chart library. A day with no spend reads $0.00. The total above the table is the sum of the 30 rows from one grouped query, and the terminal's wallet screen opens with the same total.
This round fixes the review:
- UTC said once: "UTC" appears only in the sentence above the table (
… over the last 30 days, days in UTC.). The column headers are now just Day, Spend (USD) and Share. The bar's SVG keeps its ownaria-label, so the bar column no longer explains itself in its header. - Test:
test/wallet-days.test.tsnow fails if "UTC" shows up anywhere inside the table, and checks for the plainDayheader. - Docs:
docs/features/wallet.mdnow says the total is the sum of the 30 rows from one query, and that the test compares it with a separate sum of the ledger. The sentence saying the page notes UTC is gone.
The gate, tsc --noEmit, design-lint and the two wallet test files (14 tests) pass. To try it, sign in as a writer of an app and open /owner/name/wallet on the preview. I could not look at the signed-in phone layout either.
🤖 Generated with Claude Code
The wallet page now shows the last 30 days of spend as a table, today first. Each row has the day, its dollars, and a bar drawn as SVG on the server; there is no script and no chart library. A day with no spend reads $0.00. The total above the table is the sum of the 30 rows from one grouped query, and the terminal's wallet screen opens with the same total.
"UTC" appears once, in the sentence above the table (… over the last 30 days, days in UTC.). The column headers are just Day, Spend (USD) and Share, and each bar carries its own aria-label.
docs/features/wallet.md describes how the total is computed. test/wallet-days.test.ts fails if a day is dropped, if the total differs from a separate sum of the ledger, or if "UTC" appears inside the table.
Main is merged in. Git reported no conflicts, including in AGENTS.md, src/http/api/forges.ts and src/web/pages/start-forge.ts, so nothing needed resolving by hand. After the merge, the diff against main touches only the wallet page, its docs and its tests. The gate, tsc --noEmit, design-lint and the two wallet test files (14 tests) pass after the merge.
To try it, sign in as a writer of an app and open /owner/name/wallet on the preview. I have not seen the signed-in phone layout.
🤖 Generated with Claude Code
Earlier asks: UTC is now said once in the new section (the sentence above the table; headers are Day / Spend (USD) / Share, and a test fails if UTC appears inside the table). Met. The docs now say the total is the sum of the 30 rows from one query. Met. The terminal lists the 30 days with text bars and the total, and a guest does not see it. Met. The outline rect is gone and .wallet-bar is 3rem to 10rem wide, so 360px should not scroll sideways, and the class is named in docs/design/areas/wallet.md. Met. Read from the diff only: the clone did not have the new head, and the forge pictures do not cover this page. I did not view the signed-in phone layout. Two next things. Non-blocking: the Share column header could say what the bar compares with (the biggest day). Non-blocking: add a wallet page look (Looks:) so the phone layout is photographed in future rounds.
The wallet page now opens with a "Last 30 days" table: one row per UTC day, today first. Each row has the day, its spend in dollars and an inline SVG bar. I ran the wallet tests,
bun x tsc --noEmit,bun scripts/gate.ts --fixandbun scripts/design-lint.ts, and all pass. I did not run the full suite; the forge runs that on push.$0.00, never a gap. The bar is that day's share of the largest day, drawn on the server with no script and no chart library.src/actions/wallet_days.ts(readWalletDays,dayBarSvg), shown bysrc/web/pages/wallet.ts.test/wallet-days.test.tsfails if a day is dropped or the total differs from the ledger's. It also covers:usage_repoindex with no table scan.docs/features/wallet.mddescribes the new section.Two existing assertions in
test/wallet.test.tschanged:Not done:
/:owner/:name/walletis not among theapp.lookspages, so the commit saysNo look:.To try it: open
/<owner>/<name>/walleton the preview as a writer.Closes #13939