# Mac document windows — 2026-09-20

Paul requests a separate Home launcher and document windows for Docs and Sheets.
This extends the native Apple specs; editors remain native and server-backed.

Home is a singleton with a Recent sidebar and searchable thumbnail grid. Templates
are deferred until template creation exists. Each open document has an independent
model, live stream, selection and save queue. Window identity includes the account
and document; opening an existing document focuses it. Document/session state remains in memory; credentials retain the existing
Keychain handling and are never encoded in scene restoration values. Missing restored sessions return
the user to Home. File > Recent and Window > Home remain available with no editor.
Recent entries are held in memory for this iteration, scoped to the account session.

Mac document windows have no app navigation sidebar. Existing editing and file
actions move into menu-bar commands targeted at the focused scene. Standard native
text responder actions remain available in text fields. Docs adds a document-only
inspector and zoom starting at 100%; zoom changes display scale, never text wrapping.
No server page-settings API exists: inspector exposes existing personal layout
settings and document information, without pretending to persist new paper settings.

Sheets edits in the selected cell, preserving drafts on failed save and respecting
existing write serialization. Header buttons select whole rows/columns. Double-click
on column boundaries autosizes using displayed text/font measurements and existing
size endpoint; menu alternative provided. Remove only the grid's outer focus effect,
retain cell selection and keyboard focus. Enter/Tab commit; Escape discards.

Docs rendering investigation compares web CSS/font and page geometry against TextKit.
Use identical bundled fonts, logical width, sizes, paragraph spacing and line height.
Native optimistic edits must not be overwritten by stale projection generations or
IME composition. Avoid unnecessary complete attributed storage replacement and
selection resets; preserve model render acknowledgement. Exact cross-engine layout
parity requires measured fixture verification, not a compilation claim.

Validate Mac builds, existing native tests and focused regression cases; exercise
window/menu targeting and editing where UI automation is available. Build iOS to
check shared code. No merge, deployment or app publication is part of this change.

Review: GPT-6 Astra (high), 2026-09-20. Required invariants incorporated:
window keys combine canonical origin, account identity and document identity;
clients are immutable per window. Sign out is unavailable until that account's
windows close; switching the launcher account leaves those windows intact.
Close/quit guards cover in-flight, queued, failed and composing edits. Window
registry lifecycle ends only after the actual guarded close. Edit commands obey
the first responder, not merely the focused scene. Render reconciliation compares
actual optimistic text storage, updates CRDT metadata and acknowledges visually
equal generations. Zoom keeps logical layout independent of magnified viewport.

## Verification and remaining coverage

Implementation reviewed by GPT-6 Astra (high), including a final account-isolation
and localization review. Both native Mac test suites and iOS simulator builds pass.
A synthetic AppKit interaction fixture exercises Sheets typing successive characters,
failed-save draft retention, Escape, and whole-row/column selection. A live SwiftUI
scene probe verified File actions and Window > Home after closing Home.

Docs regression tests cover minimal text-storage reconciliation, metadata-only
updates and fixed logical page width. Deliberately restoring full storage replacement
and viewport-dependent width made the corresponding tests fail. A synthetic WebKit
fixture matches native heading, bold and body line breaks and body line spacing.

The follow-up comparison suite loads the production web CSS, bundled fonts and
pages.mjs pagination functions directly into WebKit. It covers nested lists and
quotes, heading margins, serif/monospace fonts, inline code including a code span
starting on a wrapped line, mixed 72pt text, whole-block pagination and an oversized
first paragraph. Native Mac pagination now uses the same 648pt top-level-block
budget, an 18pt separator and collapsed surrounding margins. It does not insert
characters or change CRDT data. Font struts and per-run half-leading determine
line height; nested margins are collapsed before TextKit layout.

Storage edits invalidate separator offsets immediately, including optimistic edits
and marked-text composition. A regression test inserts, composes and deletes before
an existing separator. Unchanged view layouts reuse the measured pagination plan.
Deliberately removing code-start padding and storage invalidation made their tests
fail for the intended reasons; the restored implementations pass.

Follow-up review: GPT-6 Astra (high), 2026-09-20; no remaining blocker in the bounded
source review. Docs validation: 39 XCTest cases plus 15 Swift Testing cases pass,
as does the iOS simulator build. The web comparison allows one CSS pixel for
per-line metric rounding and 1.5pt accumulated position error across a long fixture.
These are measured layout results, not a claim of pixel-identical rasterization or
proof for every possible document. iOS retains its existing responsive paginator;
the document-window pagination change targets Mac as requested.

Builds are local ad-hoc Mac applications, not signed distribution or TestFlight
releases. No server deployment, merge or publication was performed.
