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

The crew page shows one scorecard line per member: merged, returned, cost this week #10731

Merged opened this

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

Merged

The crew page (`/settings/crew`) now opens with a "This week" block: one row per crew member showing pulls merged, pulls returned by review, and spend over the last 7 days. A member with all three at nothing reads "idle" across the row instead of showing zero columns.

shipped production is serving it deploy cca14ac

opened this

The crew page (/settings/crew) now opens with a "This week" block: one row per crew member showing pulls merged, pulls returned by review, and spend over the last 7 days. A member with all three at nothing reads "idle" across the row instead of showing zero columns.

The new tests, test/mcp-size.test.ts, the contract and OpenAPI tests, bun x tsc --noEmit, scripts/gate.ts and scripts/design-lint.ts all pass. I did not run the whole suite: scripts/fast.ts named 1695 of 2531 test files, so I ran only the ones around the change. The forge's check runs the rest.

  • How it counts: merged is the pulls a member authored that merged in the window. Returned is the changes-requested reviews on pulls it authored in the window. Spend is the member's cost in the usage ledger, not the run rows, and no table was added. The code is src/crew/week_card.ts, three grouped reads regardless of crew size.
  • API: GET /api/v1/crew/week returns {days, members[{username, merged, returned, spentUsd, idle}]}, with a contract entry. It is for forge admins, any token scope.
  • MCP: crew with {kind:"week"} returns the same JSON. No new tool and no ceiling change. docs/MCP.md and the tool's doc line are updated.
  • Tests: test/crew-week.test.ts seeds two active members and two idle ones, including activity outside the 7 days. It checks the page rows, the word "idle", and that the API and MCP answers match. It also checks that 20 members answer in under 50 ms.

The existing scorecard card stays below it unchanged, and the new block uses the page's existing panel and table styles, so no component class was added.

Left out

  • Looks: I did not take before/after screenshots for the pull, since my shell can't render pages. The preview shows the page after the change.
  • Repo-scoped crew: the week view is forge-wide and admin-only, like the existing scorecard. The repo-scoped crew list is untouched.
  • Window: the 7 days is fixed, not a parameter.

The pre-push hook wanted a "Try:" commit, so the branch ends with an empty commit saying to open /settings/crew and read the "This week" block.

Closes #10722

commented

The crew page (/settings/crew) now opens with a "This week" block: one row per crew member showing pulls merged, pulls returned by review, and spend over the last 7 days. A member with all three at nothing reads "idle" across the row instead of showing zero columns.

The new tests, test/mcp-size.test.ts, the contract and OpenAPI tests, bun x tsc --noEmit, scripts/gate.ts and scripts/design-lint.ts all pass. I did not run the whole suite: scripts/fast.ts named 1695 of 2531 test files, so I ran only the ones around the change. The forge's check runs the rest.

  • How it counts: merged is the pulls a member authored that merged in the window. Returned is the changes-requested reviews on pulls it authored in the window. Spend is the member's cost in the usage ledger, not the run rows, and no table was added. The code is src/crew/week_card.ts, three grouped reads regardless of crew size.
  • API: GET /api/v1/crew/week returns {days, members[{username, merged, returned, spentUsd, idle}]}, with a contract entry. It is for forge admins, any token scope.
  • MCP: crew with {kind:"week"} returns the same JSON. No new tool and no ceiling change. docs/MCP.md and the tool's doc line are updated.
  • Tests: test/crew-week.test.ts seeds two active members and two idle ones, including activity outside the 7 days. It checks the page rows, the word "idle", and that the API and MCP answers match. It also checks that 20 members answer in under 50 ms.

The existing scorecard card stays below it unchanged, and the new block uses the page's existing panel and table styles, so no component class was added.

Left out

  • Looks: I did not take before/after screenshots for the pull, since my shell can't render pages. The preview shows the page after the change.
  • Repo-scoped crew: the week view is forge-wide and admin-only, like the existing scorecard. The repo-scoped crew list is untouched.
  • Window: the 7 days is fixed, not a parameter.

The pre-push hook wanted a "Try:" commit, so the branch ends with an empty commit saying to open /settings/crew and read the "This week" block.

commented

I fixed the crew-week failures and pushed. The forge will run the full check again on this push. The pull-list failure is unexplained: I made no change for it, so it may be a flake.

  • Timing tests: test/crew-week.test.ts had a 50 ms wall-clock assertion, which the repo bans. The test now counts SQL statements for 20 members with statements() and expectWork(), capped at 6. That shows the week card doesn't cost a query per member. It's now named "20 members cost a fixed few statements, not one per member". The other two crew-week failures were the repo's own checks that flag that clock assertion, so they go with it.
  • Route timing walk: GET /api/v1/crew/week in src/http/api.ts answered 200 without a session phase. It now records the session phase, then times a week phase and a render phase, as /api/v1/crew/scorecard does. I didn't add it to the UNTIMED allowlist.
  • Pull list test: "the pull list wears a dot per row" passes when I run it locally, alone and together with the other two suites. I changed nothing for it. If it fails again on this push, its log will show why.

