Pluggable terminal backend (1/2): widen TerminalBackend ABC + construction factory - #277
Open
mrw1986 wants to merge 1 commit into
Open
Pluggable terminal backend (1/2): widen TerminalBackend ABC + construction factory#277mrw1986 wants to merge 1 commit into
mrw1986 wants to merge 1 commit into
Conversation
…rough a factory Prep for a pluggable terminal backend (herdr in PR SeemSeam#2; see issue SeemSeam#276). No behavior change. - Widen TerminalBackend to the full contract TmuxBackend actually exposes: 21 abstract methods + 3 safe no-op defaults (set_pane_style / refresh_pane_logs / save_crash_log), so a second backend can share one typed interface. - Add make_terminal_backend() as the single construction point and route all 11 direct TmuxBackend(...) call sites through it. tmux stays the default. - Add a 'herdr' branch (NotImplementedError stub) to the factory, TerminalBackendSelection, and TerminalLayoutService. - Tests: factory / selector / layout herdr-stub coverage + a TmuxBackend<->ABC conformance test. 340 seam tests green; tmux behavior unchanged. Implemented via codex, reviewed by ccb_self. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXGKFeeEcDR1sYPM1xyoBG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prep refactor for a pluggable terminal backend, per #276 (herdr backend + the Windows interest you raised). No behavior change — tmux stays the default and the only implementation.
This is PR 1 of 2. PR 2 adds
HerdrBackendon top of this seam.What changes
TerminalBackend(terminal_runtime/backend_types.py) from 5 methods to the full contractTmuxBackendactually exposes — 21@abstractmethod+ 3 safe no-op defaults (set_pane_style,refresh_pane_logs,save_crash_log) — so a second backend shares one typed interface. Signatures were copied verbatim fromTmuxBackend; a conformance test assertsTmuxBackend.__abstractmethods__is empty.make_terminal_backend()(terminal_runtime/backend_selection.py); all 11 directTmuxBackend(...)call sites now route through it (kwargs preserved).herdrselector branch (stub →NotImplementedError) added to the factory,TerminalBackendSelection.get_backend, andTerminalLayoutService.create_auto_layout. tmux paths are unchanged.Why widen the ABC (the open question from #276)
The ABC declared only 5 methods, but callers rely on ~24 of
TmuxBackend's. Widening to the real contract givesHerdrBackend(and a future Windows-native backend) one typed interface to implement, instead of duck-typing againstTmuxBackend's de-facto surface. If you'd prefer a narrower ABC or a different split, I'm happy to adjust — this PR is meant to settle that shape before the herdr implementation lands.Testing
test_terminal_runtime_backend_selection,test_tmux_backend,test_detect_terminal,test_terminal_runtime_layouts,test_v2_tmux_start_layout,test_ccbd_project_clear, the layout CLIs, the*_session_ensure_panetests, etc. (the live-smoke ones need a real tmux).TmuxBackendfortmux/Noneand raises forherdr; selector + layoutherdrstubs raise;TmuxBackend↔ ABC conformance.Scope
Touches only
terminal_runtime/*, the 11 construction sites, and tests. No changes to the mailbox / lease / recovery / coordination layers — reply capture is session-file based, so those are backend-agnostic and unaffected.