oficina / docs Public
Docs native redesign: slice plan
Spec: ../specs/2026-11-22-native-redesign-design.md (revision 3).
Status: revision 3. Claude Fable 5.2 re-reviewed on oficina/docs #157: APPROVE AFTER FIXES, with no third pass. Revision 3 applies the fixes, and S1 is split into S1a and S1b (coordinator's ruling).
Ground rules for every slice:
- One worktree and branch per slice, a branch discussion, and a whole-branch review by the highest available model.
- Paul approves anything that was his call.
- Hub CI exits 0 before the squash merge.
- Each slice is shippable on its own, as a Docs native release (Mac plus TestFlight) through the existing release process. Releasing still needs Paul's go-ahead.
- iPad: from S3 until S5, iPad keeps today's layout behind the idiom gate (spec §5). No slice ships the phone layout to iPad.
Order: S0 → S1a → S1b → S2a → S2b → S3 → S4 → S5.
Acceptance shared by every slice:
- Copy review: every new English string the slice introduces has been through copy review (the
paulca/agent-skillscopy-review skill,serve.sh; checkresult.jsonbefore re-upping), and the result is recorded in the slice's discussion before it lands. The twelve translations follow the reviewed English. - Physical devices: one pass on a physical Mac and iPhone (and iPad from S5), recorded in
native/REVIEW.mdbefore the release (spec §11). - Gates: -
make ci-native/scripts/check-native.sh(including the 200-page document) -native/scripts/snapshots.sh compare(re-recorded only where the slice changes a screen, with the contact sheet reviewed) -test-document-window.py,test-home-loading.py,test-offline-kill.py,test-sync-latency.py-WorkspaceInitTests,SignedInLaunchTests,OfflineDurabilityTests,OficinaIDAdoptionTests- §7's hard counters (from S1a on; the line-fragment counter from S1b) - Tests fail first: each new test was seen to fail for the intended reason (AGENTS.md).
S0: editor snapshots on main
Branch test/editor-snapshots. Small, and first. Spec §11 "Editor snapshots".
Work:
- Add the fixed-fixture editor screens to
DocsSnapshots, drawn by today's renderer: - Mac paged and pageless at 100% and 150%; - iPhone paged and pageless; - an iPad-width editor (today's iPad layout); - an "after a scripted edit" screen on Mac and iPhone (type a line before the first break, apply a peer insert in a later block); - light and dark, iPhone at default and AX3. - The fixture is laid out synchronously before capture. Remove the "editor is not here" exclusion comment.
- If
RastrilloSnapshotscannot set a per-screen locale (needed from S2a for ar and ru), add that to rastrillo/native and re-pin.
Acceptance:
- The new baselines are recorded and reviewed.
- They are stable across three consecutive
compareruns. - A deliberate one-point change to the paper margin reddens them.
S1a: projection log, surface, per-block rendering, render isolation
Branch perf/native-render-isolation. No visible change. Spec §7 Design and Measurement.
Work:
- Bring the audit probes onto the branch from
perf/native-realtime-audit, under theDOCS_PROBEScompilation condition, and add the new counters. - Record the post-phase-2 baseline for every §7 row innative/benchmarks/README.md. - Confirm or adjust the timing targets, with reasons, in the S1a discussion before step 2. CRDTReplica: -presentedRevision; - the bounded dirty log, with unknown entries on every fullprojectbranch; -presentation(…, since:)returning(projection, resultRevision, dirty)atomically.DocumentSurface: -appliedRevision, stale-drop,pendingDirtyandfullDiff(CRDTNode: Equatable); - the block index over.docsTopBlockruns, kept indidProcessEditing, with provisional blocks; - the two-pointer block walk; -renderBlockwith neighbour spacing; - image- and font-scoped re-render; -flushIfDeferred()wired to triggers (a)–(d).- Per-block reconciliation on both platforms. iOS assigns
attributedTextonly at open. - Isolate the text view's host: - the sync row and the toolbar read their own facets; -
DocumentToolbarSelectionbecomes one equality-guarded observed value; -DocumentCommands,DocsToolsControlsandDocsEditorContextread the live storage; - equality-guard every observed assignment inDocsModel.
Pagination is unchanged in S1a: today's updatePagination still runs.
Acceptance:
- Hard counters: whole-document renders, block renders, host body evaluations and
attributedTextassignments meet the §7 gates at p20 and p200h. - Timings: the confirmed targets that S1a alone can move (iPhone per publication, peer main-thread) are met. The Mac paged keyDown target waits for S1b.
- Tests: - the block render equivalence property test; - the block-index-under-optimistic-typing test; - the delta-safety test through the real text view (dropped and delayed publications, extra projections, ja and zh marked text with peer edits, log overflow); - the four deferred-flush trigger tests with no later publication.
Each was seen to fail with its mechanism broken (a skipped neighbour re-spacing; a flush wired to didRender only).
- No visual change: S0's editor snapshots, including the after-scripted-edit screens, are unchanged, as are all other baselines.
S1b: incremental pagination and lazy layout
Branch perf/native-pagination. No visible change. Spec §7 Incremental pagination, iPhone layout, Fallback.
Work:
- The measurement layout manager on the same storage, and the per-block
advance/usedBottomcaches with splices. The full path runs at open (visible-first, then idle chunks), when Pages is turned on, on a font registration affecting every block, and on a text-width change. - The break table keyed by block id. The lookup is
max(proposed.minY, topU + X)from the cache. The break algorithm runs from the first dirty block's page until convergence, coalesced once per run-loop turn before display. - Range invalidation from the first block whose top changed; non-contiguous live layout; frame height from the caches; no whole-container
ensureLayoutinlayout(). - Today's measurement moves into the test target as
DocumentPageLayoutOracle. - iOS: no whole-document
ensureLayoutinlayoutSubviews; non-contiguous layout. - The line-fragment request counter.
- Run both large-document checks. If either platform fails, implement the §7 fallback for it (contiguous to the visible bottom) and record the choice in the discussion.
Acceptance:
- Hard counters: every §7 hard counter, including line-fragment requests, at p20 and p200h.
- Timings: the confirmed Mac paged keyDown and stall targets, and the Pages-toggle bound.
- Pagination equivalence: - The property test passes, typed through the real text view, before and after publication. - Its cases are Return, Backspace at a block's start, block delete, multi-block paste, multi-dirty flushes, typing in a block taller than a page, and the large-heading and image-after-break fixtures. - Production's breaks, live line origins (within 0.5pt) and frame height match a fresh oracle run. - It was seen to fail with a break keyed by character index, and with a relative offset applied twice.
- Large documents: the Mac p200h check (both variants) and the iPhone p200h check pass, on non-contiguous layout or on the recorded fallback.
- Caret: the smoke test's caret-against-glyph checks and the composition-before-separator regression pass.
- No visual change: all S0 editor snapshots are unchanged.
S1b amendments (#173, coordinator's rulings, 2026-11-26):
- iPhone: work item 5 and the iPhone p200h check are withdrawn from S1b. UIKit's TextKit 1 lays the rest of the document out inside any edit that changes a line count, and the only lever found is private API (not used). iPhone pagination is unchanged; the work moves to S3 (TextKit 2). See spec §7 "iPhone layout".
- Known gap: Pages off or on at the end of a 200-page document takes 0.50–0.63 s (measured at load 450–600), against the ≤ 250 ms Pages-toggle bound: the Mac's live layout is contiguous (§7 fallback), so the toggle re-lays out from the first break to the visible end. At the top of a document it is cheap.
S2a: Mac document window, floating inspector, subtitle
Branch native/mac-document-window. Spec §1 (except Share and Delete), §6, §8, §9.
Work:
- Header spike (half a day): a custom title area with the system title hidden but set, run through the spec's six-item checklist (drag, double-click, overflow, full screen, tabs, VoiceOver). Record the result and the chosen contract (or the fallback, with Rename by sheet) in the S2a discussion before step 2.
- rastrillo/native: export
SyncStatusAnnouncer, then re-pin the kit. - The header: - the title area with rename in place; - the subtitle with every §6 row and the 1 s debounce in a
.task; - the undo/redo pill; - the Format toggle.
The .principal item is deleted. Share… keeps today's sheet until S2b.
refreshAccess: - 403 and 404 → "No longer available", left again on a later 200 (withretry()); - 401 pauses input without touchingcan_write, and resumes on the post-re-mint 200; - a 200 withcan_write == false→ View only in place.- The floating inspector: sections, glass and rim; app-wide
docs.inspector.open, default open; focus stays in the text view. - Page centring by translation: - the container becomes a fixed paper band; - a flipped
DocsDeskViewbecomes the scroll view's document view and draws the desk; - the text view is its subview atx = leading / m; - the web's clamp in window points. - Reader mode.
- Menus: - View: Show/Hide Format ⌥⌘I, the Paged/Infinite pair, native-only Zoom; - Format: relabelled to the web keys, H1–3; - Tools: Word count…; - Help: Keyboard shortcuts…, Colophon; - File: Open a document… ⌘K as a sheet over the focused window.
- Remove the Mac strip, the inspector column and the sync row.
- Strings and snapshots: - the §8 keys this slice uses, after copy review, in twelve languages; - orphaned
Mac.stringskeys deleted; - snapshots: Mac document with the inspector open and closed, and reader, in light, dark, ar and ru.
Acceptance:
- Header: the window title equals the document title, there is exactly one visible title, and a launch test asserts there is no
.principalitem. - Subtitle: each §6 row is reachable by a unit test, including 401, 403 and 404.
- Format: ⌥⌘I flips it in all windows and persists across relaunch. It is disabled for readers and in the home window.
- Centring: hosted-window frames match the rule at all six widths, including the 1,108pt boundary. Inspector toggle and live resize meet the §7 per-frame target, with no layout invalidated.
- Performance: the §7 hard counters still hold.
S2b: Share popover and Delete…
Branch native/share-and-delete. Spec §1 Share popover and Delete….
Work:
- Server: -
deletePostanswers native JSON ({"ok":true}, no re-read); - the Go matrix: owner, writer grantee, reader, guest, team non-owner, already deleted, lookup-failure JSON, browser 303 unchanged, suite feed. - The Share popover over the
docs.share.panel.*model: - the team switch and the link switch; - hold, revert, the 500 ms spinner, a single submit; - the once-only URL, non-transient while it shows; - focus rules; - disabled offline and for drafts.
It replaces DocsSharingView's sheet on the Mac, and iPhone gets the same panel as a sheet.
- The Delete… client: - the version-skew rule (non-JSON → re-GET; 404 = deleted); - a POST 404 is re-GOT too (404 = deleted; 200 = failed, nothing dropped); - refused with unsent changes; - after a delete: drop the lane and replica; close the window or pop to the library; refresh the list, Recent and thumbnails.
- Strings and snapshots: -
docs.share.panel.*,docs.delete.*,native.share.offline,native.export.offlineandnative.delete.unsent, after copy review; - snapshot: the share popover in light, dark, ar and ru.
Acceptance:
- Server: the Go matrix passes, and the server change is deployed to prod and lagged before the client is released (
curl /api/versionon each). - Delete client: the Swift client-rule tests pass: JSON
ok; 303 then 404; 303 then 200; POST 404 then GET 404; POST 404 then GET 200, with lane and replica kept. - Popover: the once-only URL shows once and survives an outside click. Share while open is a no-op. Esc returns focus to Share….
S3: iPhone document
Branch native/iphone-document. Spec §3, §6. Behind the iPad gate: iPad unchanged.
Work:
- iPhone navigation: the library becomes a
NavigationStackroot and the document is pushed. iPad keeps theNavigationSplitView. - The header: - the large title hosted inside the text view's scroll view, through
DocumentHeaderState; - collapse on scroll, keyboard and sheet; - back, the undo/redo pill, Aa and •••; - Rename by alert; - no Share pill. - The ••• menu per capability, with the Paged/Infinite pair and Help ▸ Keyboard shortcuts…, Colophon.
- The Format sheet: - the
.mediumdetent with background interaction; - the emptyinputViewkeeping first responder and the selection; - the inset following the sheet; - typing marks; - styles Body text and Heading 1–3 in their own faces; - font, the size stepper, marks, alignment, lists and indent; - the AX re-flow. - The keyboard bar as
inputAccessoryView, writers only. - The reader layout. 6a. TextKit 2 for the iPhone text view (S1b ruling, #173; spec §7 "iPhone layout"): the iPhone editor is rebuilt on TextKit 2, so neither opening nor typing lays out the whole document. Investigate the possible 72.7 pt caret offset at the end of a 200-page document (
PhoneLargeDocumentTests). - Remove the iOS strip, the toolbar items and the sync row on iPhone only.
- Strings and snapshots: -
native.more,native.keyboard.hideand the sheet's labels, after copy review; - snapshots: the iPhone document, reader, format sheet and share sheet, at default and AX3, in light, dark, ar and ru.
Acceptance:
- XCUITest: - the keyboard bar appears with the keyboard, writers only, and with a hardware keyboard; - Aa opens the sheet with the selection highlight still visible; - the collapse triggers work; - the ••• items match each capability.
- iPad: an iPad simulator still shows today's layout.
- VoiceOver: a peer edit does not move the cursor (spec §11).
- Accessibility:
performAccessibilityAudit()passes on the document, sheet and share sheet. - Performance: the iOS §7 counters and targets hold, and (carried from S1b, #173) at p200h paged in the simulator: - per key, main-thread time ≤ 8 ms median, and no stall over 16.7 ms on a key that changes a line count (TextKit 1 today: 250–500 ms); - opening lays out no further than the visible bottom, ≤ 250 ms main-thread to the first screen (today 0.6–1.5 s, the whole document); - the §7 iPhone check: jump to the end before layout passes the first screen; caret against glyph, no line across a page gap, line origins equal to a whole layout's.
- Caret: the 72.7 pt end-of-document caret offset is explained, and fixed if real.
S4: Mac home and iPhone library
Branch native/home-and-library. Spec §2, §4. The iPad library is unchanged (gate).
Work:
- Decode
thumbnail.Excerpt. Add the sharedLibraryModel: the shelf of five, the four groups in the device calendar, searching ungrouped. - Mac home: the window toolbar has "Documents", search, the filled + and the avatar with its menu. The content is the shelf, then the grouped rows card. Remove the sidebar and the large title.
- iPhone library: the large title and avatar (with Colophon); search and compose in the bottom toolbar; the shelf and rows; pull to refresh.
- States: empty, no results and failure on both.
- Strings and snapshots: -
native.list.recent, after copy review; - snapshot baselines: home and library (default, empty, no results), replacinglibrary*, in light, dark, ar and ru.
Acceptance:
- Library model: grouping and shelf tests in a fixed time zone; excerpt decoded.
- Avatar menu: the guards are unchanged (
OficinaIDAdoptionTests, the team-picker-blocked snapshot). - Launch tests: building the home body changes nothing it watches, and the home-loading test passes.
S5: iPad, and polish
Branch native/ipad-and-polish. Spec §5, §9, §11.
Work:
- Remove the iPad gate. - Regular width: the library in the Mac home's form; the document with the Mac header contract in the navigation bar, the floating inspector (with the centring rule in the text view's points), the Share popover and •••;
.commandsin the iPadOS 26 menu bar. - Compact width: the iPhone layout. - Size-class transitions keep the text view, selection, scroll and undo. The inspector and sheet hand-off is as specified.
- Delete the old iPad chrome (
EditorToolbarand theNavigationSplitViewpath), now that nothing uses it. - A pass over Dynamic Type, Reduce Motion, Reduce Transparency, Increase Contrast and RTL on every new screen.
- iPad snapshot screens (regular and compact, light, dark, ar, ru), and a full re-record review.
- Update
native/PARITY.mdandnative/REVIEW.md: iPad's geometric pagination, its scenes and restoration, and what was verified on devices.
Acceptance:
- Size changes: an iPad simulator test splits to compact and back with text selected. The selection and scroll survive, with no whole-document render.
- Keyboard: the hardware-keyboard shortcuts work through the menu bar.
- Accessibility: the audit passes at regular and compact.
- Performance: the §7 counters and targets still hold.