Skip to content

feat(core): add normal resize recovery - #57

Open
zikolach wants to merge 3 commits into
mainfrom
spec/add-normal-resize-recovery
Open

feat(core): add normal resize recovery#57
zikolach wants to merge 3 commits into
mainfrom
spec/add-normal-resize-recovery

Conversation

@zikolach

@zikolach zikolach commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • add shared NormalResizeRecoveryProvider and positive NormalResizeRecoveryContext APIs plus opt-in TUIOptions.normalResizeRecovery
  • fail before terminal startup when recovery is combined with alternate-screen mode or scrollback-clearing resize policy
  • render the retained frame first, reserve its physical footprint (including an empty-frame cursor anchor), and invoke the synchronous text-only provider with a strict current-geometry row budget
  • sanitize recovery lines without retaining provider text in the content-bearing sanitization sample; reject oversized output before publication
  • serialize viewport clear, retained-control cleanup, recovery, live-frame controls, cursor placement, and autowrap restoration in one TUI-owned write
  • keep recovery outside previousFrame, preserve live-frame-relative cursor/mouse/layout state, and place later appends in recovered -> appended -> live frame order
  • discard stale candidates, retry latest coalesced geometry through existing fair Render work, and discard candidates when stop wins before publication
  • add redacted completed/discarded/provider/budget/write recovery diagnostics
  • add shared JVM/Scala Native virtual-terminal coverage, JVM PTY ordering/restoration coverage, docs, smoke instructions, changelog, and completed OpenSpec artifacts

Safety and scope

The first version returns ordinary Vector[String] lines rather than ComponentRender, so recovery cannot acquire component, cursor, image, cleanup, or raw-terminal authority. Siglyph retains no transcript and cannot inspect emulator scrollback; applications remain responsible for current-width semantic tail selection and terminal-dependent deduplication.

No terminal backend API or third-party runtime dependency changed.

Validation

  • focused shared recovery, append, TUI concurrency, diagnostics, virtual-terminal, TUI, and JVM PTY suites — passed
  • mill core.test — passed
  • SIGLYPH_NATIVE_CLANG=/usr/local/opt/llvm/bin/clang SIGLYPH_NATIVE_CLANGPP=/usr/local/opt/llvm/bin/clang++ mill coreNative.test — 38 test classes passed
  • SIGLYPH_NATIVE_CLANG=/usr/local/opt/llvm/bin/clang SIGLYPH_NATIVE_CLANGPP=/usr/local/opt/llvm/bin/clang++ mill __.compile — passed
  • mill scalafmtCheck — passed
  • mill scalafixCheck — passed
  • scripts/test-terminal-pty.sh — passed on macOS
  • openspec validate --all --strict — 15 passed, 0 failed
  • git diff --check
  • OpenSpec implementation tasks — 39/39 complete

Manual Kitty/iTerm2/conventional-emulator persistence checks are documented but were not available in this non-emulator test environment. PTY coverage verifies byte ordering, CSI 3 J absence, synchronized output, append chronology, and restoration without claiming emulator persistence.

Closes #56

@zikolach zikolach changed the title docs(openspec): specify normal resize recovery feat(core): add normal resize recovery Aug 5, 2026

@zikolach zikolach left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted comprehensive review (Pi coding agent). I reviewed the OpenSpec proposal/design/deltas/tasks, public API, owner scheduling, stale/stop behavior, recovery/live publication, append chronology, cursor/mouse/control ownership, diagnostics/redaction, JVM/Native scope, PTY coverage, and documentation.

I found two blocking contract/design issues and one documentation mismatch in the inline comments. The implementation is otherwise unusually thorough: the text-only authority boundary, one-write publication, live-only differential baseline, fail-fast validation, diagnostics, and test coverage are well structured.

Validation performed:

  • mill core.test: passed (135 test classes)
  • mill scalafmtCheck scalafixCheck: passed
  • openspec validate --all --strict: 15/15 passed
  • git diff --check: passed
  • focused local same-geometry probe: failed as described inline
  • GitHub CI: both JVM/package and macOS terminal-conformance jobs pass

Review readiness: needs design clarification/fixes before merge, primarily so an application can actually select only the invalidated durable tail rather than necessarily over-replaying on viewport growth.

Comment thread core/src/scalatui/core/TUI.scala Outdated
Comment thread core/src/scalatui/core/NormalResizeRecovery.scala Outdated
Comment thread CHANGELOG.md Outdated
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.

Support typed resize recovery outside the retained live frame

1 participant