2code icon indicating copy to clipboard operation
2code copied to clipboard

Task 12 restore-by-reattach exceeds the 300–550 line estimate (tracking)

Open AkaraChen opened this issue 2 months ago • 1 comments

Summary

Parent: #425 / #394. Tracking only — not a follow-up implementation.

Issue #425 estimated 300–550 lines and required material scope growth to become a separate issue. The restore-by-reattach branch (task-12-reattach-restore, 1113 insertions / 60 deletions versus task-11-xterm-transport, excluding generated bindings) is larger because #425 also required fail-closed snapshot list + Bound pane_id flatten, same-session attach without restorePtySession/pty_log/localStorage, CLI terminal.scroll (not pane.read), SearchAddon on applied frames, and wheel capture so xterm local scrollback cannot swallow the event. A tech-lead review of an earlier tip counted ~1058 non-generated lines before the inner-viewport wheel intercept. Most of the extra is colocated tests plus scroll IPC.

What grew

  • src-tauri/crates/service/src/runtime.rs and runtime/herdr.rs (reattach from snapshot; mapped Herdr ids refused as Local restore; list flatten)
  • src-tauri/crates/infra/src/herdr/terminal.rs + src-tauri/src/handler/pty.rs (CLI terminal.scroll via scroll_pty)
  • src/features/terminal/restoration.ts (hydrate the same 2code session id; no Local history restore)
  • src/features/terminal/lib/herdrScroll.ts + Terminal.tsx (capture-phase wheel + attachCustomWheelEventHandler; PageUp/PageDown)
  • Colocated tests (restoration.test.ts, herdrScroll.test.ts, Terminal.test.tsx viewport wheel path, runtime/herdr list+scroll tests)

The extra is in-scope Task 12 restore-by-reattach, including required tests. Default runtime stays Local. docs/herdr-integration.md was not rewritten. No pane.send_*, pane.read, pane.split, workspace.*, worktree.*, server.stop, or --takeover was added on the restore/scroll path.

Decision

Keep the extra coverage in Task 12. Splitting it into a later issue would leave Herdr reopen without the reattach+CLI-scroll coverage #425 asked it to depend on. This is not #400 (Task 1 tests/docs), #405 (Task 3 packaging), #408 (Task 4 discovery), #410 (Task 5 transport), #412 (Task 6 sync), #415 (Task 7 mapping), #418 (Task 8 adoption), #420 (Task 9 lifecycle), #422 (Task 10 frame bridge), or #424 (Task 11 xterm transport).

No further production work belongs on this issue.

AkaraChen avatar Sep 15 '26 15:09 AkaraChen

Measured on checkout task-3-line-count-trackers at f0ac78c0735e2664c5d8f42ca1dd5f0f6324f46c (#458 Task 3 / #461). Task 12 restore-by-reattach: this task's own stacked range, not origin/main...HEAD and not the #435 squash.

This re-count matches the tracker body's contemporaneous 1113 insertions / 60 deletions (excluding generated bindings).

Command (exclude lockfiles + generated files; binary numstat - rows are not summed):

git diff --numstat origin/task-11-xterm-transport...origin/task-12-reattach-restore -- . \
  ':(exclude)src/generated/' \
  ':(exclude)src/paraglide/' \
  ':(exclude)**/Cargo.lock' \
  ':(exclude)bun.lock' \
  ':(exclude)**/bun.lock' \
  ':(exclude)bun.lockb' \
  ':(exclude)**/bun.lockb' \
  ':(exclude)package-lock.json' \
  ':(exclude)**/package-lock.json' \
  ':(exclude)src-tauri/binaries/'

Resolved SHAs:

  • base origin/task-11-xterm-transport = 2e282984c35af56dbd769babc08e29da1f93920f (test(terminal): expose mock cols/rows for attach-then-resize assertions)
  • tip origin/task-12-reattach-restore = b8987782278916c6be68a4437d69074d0c3b6e4e (fix(terminal): intercept Herdr wheel before xterm local scrollback)
  • 6 commit(s) in origin/task-11-xterm-transport..origin/task-12-reattach-restore

git diff --shortstat with the same range and pathspec:

23 files changed, 1113 insertions(+), 60 deletions(-)

+1113 / -60 = 1173

This work is already on task-17-shell-templates / task-10-launch-adopt and PR #435. Closing as superseded by #435. No remaining unshipped work on this tracker.

AkaraChen avatar Sep 16 '26 19:09 AkaraChen