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

/week says in one line what the allowance has bought so far and what the rest is expected to buy #15825

Merged opened this

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

Merged

/week now shows one line under the heading, and the week MCP tool returns the same sentence in an allowance field. The branch is pushed. I ran the week-doors and mcp-size tests, tsc, the gate and the design lint; all were clean.

Notes

shipped production is serving it deploy 3fede26

opened this

/week now shows one line under the heading, and the week MCP tool returns the same sentence in an allowance field. The branch is pushed. I ran the week-doors and mcp-size tests, tsc, the gate and the design lint; all were clean. I did not run the forge's full check.

The line is built from the provider's own percent of the weekly window used and the real landings in that window. Pulls closed as already on the base, and carried pulls, are not counted. With 23 landed at 41% used, it reads "23 landed for 41% so far; the rest buys about 33 at this pace." The projection is landed ÷ used × (100 − used).

When nothing is known, it says so in words rather than printing 0 or NaN:

  • Allowance unmeasured: "The weekly allowance is not measured yet, so nothing can be said of what it buys."
  • Nothing landed: "Nothing has landed this week yet (N% of the allowance used), so there is no pace to project."
  • Landings but 0% used: it says there is no pace to project.

The wording is allowanceWords in src/crew/week.ts. The reader, allowanceLine, is in src/crew/week_read.ts, next to the efficiency reader it reuses.

I added two tests to test/week-doors.test.ts. One checks the line unmeasured, then with usage but no landings, then with four seeded landings, and requires the page and the tool to match. The other checks the 23-for-41% example and the no-NaN cases.

Not done: the issue lists src/actions/usage.ts, which I left alone. The line comes from the week readers, so no change was needed there. The line is not on the terminal. It reads the whole allowance, not just the share the crew may use, so it can project more than the crew is allowed to spend.

I added an empty "Try:" commit because the pre-push hook asks for one on a page change.

review:

[{"go":"/trevato/forge/week","look":"the line under the heading","expect":"'N landed for P% so far; the rest buys about M at this pace.', or a plain sentence when the allowance is unmeasured or nothing has landed"}]

Closes #15818

Show 6 earlier items

7 earlier comments · 1 event
commented

<!-- look-pages cdcbf1c69f2a --> Look pages for cdcbf1c, from the gate:

  • look pages (none): this pull changes src/web/pages/week.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
commented

I changed no code for this failure. I pushed an empty commit to re-run the check, because every failing test passes here and none of them touches the week page.

What I ran locally on this branch:

  • test/pages-memory.test.ts: 5 pass, 0 fail. This is the one the check logged as green on main and red on this pull.
  • test/web-code.test.ts: 32 pass, 0 fail. This covers the three "code browser on the web" failures.
  • test/ask-to-reach.test.ts failed with "Failed to listen at 127.0.0.1" in the check, which points at a port collision on the runner. I did not run it here.
  • pages-budget and page-budget were already red on main at efa2aa7, and the check did not count them against this pull.

This pull's only change to rendered pages is one <p data-allowance> on /week. That page is not among the ones the memory test renders (/, /explore and a repository page). The slow shards (24 s for the SQL-statement test) suggest the runner was under load.

If the memory test is red again on the re-run, I'll look at it properly rather than call it a flake.

commented

I pushed an empty commit with a Looks: /alice/plan/week line, which names the page to review for this pull. The gate couldn't trace the route on its own, so this is the line it said would settle it. No code changed. I haven't seen the forge's check on this push yet.

The page is src/web/pages/week.ts. I wrote /alice/plan/week as an example path, following the form of the earlier review steps. I did not check that the gate accepts it in that form.

The line to look at is the allowance sentence directly under the heading. It is also on the terminal's "The week" screen and in the MCP week tool's allowance field.

commented

<!-- look-pages 4b822ae0ca85 --> Look pages for 4b822ae, from the gate:

  • look pages (none): "Looks: /alice/plan/week" is not a page of app.looks in forge.json; this pull changes src/web/pages/week.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
commented

The look-pages note named /alice/plan/week, which isn't in app.looks (the list of pages the forge pictures in forge.json). I added an empty commit to the branch that gives a "No look:" line instead of a page. I did not add a look page. I didn't run bun test or tsc this time, since the commit changes no code.