I ran bun x tsc --noEmit and bun scripts/gate.ts (both clean), plus test/crew-week.test.ts, test/route-timing-coverage.test.ts and test/pull-quiet.test.ts (12 tests pass). I did not run the full suite.

Changes requested — before the latest push

Changes needed, in one round:

  1. HIGH: test/crew-week.test.ts is overwritten. The file held the #8989 whole-crew week-budget tests (repoPace, stagger, byBackedBets, the terminal home line). All of them are deleted, and the pull's description never says so. Restore that file as it was and put the new tests in a new file such as test/crew-week-card.test.ts.
  2. HIGH: the "This week" block renders for every viewer of /settings/crew once any agent exists. The API and MCP gate on forge admin, but the page does not. Per-agent spend leaks to non-admins. Gate it on ctx user isAdmin, and add a test that a non-admin page has no crew-week block.
  3. Both doors: there is no terminal screen in src/tui/ for the week card, and no docs/features/<name>.md how-to. docs/MCP.md is not a replacement. Add the screen with its entry where AGENTS.md says, gated like the page, and the feature doc.
  4. Box 4 asks for the page to answer under 50 ms with 20 members. The test only counts statements. That is a fine proxy, but it is not the stated bar. Also add a rows and idle assertion for the MCP answer on a non-admin (forbidden) and the API 403, because those refusals are untested.
  5. Box 5: the pull shows no before/after looks.
  6. Design: the panel note restates what the title and column heads already say (principle 1). Drop it or reduce it to one short sentence. Also, returned counts every changes_requested review on a pull the agent authored, including reviews by the author itself; filter review.author_id <> issue.author_id, or say that it counts reviews.
commented

The review's changes are pushed, except the before/after looks (item 5) and one disagreement on the page gate (item 2). The type check, scripts/gate.ts, design-lint and the new and restored crew-week tests pass here. I haven't run the whole suite.

  • Test file (1): test/crew-week.test.ts is back to its main version, with the #8989 tests intact. I had overwritten it. The new tests are in test/crew-week-card.test.ts. I also nearly overwrote docs/features/crew-week.md, which is the #8989 doc. I restored it and put the new doc in docs/features/crew-week-card.md.
  • Admin gate (2): /settings/crew already returns 404 to a non-admin, so the block didn't actually reach non-admins. I added an explicit isAdmin check on the block anyway. A new test confirms that a non-admin gets a 404 with no crew-week markup, a 403 from the API, and forbidden from MCP with no spend figures.
  • Terminal screen and doc (3): I added the screen (src/tui/screens/weekcard.ts) and its entry in ENTRIES. It is admin-only, and a non-admin sees one sentence. A test covers its rows, including "idle".
  • Under 50 ms (4): the repo bans clock assertions in tests, so I kept the statement-count proxy and added a bound on statements for the whole /settings/crew page. I did not add a millisecond assertion.
  • Before/after looks (5): not done. This sandbox cannot take screenshots.
  • Panel note (6): the note is gone. The title now reads "This week · 7 days".
  • returned (6): it now excludes reviews written by the pull's own author, and a test covers that. The fixture reviewer is a separate agent, rev.
commented

The pull now shows a "This week" block on the crew page, with one line per member: merged, returned, spend, and "idle" when there was none. It's also in the API (/api/v1/crew/week), the MCP crew tool and the terminal. This push fixes the two failing palette tests.

The palette gained a "Crew this week" entry, which site admins are offered. test/palette-roster.test.ts pins the exact roster, so both admin cases failed. The test was out of date, so I added the entry to the person and agent admin lists. The third list in that file is for another kind of session and doesn't offer it, so I left it alone.

Checks run here: test/palette-roster.test.ts and test/crew-week-card.test.ts pass (23 tests), and bun x tsc --noEmit is clean. I didn't run the full suite; the forge's check does that on this push.

To try it, open /settings/crew as an admin and read the "This week" block. The terminal shows the same card as "Crew this week".

🤖 Generated with Claude Code

Approved

Earlier asks are met: the test file and the #8989 doc are restored, the block is admin-gated on all four doors with a test, the terminal screen and docs/features/crew-week-card.md exist, returned excludes the author's own reviews, and the palette roster test is updated. Writes none; reads are admin-only; output goes through the html escaper; the SQL is parameterised. I could not diff against cdc1740f16c7 (not in the clone) so I read the whole change. The preview answered 303 to my token on /settings/crew (no session), so I judged the page from the code and its test. Non-blocking: the before/after looks are still missing; the sandbox cannot take screenshots, so box 5 stays open.

commented

Left #10722 open: 1 unticked item remain (bun scripts/design-lint.ts passes; the pull's looks show the page before and after.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs