diff --git a/docs/devlog/20261006-issue76-apex-html-reading_log.md b/docs/devlog/20261006-issue76-apex-html-reading_log.md new file mode 100644 index 0000000..8f96a08 --- /dev/null +++ b/docs/devlog/20261006-issue76-apex-html-reading_log.md @@ -0,0 +1,37 @@ +# Issue 76 — Task: build the apex HTML reading surface (S1.2) + +> **Date:** 2026-10-06 +> **Type:** issue +> **Reference:** [Wayfinder map #20](https://git.babylondreams.de/AlexKucera/museion/issues/20) · [ADR-0011](../adr/0011-apex-html-reading-pipeline.md) · spike [#74](https://git.babylondreams.de/AlexKucera/museion/issues/74) · ADR [#75](https://git.babylondreams.de/AlexKucera/museion/issues/75) + +## What landed + +Branch `wayfinder/76-apex-html-reading` (off the #75 ADR branch, which merged #71's landing — the swap needs the surface it replaces), commits `cc04ec2` (feature) + `f1c915f` (lint/DOX). + +**Rewritten** +- `Museion/ReadingPresenter.swift` — the apex HTML pipeline: `stampSource` (blank-line chunker, `` sentinels) → `apexRender` (bundled binary; `-t html --no-mixed-lists --embed-images [--base-dir]`) → `stampHTML` (regex restamp to `data-source-line`) → `page(for:postFolder:)` with `styleSheet()` (ProseTypography slots + flow knobs as CSS custom properties; family names, weight rides CSS). `blocks(for:)` = line↔UTF-16-range map (the #68 contract). Fallback = escaped source `
`; footnotes render natively (apex upgrade over #69's fallback).
+- `Museion/ReadingSurface.swift` — `ReadingStateBox`/`CaretHintBox` kept; one WKWebView reloaded in place (render keyed generation+text+flowKey); probeJS click→edit at clicked block, ⌘-click→NSWorkspace, scroll→top-line into stateBox; `decidePolicyFor` allows only our about:blank main-frame load; entry scroll after `didFinish`; defaults observer reloads on flow-key change.
+- `Museion/Resources/apex` — apex 1.1.17 universal binary (1.8 MB); the fs-sync root group ships it into Resources automatically (verified in the built .app — no pbxproj edit).
+
+**Deleted** (ADR-0011: no fallbacks — the stale-flow defect dies unfixed): `ReadingCanvasView`, `Decoration`, table/quote/HR content blocks, `framesForRange`, `ImagePopoverView`.
+
+**Untouched:** #68 toggle wiring, ProseTypography, ProsePresenter, Settings pane.
+
+## Verification
+
+- `xcodebuild test` green (94 tests; pipeline tests run the real bundled binary — mixed-lists split, `1. 1. 1.` renumber, base64 embed, exact `data-source-line` stamps). SwiftLint 0 errors, SwiftFormat clean on touched files.
+- Live in-app: kitchen-sink + PERF-3k render formatted, toggle instant (apex ~20 ms/render ×3), click-to-edit lands at the clicked paragraph, frontmatter invisible. Alexander clicked around the live app mid-session — no crash, no defect.
+- Perfect gates: PERF-3k pass (20 ms ≪ spike's 33 ms end-to-end).
+
+## Lessons
+
+- **fs-sync root groups DO ship nested non-source files into Resources** — `Museion/Resources/apex` needed no pbxproj wiring. Verify in the built .app before assuming either way (my first check read a stale DerivedData tree from a different project hash and nearly sent me into pbxproj surgery).
+- SwiftFormat between write and patch reflows closures — re-read before patching (skill-documented; bit anyway).
+- Long `write_file` calls can corrupt mid-file (garbled unicode, truncated CSS) — write shorter files or verify after.
+- `execute_code` string replacements can inject literal control chars into escape sequences (a `"\t"` became a raw tab → "Unprintable ASCII character" build error). Fix byte-level with Python, verify with `cat -v`.
+- apex quirks folded into tests: tables wrapped in `
` with stray `
` (CSS hides), footnotes native, `--no-mixed-lists` required. + +## Follow-ups + +- #72 calibration gate unblocked (pointer comment posted: calibrate THIS branch, the HTML surface). +- Release pipeline owes apex signing+notarization (ADR-0011; dev bundle is the adhoc Homebrew artifact).