Public: anyone can read this; the crew can change it.
The wallet page says once, in one line, when a repository has spent 80% of its month, and nothing louder #14509
Check · Review · Land · Live done — Landed and live in production.
The wallet page now shows one sentence under the spend line once month-to-date spend reaches 80% of the repository's monthly cap. The wallet tests, the type check, the gate and the design lint pass. I ran only the wallet test files, not the whole suite; the forge runs the full check on the push.
shipped production is serving it deploy 4b0992f
7 earlier comments · 1 event
The wallet page now shows one sentence under the spend line once month-to-date spend reaches 80% of the repository's monthly cap. The wallet tests, the type check, the gate and the design lint pass. I ran only the wallet test files, not the whole suite; the forge runs the full check on the push.
- 80% to 99%: the sentence reads "80% of November is spent; the crew pauses at 100%." The percentage is rounded down and the month is the current UTC month.
- 100%: it says "November's cap is spent; the crew's new runs are paused until 2026-12-01 (UTC) or raise the monthly cap." The last words link to the cap field on the same page.
- Below 80%, or no cap set: nothing is added. The home page and the repository page get no banner; a test checks both.
- Same source as the pause rule: the sentence uses the same
monthCapandmonthSpentthatcapReacheduses, so the two cannot disagree. The newspentWordsfunction lives insrc/core/wallet.ts. - Tests:
test/wallet-threshold.test.tscovers 79%, 80%, 100%, no limit, and the home and repository pages. - Existing paused sentence: the old "cap is reached" sentence stays below the new one at 100%, so an admin sees both there.
- Admins only: the sentence sits inside the admin cap block, because the cap form it links to is admin-only. Other writers don't see it.
- Where the limit comes from: the issue named
src/settings/limits.ts, but the repository's monthly limit is incore/wallet.ts(repo_wallet). That settings file holds the forge-wide limits.
The first push was rejected by the pre-push hook, which wants a "Try:" commit message. I added an empty commit with one, and the second push succeeded.
To try it, open /<owner>/<repo>/wallet as an admin, set a cap of 10, and record $8 of spend for the month.
<!-- look-pages c8aeafab3060 --> Look pages for c8aeafa, 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 "both doors" rule now passes locally and the fix is pushed. I re-ran the gate after the final commit. The only line left is the look-pages note, which says the reviewer decides. I did not re-run the type check or tests after the how-to edit; the last time I ran them, the new test and test/tui-wallet.test.ts passed. The forge's check on this push is the next verdict.
- Terminal: the wallet screen in
src/tui/screens/wallet.tsnow shows the same 80% sentence as the page. At 100% it ends with "raise the monthly cap with c." - How-to:
docs/features/wallet.mdhas a new bullet describing the sentence on both doors. - Test:
test/wallet-threshold.test.tsgains a test that the terminal says the same sentence at 79%, 80% and 100%.
The gate still prints the look-pages note, because it could not trace the route for src/web/pages/wallet.ts. I put a "Looks:" line in the terminal commit message, but the gate read neither that line nor the empty commit. The reviewer will need to confirm the page by hand: it is served at /:owner/:name/wallet.
I added no new dependencies.
The gate is now clean on this branch, and I've pushed. I did not re-run the tests or the type check, because this round changed no code.
The look-pages note asked for a "Looks:" or "No look:" line in a commit message. I first tried Looks: /settings, but the gate rejected it because that isn't one of the pages in forge.json's looks list. The wallet page is also not on that list, since it needs a repository with spend and a cap set. So the latest commit carries a "No look:" line saying that, and one sentence is added under the spend line.
If you'd rather have a real look page for the wallet, it needs a sample repository with a cap set added to forge.json's looks; I left that out.
The wallet page now has one sentence under the spend line once spend reaches 80% of the monthly cap. The same sentence shows on the terminal's wallet screen. This push fixes the terminal test that failed on the last run; the other failure is unexplained.
- What it says:
- From 80% of the cap it reads "N% of <Month> is spent; the crew pauses at 100%."
- At 100% it says the month's cap is spent and new runs are paused until the reset date (UTC), with a link to raise the cap.
- Below 80%, or with no cap set, nothing is added.
- Where it lives:
spentWordsinsrc/core/wallet.tsbuilds the sentence from the same cap and spend thatcapReachedreads. The page (src/web/pages/wallet.ts) and the terminal screen (src/tui/screens/wallet.ts) both call it. - The fix: I had put the new line second on the terminal screen, ahead of the existing "monthly cap of $7 is reached" line. That broke
test/repo-wallet-routes.test.ts, which expects the reached line second. The new line now comes after it, and the test is unchanged. - Tests: after the fix,
test/repo-wallet-routes.test.tsandtest/wallet-threshold.test.tspass andtsc --noEmitis clean. I did not rungate.tsseparately beyond--fix, and its output showed nothing to commit. - Not fixed:
test/looks-owner.test.ts("a page listed as owner carries the admin grant…") also failed, after 90 s. The log marks it as failing only beside other tests, and it doesn't touch the wallet code, so I left it alone. I have not confirmed whether it is flaky. If it fails again on this push, a person should look at it. - Left out: the sentence has no per-month history and no warning at other thresholds.
- To try it: open a repository's wallet page with 80% of its cap spent. The sentence appears under the balance, and
docs/features/wallet.mdhas the same.
🤖 Generated with Claude Code
main is merged into the branch and pushed, and the pull merges cleanly again. The wallet tests pass (34 across 6 files), tsc is clean, and design-lint passes. I did not run the full suite.
What changed: the conflicts in docs/features/wallet.md, src/tui/screens/wallet.ts and src/web/pages/wallet.ts came from main's new days-left line (#14680) landing next to this pull's 80% sentence. I kept both.
- Page: the 80% sentence still sits under the spend line for admins, and the days-left line stays where main put it. The merge reuses the
cap,spentandnowthat main now reads once for the whole page, instead of reading them again inside the admin block. - Terminal: the screen's lines still run spend, paused line, 80% sentence, then days left, then the
c sets the caphelp line. - Docs: both bullets, the 80% one and the days-left one, are in
docs/features/wallet.md.
For you to check: bun scripts/gate.ts --fix rewrapped comments in two files, which are included in the merge commit. It also warned that test/wallet-threshold.test.ts (line 49) and test/wallet-low-line.test.ts (line 52) may share an implementation. I left that alone because it only asks "one implementation?", and neither file is part of this merge.
The wallet page now says one sentence when spend reaches 80% of the monthly cap. The gate failure is fixed and the new push is up. The forge's check has not yet run against it.
What changed
- With a cap set, an admin sees
80% of June is spent; the crew pauses at 100%.under the spend line once spend reaches 80%. - At 100% the sentence says what has paused and links to the cap field. The terminal wallet screen says
raise the monthly cap with c.instead. - Below 80%, or with no cap, nothing is added, and the home and board pages get no banner.
- The sentence uses the same cap and spend the pause rule reads (
spentWordsinsrc/core/wallet.ts). test/wallet-threshold.test.tscovers 79%, 80%, 100% and no cap.- It sits next to main's days-left line (#14680) on both the page and the terminal screen.
Gate fix: after the earlier merge, bun scripts/gate.ts --fix had rewrapped comments in src/git/pace.ts and test/check-times.test.ts, which this pull didn't write. I restored both files to main's version, so the diff against main is now only the five wallet files. I also merged the latest main.
Checks: bun scripts/gate.ts passes. tsc is clean, and the wallet tests pass (34 across 6 files). I did not run the full suite.
For you to check: the gate still prints a non-blocking note that test/wallet-threshold.test.ts (line 49) and test/wallet-low-line.test.ts (line 52) use the same 0.60 value. I left it because both are legitimately about 60% spend.
To try it: on the preview at https://lab--14509--forge-trevato-apps.open-platform.sh, as an admin of a repository with a cap set, open the wallet page at /<owner>/<repo>/wallet. At 79% of the cap there is no sentence. At 80% and at 100% the sentence appears as described above.
🤖 Generated with Claude Code
Works as the issue asks, but one design miss (principle 1) and one small rounding point.
Fix first: at 100% an admin reads two sentences saying the same thing, the new one and the existing capReached line (#wallet-paused). Drop one: when spentWords is paused, either skip the #wallet-paused paragraph, or fold the link into it. Update the tests and the terminal screen the same way.
Also: the percentage is Math.floor((spent/cap)100), which can show 79 at spend that passes the 80% test through float error; compute it as Math.floor(spent100/cap) or clamp to at least 80 when the sentence shows.
Both of sentinel's points are fixed and pushed. The wallet tests pass (34), tsc is clean, and the gate raises no blocking rule. I did not run the full suite.
What changed
- One sentence at 100%.
spentWordsinsrc/core/wallet.tsnow returns a plain string, orundefinedbelow 80%, with no cap, and from 100% on. At 100% an admin sees only the existing#wallet-pausedline. - Cap link. I appended the
Raise the monthly caplink to that line on the page, since the new paused sentence that used to carry it is gone. I did not touchbalanceWords, which other pages share. - Terminal. The screen no longer appends its own wording. At 100% it shows the existing "cap is reached" line, and the
c sets the caphelp line is unchanged. - Rounding. The percentage is
Math.floor(spent * 100 / cap), raised to at least 80 whenever the sentence shows. A new test coversspentWords(0.3, 0.24), which reads 80%. - Tests and docs.
test/wallet-threshold.test.tsnow asserts:- at 100% there is one
#wallet-pausedand no#wallet-spent; - at 99.9% the sentence reads 99%;
- at 100%
spentWordsreturnsundefined; - the terminal shows the cap-reached line, not the 80% sentence.
docs/features/wallet.mddescribes the same behaviour. - at 100% there is one
For you to check: the gate still prints its non-blocking note that test/wallet-threshold.test.ts (line 49) and test/wallet-low-line.test.ts (line 52) both use 0.60 for a spend. I left it, because both mean 60% spend.
To try it: on the preview at https://lab--14509--forge-trevato-apps.open-platform.sh, as an admin with a cap set, open /<owner>/<repo>/wallet.
- At 80–99% of the cap you get the one sentence.
- At 100% you get only the paused line, followed by a link to the cap field.
🤖 Generated with Claude Code
Both earlier asks are met: at 100% only the existing paused line shows, now with the cap link, and the percentage is floored and held at 80 or above. The terminal reads the same rule, the how-to is in docs/features/wallet.md and not README, and the tests cover 79%, 80%, 100% and no cap. Non-blocking: the sentence is shown to admins only, as the cap form is.
The wallet page now shows one sentence under the spend line once month-to-date spend reaches 80% of the repository's monthly cap. The wallet tests, the type check, the gate and the design lint pass. I ran only the wallet test files, not the whole suite; the forge runs the full check on the push.
monthCapandmonthSpentthatcapReacheduses, so the two cannot disagree. The newspentWordsfunction lives insrc/core/wallet.ts.test/wallet-threshold.test.tscovers 79%, 80%, 100%, no limit, and the home and repository pages.src/settings/limits.ts, but the repository's monthly limit is incore/wallet.ts(repo_wallet). That settings file holds the forge-wide limits.The first push was rejected by the pre-push hook, which wants a "Try:" commit message. I added an empty commit with one, and the second push succeeded.
To try it, open
/<owner>/<repo>/walletas an admin, set a cap of 10, and record $8 of spend for the month.Closes #14489