Task: land the reading toggle build #71

Closed
opened 2026-10-05 11:18:32 +02:00 by AlexKucera · 2 comments
Owner

Part of #20

Blocked by

#68, #69, #70

Question

Not a question — this is the map's one execution child. Land the reading toggle in the app per the three decision tickets:

  • Lift readingBlocks from spike/textkit2/ (blank-line split, per-paragraph inline parse, headings fonted — ADR-0010 stance) into the presenter layer, extended to whatever renderer scope was decided.
  • Wire the toggle interaction (affordance, state persistence, edit-intent behavior, scroll mapping, conflict handling) per the interaction ticket (#68).
  • Apply typography per the type-selector resolution (#70): Settings gains three role slots — Body / Headings / Code, each {face, size}, full family list per picker, UserDefaults persistence, silent system fallback — and the v1 defaults land in the presenter tokens.
  • Acceptance (from the original #20): block-aware render (never single-Text flatten); toggle round-trips without touching the file — saved bytes stay stable valid markdown; styling follows design tokens; PERF-3k renders without hitch.
  • Skills: swiftui + swift6-concurrency; ponytail-cheap — lift proven spike code, write nothing that isn't decided.
  • Branch + commit per repo policy (explicit authorization before any push).

Resolve by building it, running the test suite, and posting what landed (files, tests, deviations from the decisions) as the resolution comment.

[Generated by AI]

Part of #20 ## Blocked by #68, #69, #70 ## Question Not a question — this is the map's one execution child. Land the reading toggle in the app per the three decision tickets: - Lift `readingBlocks` from `spike/textkit2/` (blank-line split, per-paragraph inline parse, headings fonted — ADR-0010 stance) into the presenter layer, extended to whatever renderer scope was decided. - Wire the toggle interaction (affordance, state persistence, edit-intent behavior, scroll mapping, conflict handling) per the interaction ticket (#68). - Apply typography per the type-selector resolution (#70): Settings gains three role slots — Body / Headings / Code, each {face, size}, full family list per picker, UserDefaults persistence, silent system fallback — and the v1 defaults land in the presenter tokens. - Acceptance (from the original #20): block-aware render (never single-Text flatten); toggle round-trips without touching the file — saved bytes stay stable valid markdown; styling follows design tokens; PERF-3k renders without hitch. - Skills: swiftui + swift6-concurrency; ponytail-cheap — lift proven spike code, write nothing that isn't decided. - Branch + commit per repo policy (explicit authorization before any push). Resolve by building it, running the test suite, and posting what landed (files, tests, deviations from the decisions) as the resolution comment. [Generated by AI]
AlexKucera added the wayfinder:task label 2026-10-05 11:18:33 +02:00
AlexKucera added a new dependency 2026-10-05 11:18:51 +02:00
AlexKucera added a new dependency 2026-10-05 11:18:51 +02:00
AlexKucera added a new dependency 2026-10-05 11:18:52 +02:00
AlexKucera added a new dependency 2026-10-05 11:18:52 +02:00
Author
Owner

Constrained by #69 (closed): renderer scope v1 is decided — read the resolution before building. Highlights: bullets + ordered lists with indent nesting and auto-renumbering are ONE rendering path (counter makes renumbering free); fenced code, blockquotes, pipe tables (NSTextTable) render; images = hover popover; links styled + ⌘-click opens (plain click keeps #68 tap-to-edit); footnotes are the only fallback; frontmatter invisible. This ticket also creates spike/prose/kitchen-sink.md (ordered + nested + auto-numbered lists, pipe table, blockquote, fenced code, image link) per the resolution.

[Generated by AI]

Constrained by #69 (closed): renderer scope v1 is decided — read the [resolution](https://git.babylondreams.de/AlexKucera/museion/issues/69#issuecomment-22959) before building. Highlights: bullets + ordered lists with indent nesting and auto-renumbering are ONE rendering path (counter makes renumbering free); fenced code, blockquotes, pipe tables (NSTextTable) render; images = hover popover; links styled + ⌘-click opens (plain click keeps #68 tap-to-edit); footnotes are the only fallback; frontmatter invisible. This ticket also creates `spike/prose/kitchen-sink.md` (ordered + nested + auto-numbered lists, pipe table, blockquote, fenced code, image link) per the resolution. [Generated by AI]
AlexKucera self-assigned this 2026-10-05 13:27:23 +02:00
Author
Owner

Resolution

Landed on wayfinder/71-reading-toggle (local commits 4c91733 feature, c4555ed DOX, 36858bc devlog — not pushed). Built per #68/#69/#70 with three deviations, all flagged below.

Files

  • Museion/ReadingPresenter.swift (new) — block-aware renderer: blank-line split → one block per chunk; classification HR → list run → quote run → flow (heading/fence/table/paragraph). Lists = ONE path (bullets + ordered + nesting + per-level auto-renumber counters). Headings h1 = Headings slot size, h2 = 0.77×, ### = body+1, #### floors at bold body. QuoteTextBlock hairline; RuleTextBlock HR; NSTextTable tables (1px border, delimiter alignment honored). Images = hover-payload blocks; links styled + .link retained; footnotes the one fallback. document(for:resolvingImagesIn:) carries per-block {docRange, sourceRange, imageURL} — the click→edit and scroll maps.
  • Museion/ReadingSurface.swift (new) — read-only selectable ReadingCanvasView; tap-to-edit, ⌘-click links, scroll tracking, image hover popover (off-main load).
  • Museion/ProseTypography.swift (new) — the #70 role slots (Body/Headings/Code, six UserDefaults values, silent system fallback).
  • MuseionTests/ReadingPresenterTests.swift (new) — 15 renderer tests.
  • spike/prose/kitchen-sink.md + assets/kitchen-sink.png — the #69 calibration piece (ordered + nested + auto-numbered lists, pipe table, blockquote + nested, fenced code, image link, link, rule).
  • Modified: PostEditorView (toggle + flip-back caret + draft mirror), ProsePresenter (reads the slots), SettingsPaneView (Typography section), MuseionApp (View menu + ⌘R, defaults registration), EditorSession (folderURL).

Tests + verification

  • Full suite green: 94 unit + UI smoke.
  • Runtime probe (hosted test, deleted after): kitchen-sink 24 blocks / 11.3 ms; PERF-3k 128 blocks / 17.2 ms (×10 = 165.8 ms); zero marker leakage on all corpus files.
  • Live-app probe: Read renders kitchen-sink (AX value shows markers hidden, 1. 1. 1. → 1. 2. 3.); ⌘R View-menu toggle-back works; clicking a paragraph flips to editing with the caret in-document; file byte-identical (cmp) after the full Read → toggle → click-to-edit round-trip.
  • Typography pixel-verified: heading ink 20px vs body 15-16px @1× — the 26/20/17 ladder renders.

Deviations from the decisions

  1. Font resolution (#70 specified family+weight lookup): font(withFamily:traits:weight:) misresolves Concourse OT — Thin and Book both advertise weight 4 and the manager returns Thin. Faces resolve through the family member list instead (prefer Book/Regular style names, else closest to weight 5); the #70 PS names (ConcourseOT3Book, UbuntuMonoNFM) fall out of that path.
  2. Heading bold restored: member resolution returns Book, so headings rendered un-bolded in the first build; headingFont(size:) now applies the bold trait (matches #19's weight 8/9 and #70's "Iowan Old Style bold").
  3. Click discrimination: implemented as single-click + no selection + <4pt move, checked after super.mouseDown returns — NSTextView's tracking loop consumes the mouse-up, so a mouseUp override never fires (the plan's time-window check became redundant once the check moved after the tracking loop).

Jank fallback (#68 arbiter): not needed at build time — entry scroll and flip-back caret both shipped and behaved in the live probe. Calibration (#72) arbitrates finally.

Build-note from #69: table alignment was honored rather than left-defaulted — the delimiter row is parsed anyway, alignment was ~4 lines.

[Generated by AI]

## Resolution Landed on `wayfinder/71-reading-toggle` (local commits `4c91733` feature, `c4555ed` DOX, `36858bc` devlog — not pushed). Built per #68/#69/#70 with three deviations, all flagged below. **Files** - `Museion/ReadingPresenter.swift` (new) — block-aware renderer: blank-line split → one block per chunk; classification HR → list run → quote run → flow (heading/fence/table/paragraph). Lists = ONE path (bullets + ordered + nesting + per-level auto-renumber counters). Headings h1 = Headings slot size, h2 = 0.77×, `###` = body+1, `####` floors at bold body. `QuoteTextBlock` hairline; `RuleTextBlock` HR; `NSTextTable` tables (1px border, delimiter alignment honored). Images = hover-payload blocks; links styled + `.link` retained; footnotes the one fallback. `document(for:resolvingImagesIn:)` carries per-block `{docRange, sourceRange, imageURL}` — the click→edit and scroll maps. - `Museion/ReadingSurface.swift` (new) — read-only selectable `ReadingCanvasView`; tap-to-edit, ⌘-click links, scroll tracking, image hover popover (off-main load). - `Museion/ProseTypography.swift` (new) — the #70 role slots (Body/Headings/Code, six UserDefaults values, silent system fallback). - `MuseionTests/ReadingPresenterTests.swift` (new) — 15 renderer tests. - `spike/prose/kitchen-sink.md` + `assets/kitchen-sink.png` — the #69 calibration piece (ordered + nested + auto-numbered lists, pipe table, blockquote + nested, fenced code, image link, link, rule). - Modified: `PostEditorView` (toggle + flip-back caret + draft mirror), `ProsePresenter` (reads the slots), `SettingsPaneView` (Typography section), `MuseionApp` (View menu + ⌘R, defaults registration), `EditorSession` (`folderURL`). **Tests + verification** - Full suite green: 94 unit + UI smoke. - Runtime probe (hosted test, deleted after): kitchen-sink 24 blocks / 11.3 ms; PERF-3k 128 blocks / 17.2 ms (×10 = 165.8 ms); zero marker leakage on all corpus files. - Live-app probe: Read renders kitchen-sink (AX value shows markers hidden, `1. 1. 1.` → `1. 2. 3.`); ⌘R View-menu toggle-back works; clicking a paragraph flips to editing with the caret in-document; **file byte-identical (`cmp`) after the full Read → toggle → click-to-edit round-trip**. - Typography pixel-verified: heading ink 20px vs body 15-16px @1× — the 26/20/17 ladder renders. **Deviations from the decisions** 1. **Font resolution** (#70 specified family+weight lookup): `font(withFamily:traits:weight:)` misresolves Concourse OT — Thin and Book both advertise weight 4 and the manager returns Thin. Faces resolve through the family member list instead (prefer Book/Regular style names, else closest to weight 5); the #70 PS names (ConcourseOT3Book, UbuntuMonoNFM) fall out of that path. 2. **Heading bold restored**: member resolution returns Book, so headings rendered un-bolded in the first build; `headingFont(size:)` now applies the bold trait (matches #19's weight 8/9 and #70's "Iowan Old Style bold"). 3. **Click discrimination**: implemented as single-click + no selection + <4pt move, checked after `super.mouseDown` returns — NSTextView's tracking loop consumes the mouse-up, so a `mouseUp` override never fires (the plan's time-window check became redundant once the check moved after the tracking loop). **Jank fallback (#68 arbiter)**: not needed at build time — entry scroll and flip-back caret both shipped and behaved in the live probe. Calibration (#72) arbitrates finally. **Build-note from #69**: table alignment was honored rather than left-defaulted — the delimiter row is parsed anyway, alignment was ~4 lines. [Generated by AI]
Sign in to join this conversation.