refactor(web): the service keeps every plan as its text alone, and the fixed template's fields path is gone (plan as one document 10/12)

Merged
DA
7d ago
+691-2629

PR 10 of the plan as one document rollout: the first half of the contract step, server only.

Every plan and revision in production is one document now. Dean ran the backfill: the first pass carried over 34 plans and 32 revisions; the second carried nothing. So the service stops reading and writing the fixed template's fields. The columns themselves go in PR 11, once this is live.

What changes

  • Store: a plan is its text (plan.document, now decoded as non-null) plus its sections' writers.
    • Nothing reads or writes body, assumptions, fields, or field_writers any more.
    • savePlanDocument and the rename's body retitling are gone.
    • saved means the last save moved past the plan's start.
  • Write path (plan-notes.ts): one text-only locked save.
    • A field-shaped edit is refused with FIELD_EDIT (400). Only a desktop with the old field editor could send one, and no plan answers fields any more.
    • Notes keep their field shape for now: a note's field names the heading it lands under. That's how coding agents started before PR 9, and journal rows already stored, keep reading. PR 9 switches the models to heading notes and keeps accepting this shape.
  • Revisions: a revision is its text. Inserts write the text and leave the assumptions column empty until PR 11 drops it.
  • The notetaker, the planning model's context, and the voice seed read the text and sections only.
  • Backfill deleted: the endpoint, app, route, and script are gone; it has run.
  • The wire's fields/fieldEdits keys stay in packages/hosted until the desktop's field editor is removed (PR 12, in flight). Only server-only legacy helpers are deleted here.

Expand/contract safety

  • The release live while this deploys (PR 8 and later) already creates and reads documents only.
  • No row is fields-only (the backfill reported zero).
  • Nothing written here is unreadable to that release: revisions keep fields null and assumptions [].

Tests

apps/web tests now describe the document world:

  • notes landing in sections
  • missed notes, the bound, list order, accounts kept apart
  • a rename leaving the text alone
  • pin, archive, delete
  • revisions and restores counting sections
  • the notetaker handed the text
  • edit_plan on text
  • the Start snapshot
  • the voice seed

Tests of removed behaviour are deleted: template formatting and order, "Unanswered", field containment, optional fields, field edits, rename retitling, the backfill, and 0082's migration test (it read the fields columns through the store).

./scripts/check.sh passes locally. There is no Mac UI change.

šŸ¤– Generated with Claude Code


Devin Review