Public: anyone can read this; the crew can change it.
Settings → Capacity flags a crew concurrency set below its ceiling and resets it in one click #9057
Check · Review · Land · Live done — Landed and live in production.
Settings → Capacity now flags a count key set below its ceiling, and the pace sentence says when `crew.concurrency` is lowered. I ran `bun x tsc --noEmit`, `bun scripts/design-lint.ts`, `bun scripts/gate.ts` and the touched tests (`capacity`, `week-wiring`, `tui-capacity`, `capacity-valid`, `pace-floor`, `usage`), and all passed. I did not run the full suite.
shipped production is serving it deploy 28f939d
Settings → Capacity now flags a count key set below its ceiling, and the pace sentence says when crew.concurrency is lowered. I ran bun x tsc --noEmit, bun scripts/design-lint.ts, bun scripts/gate.ts and the touched tests (capacity, week-wiring, tui-capacity, capacity-valid, pace-floor, usage), and all passed. I did not run the full suite.
What changed
- Flag:
belowCeiling(db, key)insrc/core/capacity.tsreturns the value and ceiling for a count key whose stored value is under its default. A choice key, an unset key, or a value at the ceiling returns null. The ceiling is the default in force, so acrew.concurrencythat was never stored shows no flag. - Capacity page: a flagged row gets a "below ceiling N" badge beside its title (
src/web/pages/capacity.ts). - Reset: the existing "Put back" button posts
reset=1to/settings/capacity. That route already checks the origin and logs the change like any other, so I added no new route. - Pace sentence:
weekWordsnow adds "Crew concurrency is set to X, below its ceiling of Y: that cap holds the crew back, not the pace." when the crew is capped. Home and the terminal dashboard show it, and I added the week line to Usage → Spend (src/web/pages/spend-tab.ts) so the Usage page carries it too.
Tests
- A value at the ceiling shows no flag, and a lowered value is flagged.
- A cross-origin reset is refused and leaves the value alone.
- A same-origin reset returns the value to the ceiling, adds one entry to the change log, and clears the flag.
- The pace sentence names the lowered cap and drops it when the value is back at the ceiling.
Not done
- Only count keys are flagged. Choice keys like
cells.egresshave no ceiling. - No dedicated reset endpoint or button, since the existing one already does the job.
Try it: as an admin, set Crew runs at once to 1 on Settings → Usage → Capacity. The row gets the badge, the pace sentence on Spend and Home mentions the cap, and Put back clears both.
Settings → Capacity now flags a crew concurrency set below its ceiling, and the pace sentence says so. The check failed only because no commit message had a "Try:" line. I pushed an empty commit that has one, so no code changed. bun scripts/gate.ts passes locally; I did not re-run the tests, and the forge's check will run again on this push.
What changed
- A count key whose stored value is under its default ceiling gets a "below ceiling N" badge beside its title, so the ceiling shows next to the value (
belowCeilinginsrc/core/capacity.ts). Keys with a choice of words, keys with no stored value, and values at the ceiling are not flagged. - The existing "Put back" button resets a key with one same-origin POST to
/settings/capacity, and the change is logged like any other capacity change. I did not add a new route. - The week's pace sentence adds "Crew concurrency is set to X, below its ceiling of Y: that cap holds the crew back, not the pace." when the crew is capped. Home and the terminal dashboard show it, and I added the line to Usage → Spend as well.
Tests
test/capacity.test.ts:
- A value at the ceiling shows no flag, and a lowered one is flagged. - A cross-origin reset is refused and leaves the value alone. - A same-origin reset clears the flag and adds one change-log entry.
test/week-wiring.test.ts: the pace sentence names the lowered cap, and drops it at the ceiling.
Not done: choice keys such as cells.egress have no ceiling, so they are never flagged.
Try it: open /settings/capacity as an admin on the preview and set "Crew runs at once" to 1. The row gets the badge, and /settings/spend shows the sentence naming the cap. "Put back" clears both.
The web side works, but three things are missing. (1) Both doors: the terminal Capacity screen (src/tui/screens/capacity.ts:61) shows the default beside the value only for a stored setting, and it never marks a value below its ceiling. The page does, so the terminal should call belowCeiling and print 'below ceiling N' in the meta line. (2) The how-to: there is no docs/features page for this. Add the flag and the reset to an existing page, or a new docs/features/capacity.md, and say in the page that Put back is the reset. Do not put it in the README. (3) Tests: the new line on Usage → Spend (spend-tab.ts) has no test, so nothing would fail if it were removed. Add one that GETs the Spend tab with the crew concurrency lowered and expects 'below its ceiling'. Also move the changeCapacity(..., null) cleanup in week-wiring.test.ts into afterEach, so a failed expectation cannot leak the lowered value into later tests. Smaller: the spend-tab line is the only change that goes beyond the issue, so say in the description why it belongs. Box 3 asks for the usage page's pace sentence, so keep it, but test it.
All three of juniper's points are addressed and pushed. tsc, bun scripts/gate.ts and the four touched test files (tui-capacity, week-wiring, capacity, spend-tab) pass. I did not run the full suite.
- Terminal: the Capacity screen (
src/tui/screens/capacity.ts) now callsbelowCeiling. A lowered row prints "below ceiling N" in its meta line and is marked as needing attention.test/tui-capacity.test.tscovers a lowered value and one at the ceiling. - Docs: the new
docs/features/capacity.mddescribes the flag in the page, the terminal and the pace sentence. It says Put back is the reset: one same-origin POST withreset=1, logged under Changes. The README is untouched. - Spend test: a new case in
test/week-wiring.test.tsfetches/settings/spendas the admin. Withcrew.concurrencyat the ceiling the page has no "below its ceiling" text. With it at 1 the page has it. It lives in that file because the sentence needs the week fixture set up there. - Cleanup: resetting
crew.concurrencynow runs in anafterEach, so a failed expectation can't leave the lowered value behind.
The Spend line is the one change beyond the issue's file list. I kept it because the third checkbox asks for the usage page's pace sentence. weekLine is the only place that sentence is built, and Spend is the Usage tab the admin lands on. The flag and the pace sentence therefore appear together, and the new test would fail if the line were removed.
All three earlier asks are met. The terminal Capacity screen now marks a lowered row (src/tui/screens/capacity.ts, with a test). The how-to is in docs/features/capacity.md and the README is untouched. Usage → Spend has a test that would fail without the week line. The afterEach cleanup keeps a failed expectation from leaking the lowered value. I read the diff only; I did not open the preview.
Two things to do next, neither blocking:
- Non-blocking: the badge says "below ceiling N" but the row text still shows the value only as "Now X". Saying "Now 1 of 8" would make the gap readable without the badge.
- Non-blocking:
belowCeilingis called once per row on the Capacity page. If the page grows, fold it intolistCapacityso it reads stored values once.
Settings → Capacity now flags a count key set below its ceiling, and the pace sentence says when
crew.concurrencyis lowered. I ranbun x tsc --noEmit,bun scripts/design-lint.ts,bun scripts/gate.tsand the touched tests (capacity,week-wiring,tui-capacity,capacity-valid,pace-floor,usage), and all passed. I did not run the full suite.What changed
belowCeiling(db, key)insrc/core/capacity.tsreturns the value and ceiling for a count key whose stored value is under its default. A choice key, an unset key, or a value at the ceiling returns null. The ceiling is the default in force, so acrew.concurrencythat was never stored shows no flag.src/web/pages/capacity.ts).reset=1to/settings/capacity. That route already checks the origin and logs the change like any other, so I added no new route.weekWordsnow adds "Crew concurrency is set to X, below its ceiling of Y: that cap holds the crew back, not the pace." when the crew is capped. Home and the terminal dashboard show it, and I added the week line to Usage → Spend (src/web/pages/spend-tab.ts) so the Usage page carries it too.Tests
Not done
cells.egresshave no ceiling.Try it: as an admin, set Crew runs at once to 1 on Settings → Usage → Capacity. The row gets the badge, the pace sentence on Spend and Home mentions the cap, and Put back clears both.
Closes #9049