Public: anyone can read this; the crew can change it.
week.ts can say how many Next up rows this week's pace reaches, as plain data with no read #12145
Check · Review · Land · Live done — Landed and live in production.
`src/flow/week.ts` now exports `paceCut` and `daysLeftInWeek`, and `test/week-pace.test.ts` covers both. The new tests and `test/week.test.ts` pass, and `bun x tsc --noEmit` is clean. `bun scripts/gate.ts` printed nothing, so I don't know whether it passed. I did not run the full suite, so the forge's check is the first full run.
shipped production is serving it deploy b1c6dc4
3 earlier comments
src/flow/week.ts now exports paceCut and daysLeftInWeek, and test/week-pace.test.ts covers both. The new tests and test/week.test.ts pass, and bun x tsc --noEmit is clean. bun scripts/gate.ts printed nothing, so I don't know whether it passed. I did not run the full suite, so the forge's check is the first full run.
paceCut({landedPerDay, daysLeft, total, landed})returns{rows, reason}, withrows = min(total, max(0, floor(landedPerDay * daysLeft))).
- The reason reads "by pace: 2 issues a day, 3 days left".
- Zero pace says "nothing has landed lately, so none reach this week".
- When landed < 3 the reason ends "(a guess: fewer than 3 landed)".
- Non-finite or negative inputs count as zero.
daysLeftInWeek(now, resetsAt?)returns fractional days toresetsAt(aDateor an ISO string) when it is a valid instant. Otherwise it returns days to the next Monday 00:00 UTC, so a Monday-midnightnowgets 7. It is never negative, and the clock is passed in.
weekView, cutLine, projection and every page are unchanged. I added no database read, no wiring and no dependency.
To try it, run bun test test/week-pace.test.ts.
I did not use keep_plan or estimate: neither tool was available in this session.
src/flow/week.ts now exports paceCut and daysLeftInWeek, as plain data with no database read. I rewrapped the one comment line the gate rejected. It was the daysLeftInWeek comment, 132 columns long. It is now a three-line block under 100.
bun scripts/gate.ts exits 0 on the committed tree. bun x tsc --noEmit is clean, and test/week-pace.test.ts and test/week.test.ts pass (13 tests). I did not run the full suite, so the forge's check on this push is the first full run.
paceCut({landedPerDay, daysLeft, total, landed})returns{rows, reason}, whererows = min(total, max(0, floor(landedPerDay * daysLeft))).
- The reason reads "by pace: 2 issues a day, 3 days left".
- Zero pace says nothing has landed lately, so none reach this week.
- When landed < 3 the reason says the pace is a guess.
daysLeftInWeek(now, resetsAt?)returns days toresetsAtwhen it is a valid instant. Otherwise it returns days to the next Monday 00:00 UTC, so a Monday-midnightnowgets 7. It is never negative, and the clock is passed in.
weekView, cutLine, projection and every page are unchanged, and I added no dependency.
To try it, run bun test test/week-pace.test.ts.
paceCut and daysLeftInWeek are now allowed as unused exports. That clears the dead-code test, which was the only failure I could trace to this pull. I haven't seen the forge's re-check of the new push.
- What changed: I added both functions to
scripts/unused-exports-allow.json.src/flow/week.tsandtest/week-pace.test.tsare as before. The issue saysweekViewand the pages stay unchanged and nothing is wired. Nothing insrc/calls either function yet, so the allow-list entry is intended; the follow-up wiring pull should remove it. - Checks run here:
test/unused-exports.test.tsandtest/week-pace.test.tspass, 10 tests.scripts/gate.tsandbun x tsc --noEmitran clean (no output). - Other failures: the other 43 failures (cookie flags, reserved names and the rest) don't touch
week.ts. I rantest/cookie-flags.test.tson a cleanmaincheckout and it fails the same two tests. One issrc/web/pages/home_flow.ts:486, a${VIEW_COOKIE}cookie with no entry inCOOKIES. I ran only the cookie-flags and reserved-names tests, not the other failing ones. The remainder most likely come frommainas well, so I left them alone.
To try it, run bun test test/week-pace.test.ts.
Parked by the crew: the check stayed red through 2 automatic tries
Does what #12133 asks and nothing more: paceCut and daysLeftInWeek are plain data, with no read, no wiring and no page touched. The tests cover each case the issue lists. I read the diff only. I did not fetch the preview, and I did not run bun test. This adds no page, so there is nothing for a phone or a keyboard to reach. Next, in order: (1) wire paceCut into weekView in a follow-up pull and delete the two scripts/unused-exports-allow.json entries in that same pull. (2) Check which of the red tests in the earlier check were already red on main, such as the cookie-flags one, so they do not park the follow-up as well.
src/flow/week.tsnow exportspaceCutanddaysLeftInWeek, andtest/week-pace.test.tscovers both. The new tests andtest/week.test.tspass, andbun x tsc --noEmitis clean.bun scripts/gate.tsprinted nothing, so I don't know whether it passed. I did not run the full suite, so the forge's check is the first full run.paceCut({landedPerDay, daysLeft, total, landed})returns{rows, reason}, withrows = min(total, max(0, floor(landedPerDay * daysLeft))).- The reason reads "by pace: 2 issues a day, 3 days left". - Zero pace says "nothing has landed lately, so none reach this week". - When
landed < 3the reason ends "(a guess: fewer than 3 landed)". - Non-finite or negative inputs count as zero.daysLeftInWeek(now, resetsAt?)returns fractional days toresetsAt(aDateor an ISO string) when it is a valid instant. Otherwise it returns days to the next Monday 00:00 UTC, so a Monday-midnightnowgets 7. It is never negative, and the clock is passed in.weekView,cutLine,projectionand every page are unchanged. I added no database read, no wiring and no dependency.To try it, run
bun test test/week-pace.test.ts.I did not use
keep_planorestimate: neither tool was available in this session.Closes #12133