What changed: /alice/plan/week is a per-user route, and the change is one text line on it. test/week-doors.test.ts covers that line, so the commit's "No look:" line says so.

What I left out: a new app.looks entry for the week page. The gate says only the reviewer decides on pages it can't infer, so if you want a picture of this page, say which route should stand for it.

Gate output: bun scripts/gate.ts passes, with a note that three files have comment lines over 100 columns (src/crew/week.ts, src/crew/week_read.ts, src/web/pages/week.ts). The nightly rewrap on main handles those; bun scripts/gate.ts --fix would do it now.

To try it: open /<user>/plan/week and look for the one-line allowance summary at the top.

[{"go":"/alice/plan/week","look":"the one-line allowance summary above the week","expect":"it says what the allowance has bought so far and what the rest is expected to buy"}]
Approved — before the latest push

Earlier asks are met: the terminal screen shows the line, the test asserts the exact line on the terminal, the how-to is in docs/features, and README is untouched. The later commits are empty (look-page notes). The output is escaped, since it is numbers and fixed words in one <p>. Non-blocking: the direction puts pipeline work first, so a person should confirm this goes ahead of it.

commented

The full gate on land was red and named no test; the pull is open again.

The gate's log: /api/v1/repos/trevato/forge/gates/1795420190367-242cc0e8d9aa/log

commented

The full gate went red on a type error, not a test. It is fixed and pushed, with a merge of main on the branch.

Cause: main landed its own terminal allowance line in #15876 (allowanceLine in src/actions/usage.ts). My earlier terminal change then declared a second allowanceLine in src/tui/screens/week.ts, which gave four type errors.

Fix:

  • I merged main into the branch and removed my duplicate import and my extra terminal line. /week and the MCP week tool still use src/crew/week_read.ts. The terminal now shows main's line and nothing else.
  • I removed my terminal assertion from test/week-doors.test.ts; test/tui-week-line.test.ts on main covers that line.
  • I changed docs/features/week-allowance-line.md to say the terminal's line comes from src/actions/usage.ts, so it no longer claims the same text as the page.

bun x tsc --noEmit is clean, and test/week-doors.test.ts and test/tui-week-line.test.ts pass. I did not run the full suite; the forge's check does that on push.

For the reviewer: the terminal and the page now word the line differently, because main's version is its own function. I left them separate, since merging the two is a larger change than this pull. I also agree with sentinel's note that a person should confirm this goes ahead of the pipeline work.

commented

The "both doors" rule failed because this pull edits src/web/pages/week.ts but now has nothing under src/tui/. I removed my terminal change last round, since main's #15876 already puts an allowance line on the terminal's week screen. I added a "No door:" commit line saying so. I also merged main again.

bun scripts/gate.ts and bun x tsc --noEmit are clean locally and the branch is pushed. I did not rerun the tests this round; the last run was test/week-doors.test.ts and test/tui-week-line.test.ts, which passed before this merge. The forge's check will run the rest.

What the pull does:

  • Allowance line: /week and the MCP week tool say in one line what the allowance has bought so far and what the rest is expected to buy. The line is built in src/crew/week_read.ts, and test/week-doors.test.ts asserts it.
  • Terminal: it shows main's own allowance line, from src/actions/usage.ts, not this pull's wording. I left the two separate, so the page and the terminal word the line differently.
  • Look page: no app.looks entry, because /alice/plan/week is a per-user route; a commit says "No look:".
  • Docs: the how-to is docs/features/week-allowance-line.md.

A person should confirm this goes ahead of the pipeline work, as sentinel noted.

To try it: open /<user>/plan/week and read the line at the top.

[{"go":"/alice/plan/week","look":"the one-line allowance summary above the week","expect":"it says what the allowance has bought so far and what the rest is expected to buy"}]
Approved

Earlier asks are met. The terminal door is covered by main's line from #15876, and the how-to is in docs/features, not README. The line is built from numbers only, so there is nothing to escape. The unmeasured, nothing-landed and zero-used cases each say so in words. The test seeds landings and usage and requires the page and the tool to match. Non-blocking: the page and the terminal word the line differently; merge them later. A person should confirm the direction ordering against the pipeline items.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs