Docs native redesign: S1b amendments (the iPhone moves to TextKit 2 in S3)
The coordinator's rulings on #173, in the spec (§7 "iPhone layout", an S1b amendments table) and the plan (S1b, S3): - iPhone pagination stays as it is in S1b: UIKit's TextKit 1 lays out the rest of the document inside any edit that changes a line count, and the only lever found (backgroundLayoutEnabled) is private API: not used. - S3 rebuilds the iPhone editor on TextKit 2 and carries the p200h per-key and open-time targets and the §7 iPhone check in its acceptance. - S3 investigates a possible 72.7 pt caret offset at the end of a 200-page document on the iPhone. - Known gap: Pages off or on at the end of 200 pages takes 0.5–0.6 s against the 250 ms bound (the Mac's live layout is contiguous).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+24
−1
docs/superpowers/plans/2026-11-22-native-redesign.md+10 −1docs/superpowers/specs/2026-11-22-native-redesign-design.md+14 −0
diff --git a/docs/superpowers/plans/2026-11-22-native-redesign.md b/docs/superpowers/plans/2026-11-22-native-redesign.md| index 2be7ceb..94698c4 100644 |
| --- a/docs/superpowers/plans/2026-11-22-native-redesign.md |
| +++ b/docs/superpowers/plans/2026-11-22-native-redesign.md |
| @@ -109,6 +109,10 @@ Branch `perf/native-pagination`. No visible change. Spec §7 Incremental paginat |
| - **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. |
| @@ -206,6 +210,7 @@ Branch `native/iphone-document`. Spec §3, §6. Behind the iPad gate: iPad uncha |
| - the AX re-flow. |
| 5. **The keyboard bar** as `inputAccessoryView`, writers only. |
| 6. **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`). |
| 7. **Remove** the iOS strip, the toolbar items and the sync row on iPhone only. |
| 8. **Strings and snapshots:** |
| - `native.more`, `native.keyboard.hide` and the sheet's labels, after copy review; |
| @@ -220,7 +225,11 @@ Branch `native/iphone-document`. Spec §3, §6. Behind the iPad gate: iPad uncha |
| - **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. |
| +- **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 |
diff --git a/docs/superpowers/specs/2026-11-22-native-redesign-design.md b/docs/superpowers/specs/2026-11-22-native-redesign-design.md| index 66a2aa5..0d10b2d 100644 |
| --- a/docs/superpowers/specs/2026-11-22-native-redesign-design.md |
| +++ b/docs/superpowers/specs/2026-11-22-native-redesign-design.md |
| @@ -570,6 +570,12 @@ So a delta cannot be forwarded as a patch. |
| - no line straddles a page gap; |
| - after layout settles, every line origin near the end equals that of a fully laid-out container's. |
| +**S1b finding and ruling (#173, coordinator, 2026-11-26): this plan does not hold with UIKit's TextKit 1, and the iPhone moves to TextKit 2 in S3.** |
| +- The iOS container is not a simple rectangle, so the layout manager never lays it out non-contiguously; and its background layout (on, and not public API on iOS) lays the rest of the document out synchronously inside every storage edit that changes a line count, whatever `layoutSubviews` does. Measured on 200 pages paged in the simulator: opening lays out all of it (21,808 line requests, 1.5 s); a key that makes a new line lays out the rest (12,349 requests, about 0.5 s); plain keys 4–6. The "Fallback" below is not available on iOS either, since TextKit lays out to the end itself. |
| +- Turning the non-public `backgroundLayoutEnabled` off fixed a bare stack, but it is private API (App Store risk) and crashed the test on the text view's own layout manager. **Not used.** |
| +- **Ruling:** iPhone pagination stays as it is for S1b. **S3 rebuilds the iPhone editor on TextKit 2** (the iPhone redesign rebuilds that editor anyway), and S3's acceptance carries this check and the p200h targets: per key at p200h paged, main-thread time ≤ 8 ms median with no stall over 16.7 ms on a key that changes a line count; opening p200h paged lays out no further than the visible bottom (target ≤ 250 ms main-thread to the first screen). |
| +- **For S3 to investigate (noted, not fixed):** on today's iPhone code, at the end of a 200-page document, the `UITextView` caret rect was 72.7 pt above its glyph's line (`PhoneLargeDocumentTests`, env-gated). Unverified on a device; it may be the probe's. |
| + |
| ### Fallback, both platforms |
| If a platform's large-document check fails with non-contiguous layout, that platform switches the live layout manager to contiguous layout, laid out only to the visible bottom: `ensureLayout(forBoundingRect:)` on the visible rect at open and on every jump. That is exact. It costs O(position) once per jump, never per key, and the edit-path gates still hold, because edits invalidate from the edited block and only the visible lines are laid out again. The measurement stack keeps non-contiguous layout either way. The slice's discussion records which mode each platform ships. |
| @@ -821,3 +827,11 @@ If a platform's large-document check fails with non-contiguous layout, that plat |
| |---|---|---| |
| | 2 | A second text view on one surface was never drawn; should `reset()` drop the text view? | §7 Design 3: attaching a different view draws it whole; `reset()` keeps the attached view | |
| | 6 | Triggers (e) and `didRender`'s half of (d) cannot unblock anything | §7 Design 6: four triggers, (a)–(d); the two events are no longer triggers, and why | |
| + |
| +## S1b amendments (#173, coordinator's rulings, 2026-11-26) |
| + |
| +| # | Finding | Where answered | |
| +|---|---|---| |
| +| 1 | The iPhone plan (no whole-document layout, non-contiguous, or the contiguous fallback) cannot hold with UIKit's TextKit 1; the only lever found is private API | §7 iPhone layout: iPhone pagination unchanged in S1b; no private API; S3 moves the iPhone editor to TextKit 2 and carries the p200h per-key and open-time targets in its acceptance | |
| +| 2 | A possible 72.7 pt caret offset at the end of a 200-page document on the iPhone | §7 iPhone layout: an S3 investigation item | |
| +| 3 | The Mac ships the live layout on §7's fallback (TextKit does not lay out a non-rectangular container non-contiguously). Pages off or on at the end of a 200-page document re-lays out from the first break to the visible end: 0.50–0.63 s measured at load 450–600, against the ≤ 250 ms target | Known gap, recorded here and in the plan; not an S1b blocker | |