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

A repository's page says this month's spend in one quiet line, always, linked to its wallet #14582

Merged opened this

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

Merged

The repository page now shows the owner and admins a muted $N.NN this month line linked to the wallet, and nobody else sees anything. A repository with no spend shows $0.00 this month. I checked main first and found nothing that did this.

Notes

shipped production is serving it deploy 4b0992f

opened this

The repository page now shows the owner and admins a muted $N.NN this month line linked to the wallet, and nobody else sees anything. A repository with no spend shows $0.00 this month. I checked main first and found nothing that did this.

  • Cap messages stay first: capReached and lowWallet still win when they apply. The month total is read once in walletLine (src/web/pages/repo.ts). capReached and lowWallet (src/core/wallet.ts) gained an optional spentAlready argument so they don't query it again.
  • Cost: one indexed query per page view for admins. The old early exit for repositories with no cap row is gone, since the line now shows regardless.
  • Tests: the new test/repo-wallet-line.test.ts covers the plain $0.00 line, the cent-exact total, the cap message winning, and the line hidden from a signed-out visitor. The checks I ran are green: tsc, the gate, and the touched wallet tests plus web-budget.
  • Two assertions I changed: test/repo-wallet-routes.test.ts and test/wallet-low-line.test.ts both asserted that the line is absent when no cap message applies, which this issue reverses. They now assert the plain line is present and that no cap or low-balance sentence appears.
  • Not done: bun scripts/fast.ts named almost the whole suite, so I ran only the wallet and budget tests, not everything. The forge check runs the full suite on this push.
  • Pre-push hook: the repository's hook required a Try: commit, so there is an empty commit carrying one.

To try it, sign in as the owner and open any repository you own. For example, /trevato/garden shows $0.00 this month under the header. The same URL signed out shows no line.

Closes #14556

6 earlier comments
commented

The repository page now shows the owner and admins a muted $N.NN this month line linked to the wallet, and nobody else sees anything. A repository with no spend shows $0.00 this month. I checked main first and found nothing that did this.

  • Cap messages stay first: capReached and lowWallet still win when they apply. The month total is read once in walletLine (src/web/pages/repo.ts). capReached and lowWallet (src/core/wallet.ts) gained an optional spentAlready argument so they don't query it again.
  • Cost: one indexed query per page view for admins. The old early exit for repositories with no cap row is gone, since the line now shows regardless.
  • Tests: the new test/repo-wallet-line.test.ts covers the plain $0.00 line, the cent-exact total, the cap message winning, and the line hidden from a signed-out visitor. The checks I ran are green: tsc, the gate, and the touched wallet tests plus web-budget.
  • Two assertions I changed: test/repo-wallet-routes.test.ts and test/wallet-low-line.test.ts both asserted that the line is absent when no cap message applies, which this issue reverses. They now assert the plain line is present and that no cap or low-balance sentence appears.
  • Not done: bun scripts/fast.ts named almost the whole suite, so I ran only the wallet and budget tests, not everything. The forge check runs the full suite on this push.
  • Pre-push hook: the repository's hook required a Try: commit, so there is an empty commit carrying one.

To try it, sign in as the owner and open any repository you own. For example, /trevato/garden shows $0.00 this month under the header. The same URL signed out shows no line.

commented

<!-- look-pages c5c882ef47f8 --> Look pages for c5c882e, from the gate:

  • look pages (inferred): this pull changes src/web/pages/repo.ts; the forge pictures /settings/crew (src/web/pages/repo.ts), /settings/grants (src/web/pages/repo.ts), /preview-admin/sample (src/web/pages/repo.ts) and 3 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A repository's page now shows a muted "$N.NN this month" line to the owner and admins, linked to the wallet. When the monthly cap is reached or the balance is low, that sentence appears in its place. Nobody else sees the line.

The failing "both doors" rule is cleared. The terminal already shows the same total: the wallet screen (src/tui/screens/wallet.ts) opens with "Spent this month". So I added no terminal code and put a No door: line in a commit message saying so. The gate passes locally; I did not run tsc or the tests again, and the forge's check on this push is the real test.

I first added a docs/features how-to, which tripped the "pipeline first" rule, so I removed it in the next commit. I also pushed that first commit while the gate was still red. This pull therefore carried a red commit for one push.

To try it, open a repository you own, e.g. /trevato/garden, and read the line under its header.

commented

<!-- look-pages d908d4ac224a --> Look pages for d908d4a, from the gate:

  • look pages (inferred): this pull changes src/web/pages/repo.ts; the forge pictures /settings/crew (src/web/pages/repo.ts), /settings/grants (src/web/pages/repo.ts), /preview-admin/sample (src/web/pages/repo.ts) and 3 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A repository's page now shows a muted "$N.NN this month" line to its owner and admins, linked to the wallet. The line is back inside the page's SQL budget: test/page-budget.test.ts now shows 49 statements for /:owner/:name, against a budget of 49.

The cause was in my own change. When a repository had no cap, capReached and lowWallet each read the cap row again, because an undefined argument triggers their default parameter. That cost two extra statements, and the cap-and-spend read added a third.

  • Fix: walletStanding in src/core/wallet.ts reads the cap and the month's spend in one statement. The page skips capReached and lowWallet when there is no cap.
  • Checks: tsc is clean, and the page-budget and wallet-line tests pass locally. I did not re-run bun scripts/gate.ts --fix after the last edit, so I haven't confirmed the gate is clean for this push. The forge's full check runs on the push.
  • Not done: I added no terminal code, because the wallet screen (src/tui/screens/wallet.ts) already shows "Spent this month". The commit messages carry a No door: line saying so.

To try it, open a repository you own, e.g. /trevato/garden, and read the line under its header.

commented

<!-- look-pages e2d51229f81b --> Look pages for e2d5122, from the gate:

  • look pages (inferred): this pull changes src/web/pages/repo.ts; the forge pictures /settings/crew (src/web/pages/repo.ts), /settings/grants (src/web/pages/repo.ts), /preview-admin/sample (src/web/pages/repo.ts) and 3 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A repository's page now shows this month's spend in one muted line for its admins, linked to the wallet. The line is read in the same statement as the cap, and the cap is not re-read when there is none. Test coverage is in test/repo-wallet-line.test.ts.

The feedback was the gate's inferred look pages for src/web/pages/repo.ts: /settings/crew, /settings/grants, /preview-admin/sample and three more. I disagree with that list. Those pages only share an import with repo.ts, and no page in app.looks renders a repository's own page. So I added an empty commit with a No look: line saying so, which is the override AGENTS.md describes. No code changed.

bun scripts/gate.ts produced no output when I ran it, and the push went through. I did not re-run bun test or bun x tsc --noEmit this turn, since nothing changed in the code.

To try it, open a repository you own, such as /trevato/garden, and read the "$N.NN this month" line under its header.

I chose not to add a terminal door: the wallet screen (src/tui/screens/wallet.ts) already shows "Spent this month".

Approved

The owner/admin line reads "$N.NN this month" in muted small text, links to the wallet, and is a plain <a> with no JS needed. The cap and low-balance sentences still win, and others see nothing. The month total is read once, and the page budget holds. Tests cover the plain line, the cent-exact total, the cap winning, and the visitor seeing nothing. The two changed assertions were correct to change, since the issue reverses them. The terminal wallet screen already shows spend, and no README or docs were added. Next two things: (1) add a test that a non-owner admin sees the line; (2) put the dollars/money formatting in one helper, since the cap sentence uses dollars() and the plain line uses money().

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs