Format-only pass over spikes, the gate prototype, and three app
files (brace style, wrapping — no semantic change), plus the 4-line
pbxproj alignment finishing the Xcode 27 settings pass (test-target
deployment target parity with 8e70f69).
[Generated by AI]
Spike-locals renamed at lift time (identifier_name), literal tab in a
string escape fixed (unprintable-ASCII build error), swiftlint
force_try disable for the static regex. AGENTS.md reading-mode section
rewritten for the apex HTML pipeline; native-only Work Guidance line
rescoped to the editing side per ADR-0011.
ReadingPresenter becomes markdown -> bundled apex -> HTML fragment with
data-source-line stamps (chunker sentinels + regex restamp, #74-proven);
ReadingSurface becomes one WKWebView reloaded in place (no remount), CSS
vars from ProseTypography slots + flow knobs. TextKit reading machinery
deleted (ADR-0011: no fallbacks; stale-flow defect dies unfixed).
Footnotes now render natively (apex upgrade over #69's fallback). Tests
re-targeted at HTML string asserts incl. real-bundled-binary pipeline runs.
Closes-nothing: wayfinder #76 on map #20; branch wayfinder/76-apex-html-reading.
Three UserDefaults-backed knobs in ProseTypography (line-height multiple,
space-after-¶ and space-after-heading in body lines, clamped), surfaced
in Settings → Text Flow. Also fixes two real bugs from the last commit:
paragraphSpacing was set to 1.25 POINTS (now lines × linePoints), and
reading-mode body paragraphs never received the rhythm at all (they rode
the editing surface's fixed 10pt) — both surfaces now share one rhythm.
- Images render inline via NSTextAttachment (scaled to 480pt, alt as
caption); the hover popover and its ImagePopoverView are gone.
- Vertical rhythm per the author's measurements: lineHeightMultiple 1.25,
1 line after paragraphs, 2 after headings (all block styles).
- Table cells breathe: mono pad 2→3 per side; decoration offsets measure
with the same pad so the grid still lands on the text.
- Margins: lineFragmentPadding 12→24 (reading + editing), inset height 24.
- Image URL resolution hoisted into blocks(for:) — the attachment loads
the resolved path, document() no longer re-resolves.
NSTextBlock/NSTextTable layout is broken on this TextKit build regardless
of engine: textBlocks zero-width the line rect (quotes wrapped one
character per line), NSTextTable rows stack vertically with no grid
(tables rendered as concatenated text with a stray outline). The TextKit1
bridge attempt failed live too. Stop fighting the API:
- Presenter emits plain content: quotes indent-only, HR a thin invisible
line, tables mono-space-padded grid text with alignment honored.
- Each Block/Bound carries a Decoration payload (quote indent, rule,
table column offsets); ReadingCanvasView.draw renders hairlines,
rules, and table grids from measured layoutManager geometry.
- Tests assert decorations + column alignment instead of textBlocks.
Full suite green; lint clean.
Five root causes behind Alexander's calibration findings:
- Wrap to column: both canvases had a fixed 640pt text container —
clipped instead of wrapping when the editor column is narrower
(library + mentor open). widthTracksTextView = true now; measure
polish can return with calibration.
- Tables: TextKit2 stacks NSTextTable rows vertically (each row its
own content-width fragment — no grid). The reading canvas forces
the TextKit1 bridge (replaceLayoutManager); probe-verified grid +
column borders. Read-only canvas — nothing editing-grade lost.
- Heading-tail: a chunk like "# Title" followed by body lines (single
newline, legal markdown) dropped everything after line one. The
heading now renders, then the remaining lines as a soft-joined
paragraph.
- Stale reload (data-loss vector): ProseTextView seeded from
session.loadText (open-time snapshot) — after a reading⇄editing
swap the recreated editor showed the pre-paste text, and a keystroke
there flushed stale content over the user's real edits. Seeds from
session.text (live) now.
- Quote one-char-per-line: did not reproduce after the layout fixes;
root cause was the broken layout state above.
EditorSessionTests debounce flake (50ms margin under parallel load)
passed on both re-runs — timing margin, not a regression.
Full suite green (94 unit + UI smoke); lint clean.