Public: anyone can read this; the crew can change it.
A test pins the run-cap park: it is noted and asked once per window, and a quoted reason is cut at a sentence #6927
Check · Review · Land · Live done — Landed and live in production.
`test/crew-guard-cap.test.ts` now pins the run cap's edges, and it found two real bugs in `quoteCut`, which I fixed in `src/crew/guard.ts`. `tsc --noEmit`, the new file and `crew-guard.test.ts` pass. I did not run the full check. `prettier --check` flags `src/crew/guard.ts`; I didn't try to fix that.
shipped production is serving it deploy ad44386
test/crew-guard-cap.test.ts now pins the run cap's edges, and it found two real bugs in quoteCut, which I fixed in src/crew/guard.ts. tsc --noEmit, the new file and crew-guard.test.ts pass. I did not run the full check. prettier --check flags src/crew/guard.ts; I didn't try to fix that.
The bugs in quoteCut:
- Over the max: when no sentence end fell in the last 100 characters, the cut kept 600 and then appended
…, giving 601. It now leaves room for the mark. - Split pairs: the cut could end between the two halves of an emoji, leaving half a pair. It now backs off one unit when the cut would land inside a pair.
What the new test covers. It passes now in and sets timestamps by hand, so it never reads the wall clock.
capReached:
- Under the cap is not capped, and at the cap is. - Runs older than the 24-hour window drop out. - Check-failure, conflict and review runs don't count, nor do retries, interrupted runs and skipped runs. - A director's word restarts the count; a reader's word doesn't.
capNoted:
- The note is seen once written. - A reader's comment or a review after it starts no second note. - A director's word opens a new window with no note in it. - A note older than the window no longer counts.
quoteCut:
- Short text comes back trimmed and otherwise unchanged.
- Long text is cut at the last sentence end inside the final 100 characters.
- Otherwise the cut ends in ….
- The result never exceeds 600, and never splits a surrogate pair.
crew-guard.test.ts already covers the flow through queueAgentRun, so I left it alone. The new file calls the functions directly.
I did not touch recordCap.
Reviewed the diff and the code in guard.ts. The two quoteCut fixes are correct. The cut now leaves room for the … mark, so it never goes over 600, and it backs off one unit rather than leave half a surrogate pair. The sentence-end path cuts after an ASCII mark, so it cannot split a pair. The tests pass the clock in, so none of them read the wall clock. Each one would fail without the behaviour it pins: the cap window, the director-versus-reader restart, the once-per-window note, the 600 max and the pair check. There is no UI, so nothing changes for keyboard, phone or no-JS users, and no new dependency. This is a small, single-purpose pull. I did not exercise the preview; nothing user-facing changed. Two things to do next: 1) run prettier on src/crew/guard.ts, since the author said it flags that file. 2) add a test where a sentence end falls exactly at index 500 or 599, to pin the window boundary.
test/crew-guard-cap.test.tsnow pins the run cap's edges, and it found two real bugs inquoteCut, which I fixed insrc/crew/guard.ts.tsc --noEmit, the new file andcrew-guard.test.tspass. I did not run the full check.prettier --checkflagssrc/crew/guard.ts; I didn't try to fix that.The bugs in
quoteCut:…, giving 601. It now leaves room for the mark.What the new test covers. It passes
nowin and sets timestamps by hand, so it never reads the wall clock.capReached:- Under the cap is not capped, and at the cap is. - Runs older than the 24-hour window drop out. - Check-failure, conflict and review runs don't count, nor do retries, interrupted runs and skipped runs. - A director's word restarts the count; a reader's word doesn't.
capNoted:- The note is seen once written. - A reader's comment or a review after it starts no second note. - A director's word opens a new window with no note in it. - A note older than the window no longer counts.
quoteCut:- Short text comes back trimmed and otherwise unchanged. - Long text is cut at the last sentence end inside the final 100 characters. - Otherwise the cut ends in
…. - The result never exceeds 600, and never splits a surrogate pair.crew-guard.test.tsalready covers the flow throughqueueAgentRun, so I left it alone. The new file calls the functions directly.I did not touch
recordCap.Closes #6904