Repository navigation
refactor: the API stores and serves only the rich Paper (#1957) - #1958
Merged
Merged
Conversation
…h-only-paper # Conflicts: # packages/domain/src/paper-contract-views.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part B of #1954 (one stored Paper format). Part A was #1955 (PR 1956, merged).
Summary
The API now stores, lists and serves only the rich Paper document. Word pages are unchanged.
paper.createmakes a rich blank only. It takes a kind, an optional name and an optional Job. A starting document or a template is refused.paper.revertEdit,paper.sync,paper.setTemplate,paper.share,paper.unshare,paper.dismissCheck,paper.keepTwoPagesandpaper.attachPhoto. Removed reads:paper.pageCount,paper.sharedandpaper.keywordGap. Their routes/sharedand/:id/pagesare gone too.paper.getrefuses every non-Word Paper and points to the rich editor. The Coach's CV drafting skips a Paper it cannot read.paper.nativeSyncnow declares that it changespaper.list, because the list shows each Paper's last change. The invalidation check found this once the check listed rich Papers.paper.revertEditandpaper.attachPhotostay in the activity feed but refuse Undo with a clear reason.0026_paper_rich_onlydeletes everypaper_docsrow whose stored document is not the rich document (version 4, schema revision 2). Owner decision: all data is test data.paper.document. Tests that seeded old block Papers now seed rich ones.Evidence
npx tsc --noEmitinapps/api,apps/webandpackages/domain: 0 errors each.npx vitest runinapps/api: 208 files passed, 4 skipped. 1421 tests passed, 1 expected fail, 0 failed.pnpm testinpackages/domain: 337 passed, 0 failed.npx vitest runinpackages/paper-crdt: 36 files, 336 passed, 1 expected fail.node --test scripts/*.test.mjs packages/guards/*.test.mjs: 1044 passed. The one failure was the unused domain export check, which is fixed: the removed commands' input schemas are deleted frompaper.ts. That check now passes.node --test scripts/catalog.integration.mjs: 37 passed, 0 failed.branchVerdictagainstorigin/main): 0 refusals after the retirements below.Caught by CI, fixed here
The first two CI runs failed the
guards (ordinary)job inscripts/outcome/revoke-every-tool.test.mjs. An earlier commit on this branch had madeapps/api/src/registry/owned.tsimportRICH_NATIVE_WRITERfrom@workspace/domain.test/write-log.tsloadsowned.tswhile the API test global setup starts, and that loader resolves only built packages. The revoke check runs the API tests in a copied tree with no build, so vitest crashed at startup.owned.tsagain imports only types. The ownership harness adds the rich writer topaper.list,paper.getandpaper.documentitself.scripts/global-setup-imports.test.mjswithscripts/lib/global-setup-imports.mjsfollows the global setup's relative imports. It fails on any runtime import of a@workspace/package. Its mistake fixture fires, its type-only fixture stays quiet, and it fails on the bad commit'sowned.tsand passes on the fix. Ledger row:scripts/guard-ledger/global-setup-imports.json.packages/*/distmoved aside, as in the CI guards job,node --test scripts/outcome/revoke-every-tool.test.mjsfailed before the fix with the same startup crash, and passes after it (1 of 1).Merge Danger
Door: one-way for data. The migration deletes stored Papers that are not rich documents. All data is test data (owner decision, 2026-11-04). Code is two-way: a revert restores the commands, but not the deleted rows.
Blast Radius: Paper storage and every Paper command. Rich Papers and Word pages behave as before, which the coverage cases and the content-rich tests show. An old block Paper disappears from the list. The Coach no longer drafts from such a Paper, but it already could not read one.
Migration:
apps/api/drizzle/0026_paper_rich_only.sqlrunsDELETE FROM "opencv_app"."paper_docs" WHERE "crdt_document" IS NULL OR NOT (version 4 and schemaRevision 2). It needsallow-migration:0026_paper_rich_only.Retired checks:
scripts/retired/1957.jsonrecords 62 files whose cases drove the removed commands, sharing, old block sync and Coach edits on old Papers. Theowned-rowsledger proof restored an oldstore.tsthat no longer compiles, so its row now carries the reason instead.Findings
paper.setFavorite. Only the Coach can.paper.getrefuses it), so Letter drafting and Coach focus fail for rich CVs. This was already true onmainbefore this change.Closes #1957