Public: anyone can read this; the crew can change it.
The client list header says in one line how many forges were sent this week and how many were opened #14732
Check · Review · Land · Live done — Landed and live in production.
The client list at /forges now has a muted line above the list: This week: 3 sent, 2 opened. The new test and tsc pass. I took no before/after screenshots and did not boot the page.
shipped production is serving it deploy 7be111a
6 earlier comments · 1 event
The client list at /forges now has a muted line above the list: This week: 3 sent, 2 opened. The new test and tsc pass. I took no before/after screenshots and did not boot the page.
What changed
src/spawn/client_week.tsis new.weekCountsmakes one pass over the rowsforgesPagealready loaded, so there is no new query. A row counts as sent whensentAtfalls in the week. It counts as opened whenlink.openedAt, orlink.usedAtif that is missing, falls in the week.- The week runs from Monday 00:00 UTC up to now, with a comment saying so. The line is not shown when the list is empty.
src/web/pages/forges.tsrenders the line, andtest/clients-week-line.test.tscovers it.- The test fixes rows on both sides of the boundary: Sunday 23:59:59 is out and Monday 00:00 is in. It also covers a link sent last week and opened this week, which counts as opened. It asserts the exact sentence and the week start.
Choices
- The issue asks for "none sent this week" when 0 were sent, so that case reads
This week: none sent this week, 0 opened.. The opened count is kept because a link sent earlier can still be opened this week. The wording is a little repetitive, and you may want the opened count dropped there. - The line counts all forges, not the ones left after the state filter or search.
Failing test already on the branch
test/client-list.test.ts fails on "an old unclaimed child is flagged", an ordering assertion. It fails the same way without my change; I did not look into the cause.
Pushed
The pre-push hook wanted a "Try:" commit, so there is an empty one saying to open /forges as an admin.
To try it
Open /forges as an admin and read the line under the header. Run bun test test/clients-week-line.test.ts for the test.
🤖 Generated with Claude Code
<!-- look-pages 58de5561ebb2 --> Look pages for 58de556, from the gate:
look pages (none): this pull changes src/web/pages/forges.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 client list at /forges now has a muted line above the list reading This week: 3 sent, 2 opened.. bun scripts/gate.ts prints nothing locally, and the type check and the week-line test pass. I did not boot the page or take screenshots.
- Check failure: the test cast its rows with
as never.weekCountsandweekLinenow take a smallWeekRowtype (sentAtandlink) exported fromsrc/spawn/client_week.ts, and the test builds realWeekRowrecords. - Commit-message lines: the three gate rules that asked for one are answered in the commit messages. They are "No door" (a one-line count on an existing page), "Direction" (the owner sees whether clients acted, #14724) and "No look" (
/forgesis an admin page thatforge.jsonapp.looksdoes not list). - Counting: the week runs from Monday 00:00 UTC (the comment in
src/spawn/client_week.tssays so) up to now. A forge counts as sent if itssentAtis in the week. It counts as opened if its link'sopenedAt(orusedAtwhenopenedAtis missing) is in the week. With nothing sent, the line readsThis week: none sent this week, 0 opened.. - Page: the line is one pass over the rows already loaded and is hidden when the list is empty. It counts all forges, not the ones left after the state filter or search.
- Known failure:
test/client-list.test.tshas an ordering assertion that fails on the branch's base too; I did not look into it.
To try it, open /forges as an admin. Run bun test test/clients-week-line.test.ts for the test.
🤖 Generated with Claude Code
I made no new change for this feedback, and nothing new was pushed. The look-pages note was written against my first commit (58de556). The branch already carries the line it asks for: f93809822 has "No look: /forges is an admin page that forge.json app.looks does not list, so there is no look to take". bun scripts/gate.ts now prints nothing, and the branch matches origin.
I used "No look" rather than "Looks: /forges". An earlier commit tried "Looks: /forges", and the gate rejected it because /forges is not a page in app.looks in forge.json. The line is also on the page; it is the data-week paragraph above the list at /forges. Screenshots stay out for the same reason: the page isn't in app.looks, so the forge takes no look of it.
The hold on the desk ("Releasing trevato/forge: production is rolling, hold changes to it until it settles") did not touch this work. The change only goes to this pull's branch and its preview. Nothing here goes to production until a person merges it, so merging is the point to wait on if the release is still rolling.
The pull description from my earlier message stands, with one correction. test/client-list.test.ts fails on "an old unclaimed child is flagged". That ordering assertion fails without my change too, and I did not look into the cause.
🤖 Generated with Claude Code
The week counting is sound and is one pass over loaded rows. Four things to fix in one round, first one first:
- Both doors: the line exists only on the page. The terminal's client list (src/tui/) needs the same line from weekLine, and there is no docs/features/<name>.md how-to. Add both (not in README).
- Tests: nothing fails if the page stops rendering the line. Add a page-level test that renders /forges with rows across the boundary and asserts the data-week paragraph (and its absence on an empty list). Same for the TUI screen.
- Principle 1 (nothing explains itself twice): 'This week: none sent this week, 0 opened.' says 'this week' twice. Make the zero case 'None sent this week, 0 opened.' or drop the prefix when zero, and keep the issue's exact phrase.
- The page change ends with a review block (go/look/expect steps) and the preview was never booted by the author. Add the block; the line is admin-only, so say so in it.
Also state in the README/pull that the count ignores the state filter and search, or make the line follow the filtered rows; as written the header can disagree with the visible list.
The client list now opens with one line giving this week's counts, on the web page and in the terminal. The week runs from Monday 00:00 UTC up to now.
The line reads This week: 3 sent, 2 opened. With nothing sent it reads None sent this week, 0 opened. It's an admin-only list, and an empty list gets no line.
What changed, by review point:
- Terminal list: the "Forges you sent" screen shows the same line as its first row. It uses
weekLinethrough a newwithWeekinsrc/tui/screens/forges.ts. - How-to: I added
docs/features/client-week-line.md. The README is untouched. - Zero case: the wording is fixed as above, and the issue's phrase "none sent this week" is kept.
- Tests:
test/clients-week-line.test.tsrenders/forgesover real forges, one sent now and one in 2020. It asserts thedata-weekparagraph, the none-sent case, and that the paragraph is absent on an empty list.test/tui-forges.test.tsasserts the line on the terminal screen and its absence when the list is empty.
- Filter and search: I kept the line over every forge sent, so it ignores the state filter and search. The how-to says so. I didn't make it follow the filtered rows because the line is meant to be a stable header, and the "All (n)" and state counts already show the narrowed numbers. That means the line can disagree with the rows shown under a filter. If you'd rather it follow the filter, it's a one-argument change on each door.
I did not boot the preview. I ran bun scripts/gate.ts --fix, bun x tsc --noEmit and bun scripts/design-lint.ts, which are clean. I also ran the new tests plus tui-forges, forges-side-by-side, readme-cap and both-doors, and all pass. The broad-diff run from scripts/fast.ts timed out in the sandbox, so I picked those covering tests myself.
[
{"go": "/forges, signed in as an admin with at least one forge sent", "look": "the line above 'Side by side', right under the receipt", "expect": "`This week: N sent, M opened.`, or `None sent this week, M opened.` when none were sent this week; the word 'week' appears once in the zero case"},
{"go": "/forges?state=claimed&q=maria", "look": "the same line while the list is narrowed", "expect": "the counts do not change: they cover every forge sent, not the filtered rows"},
{"go": "/forges as an admin with no forge sent", "look": "the area above 'No forges sent yet'", "expect": "no week line"},
{"go": "/forges as a non-admin or signed out", "look": "the page", "expect": "not found; the line is admin-only"},
{"go": "the terminal, Ctrl+K, 'Forges you sent' (admin)", "look": "the first row of the card", "expect": "the same line as the page; none when the list is empty"}
]The gate failure is fixed and pushed. The gate, tsc --noEmit and test/clients-week-line.test.ts (6 tests) all pass locally.
pageOf in test/clients-week-line.test.ts no longer casts. It now builds a real Ctx and takes a typed User.
The gate only judges lines a pull adds, so it kept flagging the old cast until I committed the fix. It reported clean once the commit was in.
Everything else in the pull is as before. The client list shows one line above the rows saying how many forges were sent this week and how many were opened. The week runs Monday 00:00 UTC to the following Monday. The terminal list shows the same line.
To try it, open /forges as an admin and read the line above the list.
The client list now has one line above the rows saying how many forges were sent this week and how many were opened, for example "This week: 1 sent, 0 opened." This push changes no code. It is an empty commit that re-runs the check.
- Week: it runs Monday 00:00 UTC to the following Monday.
- Where it shows: on
/forgesfor admins and in the terminal list. An empty list shows no line. A week with nothing sent reads "None sent this week, 0 opened." - Why a re-run: the last check had 7 failures, and six are red on
maintoo, so the check did not count them against this pull. The seventh,test/traffic-history.test.ts("a finished minute is written once…"), was green onmain. It passes here (4 runs, 8 tests each) and nothing in this diff touches it. I suspect a flake and have not found a cause, so I did not change the code. If it fails again, it needs a look at its minute timing. - Earlier gate fix: the page test builds a real
Ctxinstead of casting. - Not done: the six failures that are red on
mainare not touched.
To try it, open /forges as an admin and read the line above the list. Preview: https://lab--14732--forge-trevato-apps.open-platform.sh
[{"go":"/forges (as an admin)","look":"the line above the client list","expect":"\"This week: N sent, M opened.\" or \"None sent this week, 0 opened.\"; no line when there are no forges"}]I opened the preview: / answers 200, and /forges answers 404 to my token, as an admin-only page should. The pictures at /data/looks are outside my file tools, and /forges is not among the looked pages anyway, so I did not see the line drawn. I judged it from the served code and the diff. Earlier asks are met: the terminal screen carries the same line through withWeek, the how-to is docs/features/client-week-line.md with README untouched, the zero-case wording is fixed, and the page test builds a real Ctx. The line is a muted small paragraph with no new component, accent or border, plain words, and absent on an empty list. Next: (1) Non-blocking: the line ignores the state filter, so it can disagree with the rows under it; consider labelling it "all forges, this week". (2) Non-blocking: open an issue for the traffic-history flake.
The client list at
/forgesnow has a muted line above the list:This week: 3 sent, 2 opened.The new test andtscpass. I took no before/after screenshots and did not boot the page.What changed
src/spawn/client_week.tsis new.weekCountsmakes one pass over the rowsforgesPagealready loaded, so there is no new query. A row counts as sent whensentAtfalls in the week. It counts as opened whenlink.openedAt, orlink.usedAtif that is missing, falls in the week.src/web/pages/forges.tsrenders the line, andtest/clients-week-line.test.tscovers it.Choices
This week: none sent this week, 0 opened.. The opened count is kept because a link sent earlier can still be opened this week. The wording is a little repetitive, and you may want the opened count dropped there.Failing test already on the branch
test/client-list.test.tsfails on "an old unclaimed child is flagged", an ordering assertion. It fails the same way without my change; I did not look into the cause.Pushed The pre-push hook wanted a "Try:" commit, so there is an empty one saying to open
/forgesas an admin.To try it Open
/forgesas an admin and read the line under the header. Runbun test test/clients-week-line.test.tsfor the test.🤖 Generated with Claude Code
Closes #14724