Prototype: apex HTML reading-surface spike #74
Notifications
Due Date
No due date set.
Blocks
#75 ADR-0011: apex HTML reading pipeline
AlexKucera/museion
Reference: AlexKucera/museion#74
Reference in new issue
Block a user
Part of #20
Question
Proof or kill the apex → HTML → WKWebView reading surface before ADR-0011 commits to it (decision context: #73).
Scope (one afternoon, throwaway):
spike/prose/kitchen-sink.md+spike/prose/PERF-3k.md→ HTML fragment (no--standalone).loadHTMLString(_:baseURL: post-folder)— relative image paths resolve for free.data-source-linestamped on top-level elements by our blank-line chunker as a post-pass (paragraph granularity) — the click-to-edit + scroll-sync mapping proof.decidePolicyFor), external → NSWorkspace.Deliverable: facts for ADR-0011 — or the kill list if something doesn't hold.
[Generated by AI]
Part of #20to Prototype: apex HTML reading-surface spikeVerdict: PROVEN — the apex → HTML → WKWebView surface holds. ADR-0011 has its facts.
Live-tested by Alexander (window driven in-app, corpus + kitchen-sink + PERF-3k).
Mechanism facts
<!--S:N-->before each block; apex passes HTML comments through verbatim; a regex post-pass rewrites them todata-source-line="N"on the following element. Corpus-wide coverage check: 0 mis-stamps (every stamp points at a real non-blank source line), PERF-3k = 128 blocks. Live-verified: click-any-paragraph reports correct line; scroll reports top visible line (same map → scroll-sync).--no-mixed-listsis REQUIRED — default mode merges an ordered list that follows a bullet list into one<ul>(kills1. 1. 1.auto-renumbering, a #69 hard requirement).--embed-images --base-dir <post-folder>inlines images as base64 data URLs.terminationHandler; error path still waits for exit status). End-to-end render (chunk+apex+stamp) measured 33–34 ms via--pipeline..id(sel)): hundreds of ms of web-process respawn + blank pane. ONE WKWebView reloaded in place (loadHTMLString) makes switches feel instant; old text stays visible until new paints. Alexander: "much better. approved."loadHTMLString~67 ms first paint; theloadFileURLalternative measured 255 ms (sandbox negotiation) — 4× cost. ChooseloadHTMLString+ base64 images; it needs no file access at all (bonus: nothing written into the vault).Deviations from ticket scope
--pipelineheadless runs).Kill-list
Empty. Nothing failed.
Lessons (cross-cutting, for #76 rebuild)
decidePolicyForalso cancels your ownloadHTMLString— allow your main-frame load explicitly.System Events) and CGWindowList can BOTH misreport SwiftUI windows; settle probe-vs-reality with one screenshot.--embed-imageson stdin flow needs--base-dirfor relative image paths.Spike code: branch
spike/apex-html, commit7afd1a0,spike/apexhtml/(throwaway;--check+--pipelineself-tests).[Generated by AI]