universe
soul.demarkus.io:6309/demarkus-library/debt.md draft reader meta

· reload

demarkus-library: Debt & Deferred Work

Technical debt and consciously deferred improvements. Open items first; the resolved log keeps one line per paid item, with details in the journals. Cleaned up 2026-10-24. Wanted-someday work with no shortcut behind it lives in the backlog.

Open

Per-reader cache keys trade sharing for safety (decide with Phase 2)

The floor, world map, name index and rendered-doc cache key by reader, which fixed the cross-reader leak but drops sharing. A world map, name index or rendered document for world W is the same for every reader who can read W. What was missing was a check on W at each cache hit, not the reader in the key.

Costs at about 100 readers:

  • Floor fan-out is R×(1+W) per 30s instead of 1+W.
  • Per-reader floors are kept 10m, about 1–2 MB per reader.
  • The 512-entry doc LRU splits across sessions (one per tab or login) and can thrash at about 50 concurrent trails.

Alternative: key by world and gate every hit on the reader's world list, which is now one cached read per reader (readerHosts). Blocker: this holds only while read authz is world-level. Phase 2 path-level rules would need the per-reader key back. At today's reader count the current shape is fine.

Publishers write metadata fences into bodies (other repos)

The frontmatter strip is render-side only. The publishers that wrote --- metadata fences into document bodies should be found and fixed at source. The library cannot fix this.

Quiet worlds evict on every cursorless broker reopen

The cost of the mcpwatch fix in demarkus PR #697. A broker stream cut before any notice now reopens with a resync, which evicts the whole world's cached views. A world whose streams are cut often, such as behind an idle timeout, evicts each time. A gateway that sent the head cursor after the acknowledgement would remove this, but that is a spec change (SPEC §6.8.1). Measuring it needs the watch metrics in the backlog.

A spine parses its document's HTML on every canvas render

Since feat/spine-shelf (2026-11-10), spinePeek in spine.go parses the cached rendered HTML of each collapsed document pane to read its opening line and section outline. That runs on every /t/* request.

Measured on synthetic HTML: about 0.09 ms and 45 KB of garbage for an 8 KB document, 0.34 ms and 205 KB for 40 KB. A typical trail of three 10 KB spines costs about 0.3 ms. The worst case, eight 40 KB spines, costs about 2.7 ms and 1.6 MB per request. Each expanded pane already runs three such passes.

Alternative: compute the outline and lede once in markdown.Renderer.Render, where the goldmark tree is in hand, and carry them on domain.Document like Title. They would ride the existing rendered-document cache with no new cache to evict. It was deferred because it puts a presentation concern in the core and touches the domain, the markdown adapter and the service. Revisit if /t/ latency or GC pressure shows up.

Resolved

Date Item Where
2026-09-10 ReadingHandler breadth: shared nav chrome built once, one handler per surface family PR 73
2026-09-10 Wide parameter lists (22 signatures) and three-value returns converted to structs refactor/param-structs
2026-10-23 Backlinks empty on a cold pod: Neighborhood unions the hub graph.md edges fix/backlinks-hub-fallback
2026-10-24 Rendering upgrades (chroma, GFM alerts, emoji, KaTeX and mermaid islands) were already shipped d753dd6, 1bf0343
2026-10-24 JSON error bodies: web.HTMLErrorHandler renders every handler error as HTML PR #92
2026-10-24 Librarian run lifecycle moved into the adapter (Attach, run timeout, reconnect grace) PR #101
2026-10-24 Body match over QUIC: world.Gateway.Lookup forwards Match PR #102
2026-10-24 Stale Gateway.Publish header PR #102
2026-10-24 Comma-ok exception written into the shared guidelines (v2) guidelines
2026-10-24 Per-pod caches served one reader's world mask to another: keyed by reader PR #102
2026-10-24 Observed-links graph shown unfiltered: masked by the reader's world list, host-shaped worlds always visible fix/graph-mask
2026-10-24 Floor, world map and hub each read the world list: one cached readerHosts read per reader per hubTTL fix/graph-mask
2026-10-30 Pane label doubled as the branding world. paneVM.Label and navChrome.Place now carry the name; World is the identity only, and presentRoomError gives the floor and activity error pages the room's brand fix/cursorless-resync
2026-10-30 Pane kinds special-cased across five files: the paneKinds table covers bare chunks, labels, context labels and the pulse; builders stay in the pane loop ADR 0012, fix/cursorless-resync
2026-10-31 mcpwatch reopened a cursorless watch without a resync, so writes in the gap were never signalled. Fixed in demarkus #697, which pays the owed resync before the first event; the library bumped demarkus/client to v0.72.1 demarkus #697, fix/cursorless-resync
2026-12-02 Mermaid diagrams kept their theme on a live scheme change. rethemeDiagrams re-renders from the kept source on an OS change and on the reader's scheme switch. A world sheet slower than the 3s stylesSettled timeout still themes from the old scheme feat/reader-scheme
2026-12-02 The nav ran its doors off narrow screens (seen at 600px). It now wraps, flush right; TestBrowserNavFitsNarrowScreen checks 360 and 480px feat/reader-scheme

Closed without change

  • Per-reader MCP session pool sweep: eviction already runs on every call and the pool has a size cap, so idle sessions cannot pile up.
  • Lower broker rateLimit.tokens to about 30/min: superseded. The deploy repo raised it on purpose to 120/min with burst 60 for MCP handshakes and floor bursts, and per-reader floors make the fan-out larger, not smaller.
  • mark_worlds tool for a generated floor: the floor is built from mark_worlds today.
  • Editor, split and export: Phase 3 desk scope, tracked in its plan.
trail
  1. universe universe
  2. soul.demarkus.io:6309 debt