From 49fab564523235364be5c66eff01c78034ed4451 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Thu, 8 Oct 2026 14:18:32 +0200 Subject: [PATCH] docs(devlog): #77 editing-parity session log --- AGENTS.md | 13 +--- .../20261008-issue77-editing-parity_log.md | 65 +++++++++++++++++++ docs/devlog/INDEX.md | 1 + 3 files changed, 68 insertions(+), 11 deletions(-) create mode 100644 docs/devlog/20261008-issue77-editing-parity_log.md diff --git a/AGENTS.md b/AGENTS.md index f1590b4..5d8d9c3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -178,14 +178,5 @@ Session logs live in `docs/devlog/` (one per completed task/issue/milestone). Fu | Date | Log | |------|-----| -| 2026-10-06 | [20261006-issue76-apex-html-reading_log.md](docs/devlog/20261006-issue76-apex-html-reading_log.md) | -| 2026-10-05 | [20261005-issue71-reading-toggle_log.md](docs/devlog/20261005-issue71-reading-toggle_log.md) | -| 2026-10-03 | [20261003-issue19-editor-core_log.md](docs/devlog/20261003-issue19-editor-core_log.md) | -| 2026-10-03 | [20261003-issue18-post-lifecycle_log.md](docs/devlog/20261003-issue18-post-lifecycle_log.md) | -| 2026-10-01 | [20261001-issue17-home-posts-list_log.md](docs/devlog/20261001-issue17-home-posts-list_log.md) | -| 2026-10-01 | [20261001-issue55-verdict-substrate-adr-0010_log.md](docs/devlog/20261001-issue55-verdict-substrate-adr-0010_log.md) | -| 2026-09-25 | [20260925-issue50-profile-backup-s2-6_log.md](docs/devlog/20260925-issue50-profile-backup-s2-6_log.md) | -| 2026-09-16 | [20260916-issue14-acp-bridge-s2-2_log.md](docs/devlog/20260916-issue14-acp-bridge-s2-2_log.md) | -| 2026-09-05 | [20260905-issue48-provisioning-failure-alert-retry-ux_log.md](docs/devlog/20260905-issue48-provisioning-failure-alert-retry-ux_log.md) | -| 2026-09-03 | [20260903-issue42-engine-gate-s2-1_log.md](docs/devlog/20260903-issue42-engine-gate-s2-1_log.md) | - +| 2026-10-08 | [20261008-issue77-editing-parity_log.md](docs/devlog/20261008-issue77-editing-parity_log.md) | +| 2026-10-06 | [20261006-issue76-apex-html-reading_log.md](docs/devlog/20261006-issue76-apex-html-reading_log.md) || 2026-10-05 | [20261005-issue71-reading-toggle_log.md](docs/devlog/20261005-issue71-reading-toggle_log.md) || 2026-10-03 | [20261003-issue19-editor-core_log.md](docs/devlog/20261003-issue19-editor-core_log.md) || 2026-10-03 | [20261003-issue18-post-lifecycle_log.md](docs/devlog/20261003-issue18-post-lifecycle_log.md) || 2026-10-01 | [20261001-issue17-home-posts-list_log.md](docs/devlog/20261001-issue17-home-posts-list_log.md) || 2026-10-01 | [20261001-issue55-verdict-substrate-adr-0010_log.md](docs/devlog/20261001-issue55-verdict-substrate-adr-0010_log.md) || 2026-09-25 | [20260925-issue50-profile-backup-s2-6_log.md](docs/devlog/20260925-issue50-profile-backup-s2-6_log.md) || 2026-09-16 | [20260916-issue14-acp-bridge-s2-2_log.md](docs/devlog/20260916-issue14-acp-bridge-s2-2_log.md) || 2026-09-05 | [20260905-issue48-provisioning-failure-alert-retry-ux_log.md](docs/devlog/20260905-issue48-provisioning-failure-alert-retry-ux_log.md) | diff --git a/docs/devlog/20261008-issue77-editing-parity_log.md b/docs/devlog/20261008-issue77-editing-parity_log.md new file mode 100644 index 0000000..828a02b --- /dev/null +++ b/docs/devlog/20261008-issue77-editing-parity_log.md @@ -0,0 +1,65 @@ +# Issue 77 — Fix: editing-side line spacing → writing-surface parity (S1.2) + +> **Date:** 2026-10-08 +> **Type:** issue +> **Reference:** [Wayfinder map #20](https://git.babylondreams.de/AlexKucera/Museion/issues/20) · ticket [#77](https://git.babylondreams.de/AlexKucera/Museion/issues/77) · ruling [#78](https://git.babylondreams.de/AlexKucera/Museion/issues/78) + +## Goal + +Alexander expanded #77 live: with reading ruled calm (#78), the writing side must look "as close as possible to the reading side, but with plain Markdown" — line spacing, font sizes, bold/italic applied to the Markdown, headers bold. Later adds: same 66ch line width as reading, less-tight heading space, scroll-only scrollbar. Then finish-audit (3-agent reviewer fanout) and fixes. + +## What Was Done + +**Ticket + map work (Gitea)** +- #77 body rewritten to the parity scope (was line-spacing only); round comment records the four taste calls. +- Map #20 repaired: #78's CALM ruling appended to Decisions so far; two dead fog lines cleared (settled by #72's rework); typography-tuning-as-map-work pinned in Out of scope. + +**Build** (`wayfinder/76-apex-html-reading`, commits `8fe5f48` → `1f7557a`) +- `ProsePresenter.swift` rewritten: heading ladder h1 30 / h2 22 / h3 19-bold / h4+ bold body (was 26/20/no-h3); half-height blank separators (9pt); quote = secondary ink + 20pt indent; fence interiors mono-14 on substrate (fence-state prefix scan feeds per-paragraph reattribute); inline traits — `**bold**`, `_italic_` (CommonMark intraword-`_` rule), `` `code` ``, link labels ink + underline with brackets/URL dimmed; list markers dim. Marks stay visible-dimmed everywhere (plain store = source of truth). +- Leading calibrated to CSS 1.8 via `lineHeightMultiple(font:cssLineHeight:)` — TextKit multiplies the font's natural box (~1.2×), so copying the CSS number overshoots ~20%. Per-kind leading: body 1.8, headings 1.15, code 1.5, each from its own face's metrics (audit fix). +- 66ch editor measure: `ProseTypography.measureWidth` = zero-glyph advance × 66 + 48pt padding; `PostEditorView` caps + centers the editing surface at it. +- Heading spacing 75/30 (CSS 90/30 minus the visible blank separator's ~15pt). Overlay scrollbar (`scrollerStyle = .overlay`). +- Audit fixes (`1f7557a`): HIGH fence-delimiter-edit staleness (coordinator fingerprints delimiter count; moved count ⇒ full re-attribute, caret preserved); fonts + measureWidth cached `nonisolated(unsafe) static let`; 7+ hashes → body; tab-lead dim; intraword spans unclaim on reject; fenceState reuses contentLines+classify; marker regexes as literals; dead colors/forwarders deleted (−~55 lines). +- `MuseionTests/ProsePresenterTests.swift` new — 11→12 tests pinning ladder, blanks, quote, fence, traits, intraword, calibration, retrofit (real, not the vacuous first draft), delimiter count. + +## Decisions & Rationale + +| Decision | Rationale | +|----------|-----------| +| Expand #77 instead of a new ticket | Same surface, same branch, obligation born in #73's decoupling; the map's frontier stays one ticket | +| Fold uncontroversial parity, ask only 4 taste calls | Blank-line height, inline-scope, block parity, heading spacing genuinely fork; sizes/leading/bold don't | +| Leading calibrated from font metrics, not CSS number | px `line-height` ≠ TextKit `lineHeightMultiple` (natural box ≈1.2×size); calibration makes parity exact | +| 66ch via zero-glyph × 66 + padding | Same body face as reading.css `--measure`, so toggle round-trips keep line breaks | +| Delimiter-count fingerprint for fence edits | Count is the cross-paragraph state; moved count ⇒ full re-attribute is O(doc) but rare and correct; per-keystroke path stays one-paragraph | +| `nonisolated(unsafe) static let` fonts | NSFont isn't Sendable; instances immutable after creation — same stance as the regex literals | + +## Gotchas & Fixes + +| Problem | Root Cause | Fix | +|---------|------------|-----| +| `###### ` classified as body | `hasPrefix("#### ")` misses 6 hashes | hash-count classify with CommonMark ≤6 cap | +| Test sampling offset 0 on heading lines | 0 is the dimmed `#` marker, not the text | sample at the heading text's range | +| Patch turned `"\t"` into a raw tab (build error) | Literal escape injection in string replace | byte-level python fix + grep verify | +| Swift Regex: no lookbehind, not Sendable, `matches(of:)` API | swift-regex limits | boundary-char helpers, `nonisolated(unsafe)`, String-side `matches(of:)` | +| SwiftFormat reflows between write and patch | Stale multi-line match strings failed | re-read before replace; exact-string asserts | +| All screenshots black while app + window verified alive | Known dead-capture trap (session state) | per macos-ui-automation skill: hand visual pass to Alexander instead of debugging | +| Vacuous "retrofit" test | Sampled paragraph at location 0 — prefix-scan guard skips it | real in-fence paragraph + outside-fence case | +| 28 lint errors after rewrite | 1-char identifiers (error severity), `try!` | renames + regex literals (disables deleted) | + +## Files Changed + +| File | Change Summary | +|------|----------------| +| `Museion/ProsePresenter.swift` | parity rewrite + audit fixes (classify/fence/inline/spacing) | +| `Museion/ProseTypography.swift` | size constants, cached fonts, measureWidth, CSS-token colors; dead colors deleted | +| `Museion/PostEditorView.swift` | 66ch measure + centering, overlay scrollbar, fence-count coordinator | +| `MuseionTests/ProsePresenterTests.swift` | new — 12 tests pinning the parity map | +| `Museion/AGENTS.md`, `MuseionTests/AGENTS.md` | DOX pass for the rework | + +## Open Items & Next Steps + +- [ ] Alexander's visual pass in-app (done condition of #77): kitchen-sink + calibration piece; heading spacing/measure knobs are one-liners if it feels off +- [ ] Ticket #77 stays open until that ruling; resolution comment + map gist follow +- [ ] Branch unpushed (repo policy — explicit authorization each push) + +*Log written by write-log skill* diff --git a/docs/devlog/INDEX.md b/docs/devlog/INDEX.md index bc02baa..0634713 100644 --- a/docs/devlog/INDEX.md +++ b/docs/devlog/INDEX.md @@ -5,6 +5,7 @@ Complete history of session logs in this directory, newest first. One-line summa | Date | Type | File | Summary | |------|------|------|---------| +| 2026-10-08 | issue | [20261008-issue77-editing-parity_log.md](20261008-issue77-editing-parity_log.md) | #77 editing parity: reading-mirrored presenter (30/22/19 ladder, inline traits, 66ch measure), fence-staleness audit fix — 104 tests green | | 2026-10-06 | issue | [20261006-issue76-apex-html-reading_log.md](20261006-issue76-apex-html-reading_log.md) | #76 apex HTML reading surface: WKWebView + bundled apex, data-source-line map, TextKit reading deleted — 94 tests green, PERF-3k 20 ms | | 2026-10-05 | issue | [20261005-issue71-reading-toggle_log.md](20261005-issue71-reading-toggle_log.md) | #71 reading toggle: block-aware renderer, tap-to-edit canvas, typography slots, kitchen-sink — 94 tests green | | 2026-10-03 | issue | [20261003-issue19-editor-core_log.md](20261003-issue19-editor-core_log.md) | #19 editor core: TextKit2 surface lifted, debounced autosave, save dot, cursor sidecar, conflict alert — 81 tests green |