Skip to content

docs(adr-0018): revise state-sync implementation gate — RenderState is the cache primitive#1

Merged
phall1 merged 1 commit into
mainfrom
docs/state-sync-implementability-revision
May 26, 2026
Merged

docs(adr-0018): revise state-sync implementation gate — RenderState is the cache primitive#1
phall1 merged 1 commit into
mainfrom
docs/state-sync-implementability-revision

Conversation

@phall1
Copy link
Copy Markdown
Owner

@phall1 phall1 commented May 26, 2026

Summary

  • ADR-0018's original Decision section gated implementation on a missing libghostty primitive (Terminal::snapshot_grid + diff_into). Re-reading include/ghostty/vt/render.h and the in-tree usage shows GhosttyRenderState already fills the per-consumer cache role: N instances per Terminal is the supported pattern, dirty bits are caller-managed, and phux already holds one per renderer in SnapshotSynthesizer (server) and PaneRenderer (client).
  • Adds an Addendum to ADR-0018 enumerating what's actually load-bearing — Snapshot::dirty() reliability on subsequent updates (phux-l0t), per-consumer RenderState in TerminalActor (phux-28f), the incremental synthesizer extension, and the tick + ack handler. No change to Decision, Rationale, Tradeoffs, or Alternatives.
  • Revises research/2026-05-26-state-sync-algorithm.md Dependencies section with the corrected picture; adds a revision-history footer pointing at git for the original framing.

The synthesis half remains phux's work — no upstream gate. Estimate revised from ~500–1000 LOC to ~200–400 LOC of new code, most of it shared with the existing synthesizer. Upstream COW-backed snapshots remain a wanted federation-scale optimization but not a v0.2 blocker.

Companion bd state

The new state-sync epic (phux-q0e) and sub-tickets (phux-q0e.1–q0e.5), the phux-l0t re-prioritization (P3 → P2), the updated mosh-decomposition memory, and the new renderstate-as-cache memory landed on feat/l1-cascade-wave-a (commit 64d0d95, a mixed-scope chore commit from a bd auto-commit hook) and will arrive on main when that branch merges. This PR's prose references those tickets by ID; readers checking out main before the L1 branch merges will see ID references that don't resolve in bd yet.

Test plan

  • Verify ADR-0018 still renders correctly on GitHub (headings, status line, addendum boundary)
  • Verify research note Dependencies § reads coherently top-to-bottom
  • Confirm bd tickets phux-q0e family arrive on main when feat/l1-cascade-wave-a merges
  • Sanity-check the RenderState-N-per-Terminal claim with a small smoke test before phux-q0e.A starts implementation (deferred to that ticket's scope)

🤖 Generated with Claude Code

…s the cache primitive

The original ADR-0018 Decision section framed implementation as gated
on a missing libghostty primitive (Terminal::snapshot_grid +
diff_into). Re-reading upstream's C headers (include/ghostty/vt/render.h)
and the in-tree usage shows that framing is too pessimistic on the
cache half.

GhosttyRenderState / libghostty_vt::RenderState IS the per-consumer
cache primitive Mosh's framework needs: N instances per Terminal is
the supported pattern, dirty bits are caller-managed (set_dirty(Clean)
is explicit), and phux already holds one per renderer in
SnapshotSynthesizer (server) and PaneRenderer (client). The state-sync
server work is lifecycle (one RenderState per attached consumer
instead of one per Terminal) + incremental synthesis (extend
SnapshotSynthesizer to skip the reset and consult dirty rows) +
tick scheduler + ack-driven dirty reset.

The synthesis half remains phux's work — no upstream gate. Estimate
revised from ~500-1000 LOC to ~200-400 LOC of new code, most of it
shared with the existing synthesizer. Upstream COW-backed snapshots
remain a wanted federation-scale optimization, but not a v0.2 blocker.

This commit:

- ADR-0018: status line notes the revision; appends an Addendum
  section enumerating what's actually load-bearing (Snapshot::dirty()
  reliability per phux-l0t; per-consumer RenderState in TerminalActor
  per phux-28f; the incremental synthesizer; tick + ack handler).
  No change to Decision, Rationale, Tradeoffs, or Alternatives.
- research/2026-05-26-state-sync-algorithm.md: replaces the
  Dependencies section with the revised picture and adds a revision
  history footer. Original framing remains in git history.

Companion bd state (phux-q0e epic + sub-tickets, mosh-decomposition
memory update, renderstate-as-cache memory) was committed on
feat/l1-cascade-wave-a (commit 64d0d95, mixed-scope chore commit)
and will arrive on main when that branch merges.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@phall1 phall1 merged commit fea5ad2 into main May 26, 2026
4 of 5 checks passed
@phall1 phall1 deleted the docs/state-sync-implementability-revision branch May 27, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant