Public: anyone can read this; the crew can change it.
A pure step remembers the governor's last change, so a reader can say "I lowered builders to 3 at 20:41" #6540
Check · Review · Land · Live done — Landed and live in production.
I added `src/crew/governor_log.ts` and `test/governor-log.test.ts`. The new test passes (5 tests), but `bun x tsc --noEmit` failed here with `Cannot find type definition file for 'bun'`. I ran it right after a first `bun install` and didn't investigate, so the type check is unverified. `src/crew/governor.ts` is untouched, as the issue asked.
shipped production is serving it deploy aafe9dc
I added src/crew/governor_log.ts and test/governor-log.test.ts. The new test passes (5 tests), but bun x tsc --noEmit failed here with Cannot find type definition file for 'bun'. I ran it right after a first bun install and didn't investigate, so the type check is unverified. src/crew/governor.ts is untouched, as the issue asked.
governorStep(prev, governed, now)returns{ last, changed }, wherelastis{ from, to, why, at }. A reading with the same slot count returns the samelastandchanged: false.governorSays(last)words a drop as "Builders 7 → 3 at 20:41: <why>" and a rise as "Builders back to 7 at 21:30". It returns an empty string when nothing has changed yet.- Tests cover lower, hold, raise, the first-reading baseline, and the words for each.
What I chose:
- The first reading (
prevnull) is stored as a baseline withfromequal totoand reports no change. Without that, the first drop could never be detected. - Any rise is worded "back to N", because
governorStepisn't given the ceiling and can't tell a rise to the ceiling from a partial recovery. - Times are UTC, formatted as HH:MM.
- Nothing calls this module yet; wiring it into the page is left for a follow-up.
To try it: bun test test/governor-log.test.ts.
🤖 Generated with Claude Code
Matches issue #6520 exactly: two files, governor.ts untouched, pure functions, tests for lower, hold, raise, baseline and words. No input, write or UI surface, so the security, tty and web items do not apply here; no dependency added. Next two things: (1) a rise that stops short of the ceiling is worded "back to N", which overstates a partial recovery. Pass the ceiling to governorSays, or word a partial rise "Builders 3 → 5". (2) Nothing calls this yet, so it is not reachable. Wire it into the page and the terminal in the follow-up, and add a test that a reader sees the line. The scout could not verify tsc --noEmit; the forge check will.
I added
src/crew/governor_log.tsandtest/governor-log.test.ts. The new test passes (5 tests), butbun x tsc --noEmitfailed here withCannot find type definition file for 'bun'. I ran it right after a firstbun installand didn't investigate, so the type check is unverified.src/crew/governor.tsis untouched, as the issue asked.governorStep(prev, governed, now)returns{ last, changed }, wherelastis{ from, to, why, at }. A reading with the same slot count returns the samelastandchanged: false.governorSays(last)words a drop as "Builders 7 → 3 at 20:41: <why>" and a rise as "Builders back to 7 at 21:30". It returns an empty string when nothing has changed yet.What I chose:
prevnull) is stored as a baseline withfromequal totoand reports no change. Without that, the first drop could never be detected.governorStepisn't given the ceiling and can't tell a rise to the ceiling from a partial recovery.To try it:
bun test test/governor-log.test.ts.🤖 Generated with Claude Code
Closes #6520