githubnext/chopinPublic

Let's compose rich plans together

Keep room for every open question to expire

A question that fit when it was asked could push the document past its
size limit when it expired, because expiry adds a status and a date to its
card. The Planner then refused every edit, even a normal one.

Reserve that room instead. Asking a question measures it, and every
question already open, as if expired. The same reserve now bounds each
later change: a Planner edit or replacement, a person's text edit, an
added option, an accepted comment's decision, and an answer that settles
one question while the rest stay open. A change that would leave too
little room is refused and the document stays as it was. Asking no longer
applies the check only to verbatim input.

Only growth is refused. A change that shrinks or keeps the document's size
is always accepted, even when the document is already inside the reserve,
so deleting or trimming text still works there. A person's text edit, a
Planner edit or replacement, an added option, an answer and an accepted
comment all share one rule for this.

Reported by Maggie Appleton in review.

The combined test now walks every reserve in one sequence: Planner edit
and replacement, added option, answer, accepted comment and a further
question, each driven to just under the limit and asserted refused. It then
sends a person's growing text edit through the room's update path, asserts
it is refused with the document unchanged and the room rebuilt, and asserts
that a shrinking edit and a fitting one are accepted. Finally every
question expires within the limit and a normal edit succeeds. Reverting
any one of the seven guards fails it. The headless Lexical client used to
drive the person's edit is shared by the room tests and this one.

Assistant-model: Claude Sonnet 5.5
Assistant-workflow: goal (run 6091839b-867c-4965-aec9-b583f62d4b1f)
Assistant-verification: fail-before/pass-after passed: the two Planner shrink tests (block edit, replacement) failed on the unfixed code with the shrinking edit refused for no room to expire, and pass with growth-only refusal while the growing edit stays refused
Assistant-verification: fail-before/pass-after passed: the combined test (now including a person's growing, shrinking and fitting text edit via Plan.submit) fails with the room.apply growth guard replaced by false and passes restored, about 5 to 6.5 s
Assistant-verification: comment test fail-before/pass-after passed: the accepted-comment test fails with only its guard replaced by false and passes restored
Assistant-verification: per-guard revert probes, 7 of 7 fail the combined test: room.apply text edit, ask, answer, addOption, comment accept, Edit.apply, Edit.replace; each verified applied with git diff and restored; the room.apply probe over human-input, room and edit tests gave 78 pass 2 fail (combined plus the dedicated room test)
Assistant-verification: bun test 1894 pass 2 skip 0 fail; bun run types passed in every package; bun run ci passed with 3 oxlint warnings, equal to the parent baseline of 3, and 0 errors
Co-authored-by: Alex Lavaee <lavaman131@github.com>
ALAlex Lavaee authored
2f68ffaPatch
Parent39ec9f3
14 files changed+884-75
StackedSplit
apps/server/src/comments/service.ts+18 −2
apps/server/src/harness/atomic/human-input.test.ts+653 −2
apps/server/src/plan/anchors.test.ts+7 −1
apps/server/src/plan/edit.test.ts+3 −1
apps/server/src/plan/edit.ts+8 −0
apps/server/src/plan/passages.test.ts+7 −1
apps/server/src/plan/room.test.ts+51 −58
apps/server/src/plan/room.ts+46 −5
apps/server/src/plan/service.ts+1 −0
apps/server/src/questions/prose-1.test.ts+7 −1
apps/server/src/questions/service-append-option.ts+11 −0
apps/server/src/questions/service-ask.ts+6 −3
apps/server/src/questions/service-submit.ts+7 −1
apps/server/src/testing/peer.ts+59 −0