Skip to content

Support(feat): Verify connected tmux daemon meets the 3.3a minimum - #779

Draft
tony wants to merge 42 commits into
masterfrom
bump-min-tmux-000
Draft

tony wants to merge 42 commits into
masterfrom
bump-min-tmux-000

Conversation

@tony

@tony tony commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Note

Master through v0.70.0 already shipped the tmux 3.8 hook table (#825, 0.63.0), TMUX_MIN_VERSION = "3.3a" and libtmux._internal.support.capabilities (#887 and #888, 0.65.0), tmux 3.7c CI (#746, 0.70.0), and ty + Ruff ANN (#682, 0.70.0). The remaining scope in this draft is the connected-daemon run-shell -C version probe, if-shell -F replacement fence, daemon-version flag routing, and client-binary version helper deprecations (#777, #907).

Require tmux 3.3a before ordinary reads, writes, batches and public raw command dispatch. Existing endpoints are checked against the connected daemon's version, preserving patch letters; a newer client executable cannot vouch for an older daemon. Cold creation validates the executable. A native command prefix checks the daemon's release before the requested commands, and live dispatch uses -N so losing a daemon cannot autostart an older executable or load its configuration.

The version query is hook-free. It runs -N run-shell -C '<marker>#{version}', which exits 1 and reports the version in unknown command: <marker><version>; run-shell has no after-hook and, with -C, no command-error hook fires, so a user's after-display-message hook (which display-message fires on every release) never runs for the version check. A failure that does not carry the marker line stays an error, and only no server running, a missing socket or a refused connection mean an absent endpoint. The fence keeps if-shell -F; on tmux 3.5 and newer a replaced-daemon refusal fires command-error once, which is an accurate error report.

Each Server probes its endpoint once and reuses the checked release for later commands and optional-flag decisions: the if-shell -F fence in every command already catches a replaced daemon, so a refusal clears the cached release and the next command probes again. A command that finds the cached daemon gone clears it and checks again (validating the executable for an absent endpoint, as the first call does). The first call, an absent endpoint and Server.kill() always read the endpoint directly, and an absent endpoint is never cached.

The version check parses only the forms tmux has emitted: X.Y with an optional patch letter, X.Y-rc and X.Y-rcN, and next-X.Y, ordered next-X.Y < X.Y-rc < X.Y-rcN < X.Y < X.Ya. Bare 3.8-rc is accepted; 3.3a-master, 3.3a-dev, next-3.3a, leading zeros and master are refused.

Optional flags (-E, -k, -C and the rest) follow the connected daemon's release through Server._has_gte_version, so a newer client cannot send a flag an older daemon rejects. Programs built on libtmux, such as libtmux-mcp and tmuxp, reuse the decision through the small libtmux._internal.support module (MINIMUM, VersionTooLow, require_version, is_at_least, server_version, check_fence) instead of private names. There is no public libtmux.support yet.

Choose format fields from the daemon's numeric release, including numbered development reports, and remove obsolete pre-3.3 hook, popup and prompt adaptations. List accessors and query traversal propagate unsupported-version refusals while retaining ordinary command-error leniency. An absent Server.kill() stays a no-op; standalone version/help diagnostics remain available. Undated master, synthetic OpenBSD diagnostic values and malformed reports cannot pass the version check. The hook table tracks tmux 3.8 (six added hooks, after-queue removed) and skips hooks it does not know instead of failing the parse, and new_pane documents the bordered footprint tmux 3.8 reports.

The executable-version helpers in libtmux.common (get_version, get_version_str, has_version, has_gt_version, has_gte_version, has_lte_version, has_lt_version, has_minimum_version, and the TMUX_MIN_VERSION and TMUX_MAX_VERSION constants) now live in libtmux._internal.version. They read the client executable, not the daemon, so each emits a DeprecationWarning that names the replacement, e.g. is_at_least(server_version(server), "3.4"). They stay importable from libtmux.common. libtmux's own doctests, docs and tests no longer call them (a pytest filterwarnings error enforces this outside tests/legacy_api, which keeps testing them and asserts the warnings).

CI, installation and compatibility documentation use the same minimum. The unreleased changelog is isolated in its own commit. Upgrade the executable and restart existing older daemons after saving their sessions.

Validation:

  • All 1,499 tests and executed documentation examples passed without reruns at the runtime qualification revision on the local Python 3.14t/tmux 3.7d host. CI then exposed a fixed-delay completion example on 3.3a, 3.6 and 3.7b. The corrected example polls an exact marker; all 16 examples in its document pass without reruns on real 3.3a and 3.7d, and changing only the printed marker proves a timeout. The Python 3.15 CI matrix covers tmux 3.3a, 3.4, 3.5, 3.6, 3.7a, 3.7b, 3.8 and master, together with an unsupported-versions job that builds tmux 3.2a, 3.3 and 3.3a and refuses real 3.2a and unpatched 3.3 daemons with no effects.
  • Twenty-five native checks cover 3.2a and unpatched 3.3 refusals with preserved state; real 3.3a creation, reads, split and sizing; distinct older/newer clients within protocol compatibility; quoted batches; daemon replacement; and old-client restart prevention.
  • Deliberate regressions demonstrate the version check, native prefix, release ordering, no-start option values, numbered development format selection, list refusal and natural window naming checks failing for their intended reasons.
  • The configured-executable banner follow-up passes all 52 version-check cases on native 3.3a, including actual executable names with spaces and non-UTF-8 bytes. Restoring the preceding parser makes four intended cases fail. Exact basename and canonical framing preserve strict whole-release validation. Ruff, mypy, strict Sphinx, independent source review and the current Python 3.15 CI matrix pass.
  • Ruff format/lint, mypy and the strict Sphinx documentation build pass. Independent source review found the option-value, development-format and traversal issues now covered by these checks.
  • The hook-free probe follow-up adds a native test that sets after-display-message and, where set-hook accepts it (3.5+), command-error hooks, runs the probe, a prepared command and a dispatched command, then fires a control display-message and a failing command; hooks run in order, so each sentinel holding exactly one letter shows the version check fired neither. It passes on 3.3a, 3.4, 3.5, 3.6b, 3.7d, 3.8 and master (next-3.9). Restoring display-message as the probe fails it on 3.3a, 3.5, 3.8 and master. The 236 version-check, server, common and version tests pass on 3.7d; Ruff and mypy pass.
  • Review follow-ups. The version grammar is one table (supported, below floor, unparseable, ordering); widening the pattern to accept -master/-dev and require rc digits fails seven cases. Moving the flag decisions to the daemon is pinned by a test where the client helper says "newest" and the daemon reports 3.3a; asking the client again fails it. The per-endpoint reuse is covered by tests for one probe across commands, a stale cached release refused with no effect, a daemon killed from outside, and kill() probing afresh; not clearing on a fence refusal fails two tests, skipping the gone-daemon retry fails one, and never storing the release fails four. Seven native cases drive real 3.2a, 3.3 and 3.3a daemons; accepting everything fails the four refusal cases.
  • Spawned tmux processes per call on 3.7d, before and after reuse: Server.cmd("list-sessions") 2 and 1, Server.sessions 3 and 1, Pane.capture_pane with two optional flags 4 and 1. Wall time varied about 30 percent under shared load; best of two runs for 100 list-sessions was 3.02s and 1.94s and for 100 Server.sessions 4.11s and 1.72s.
  • Deprecated helpers. 1,554 tests and executed documentation examples pass on tmux 3.7d and tests/test_versions.py passes on real 3.3a, with Ruff, Ruff format and mypy clean. Removing the warning from has_lt_version fails its test, and putting a deprecated call back in a doctest or in a test outside tests/legacy_api fails the suite.

Release sequencing: libtmux 0.65.0 shipped the 3.3a baseline (#888) and downstream tmuxp (1.84.0) tracks libtmux 0.70.0; the remaining daemon-side verification and #780 stack are scheduled under 0.72.0+ in #907. Nothing here tags or releases.

Other Python versions and platforms remain outside this qualification. Optional engine and feature restrictions are covered by the paired feature change.

The version check assumes that library-owned metadata and guard commands retain native tmux built-in semantics. Deliberate server command-alias redefinitions of those commands are outside this guarantee.

Closes #777.

@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.02564% with 159 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.03%. Comparing base (efdbb56) to head (f262b36).

Files with missing lines Patch % Lines
src/libtmux/_internal/support/versions.py 73.36% 43 Missing and 10 partials ⚠️
src/libtmux/_internal/version.py 55.42% 35 Missing and 2 partials ⚠️
tests/conftest.py 8.82% 31 Missing ⚠️
src/libtmux/server.py 64.70% 6 Missing and 12 partials ⚠️
src/libtmux/pane.py 55.55% 3 Missing and 5 partials ⚠️
src/libtmux/common.py 89.47% 4 Missing ⚠️
src/libtmux/_internal/query_list.py 50.00% 2 Missing and 1 partial ⚠️
src/libtmux/_internal/support/__init__.py 72.72% 3 Missing ⚠️
src/libtmux/window.py 50.00% 0 Missing and 1 partial ⚠️
tests/tmux_client.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #779      +/-   ##
==========================================
+ Coverage   61.99%   62.03%   +0.04%     
==========================================
  Files          29       33       +4     
  Lines        5091     5421     +330     
  Branches     1082     1130      +48     
==========================================
+ Hits         3156     3363     +207     
- Misses       1595     1705     +110     
- Partials      340      353      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tony
tony force-pushed the bump-min-tmux-000 branch from 6d1be63 to 73f82c7 Compare October 17, 2026 12:25
@tony
tony force-pushed the bump-min-tmux-000 branch 3 times, most recently from f6e4630 to c27dd92 Compare October 17, 2026 18:10
tony added a commit to libtmux/docs that referenced this pull request Oct 24, 2026
why: The 3.3a sweep moved the Python, tmuxp and libtmux-mcp pages to a
floor that none of them declares. At tmux-python/libtmux master,
TMUX_MIN_VERSION is "3.2a", the README says "tmux: >= 3.2a", and the CI
matrix starts at 3.2a. The 3.3a raise exists only in the open draft
tmux-python/libtmux#779, so a reader on 3.2a would be told to upgrade
for a library that runs there. The refusal sentence added to the Python
pages was also untrue: libtmux exposes has_minimum_version, which
compares the `tmux -V` of its executable with TMUX_MIN_VERSION, and no
operation in src/libtmux calls it, so nothing refuses an older daemon.

Evidence, pinned to the trunk heads read on 2026-10-24:
- libtmux e5cb17c: src/libtmux/common.py TMUX_MIN_VERSION = "3.2a"
  https://github.com/tmux-python/libtmux/blob/e5cb17c855fb9c9427e9c51a7239d6e843f4ede0/src/libtmux/common.py#L29
  README "tmux: >= 3.2a"
  https://github.com/tmux-python/libtmux/blob/e5cb17c855fb9c9427e9c51a7239d6e843f4ede0/README.md#L33
  tests.yml tmux-version matrix begins at 3.2a
  https://github.com/tmux-python/libtmux/blob/e5cb17c855fb9c9427e9c51a7239d6e843f4ede0/.github/workflows/tests.yml#L15
- tmuxp 7965262: README "tmux support: 3.2+"; matrix begins at 3.2a
  https://github.com/tmux-python/tmuxp/blob/7965262d4a376f5f6cd9238b6ce4189d35a5d9e7/README.md#L313
- libtmux-mcp 263541d: README "tmux >= 3.2a on $PATH"; compatibility
  table "< 3.2a: Not supported (libtmux requirement)"
  https://github.com/tmux-python/libtmux-mcp/blob/263541d4b7c72507ab64bbb066592181522eec6c/docs/reference/compatibility.md#L20

what:
- Restore 3.2a on the Python guides, the MCP entry and guide pages,
  the tmuxp workspace pages, the shared workspace installation page's
  tmuxp paragraph and the Python home quickstart prerequisites
- Restore the "3.2+" rows of the options and hooks requirements table,
  which sits beside the 3.3+ rows for individual hooks
- Keep the link to the shared tmux support guide on the two Python
  pages that gained it, and drop the sentence that said an older daemon
  is refused before any effect
tony added a commit to libtmux/docs that referenced this pull request Oct 24, 2026
why: The guide said each port records the optional features in a typed
capability registry and that a library decides from the daemon's
release. A capabilities.json sits at the root of ten ports' trunks, and
none of Python (libtmux), PowerShell or Elixir has one. Python's gates
exist only in the open drafts tmux-python/libtmux#779 and #780, and
the branch of #780 carries no capabilities.json either. Those three
ports cannot appear on pages generated from registries, so the
sentence promised pages and gates that do not exist for them.

Evidence, pinned to the trunk heads read on 2026-10-24: a root
capabilities.json exists at libtmux-go e74ab0b, libtmux-rs a6ce1fe,
libtmux-ts 84f1366, libtmux-java 08ee74b, libtmux-ruby d8ce4bb,
libtmux-lua e058c83, libtmux-dotnet 0e25b51, libtmux-cxx 384c8e1,
libtmux-swift b58e7e1 and libtmux-julia ff27c5c, and is absent from
tmux-python/libtmux e5cb17c, libtmux-powershell 1c360cf and
libtmux-elixir 2cc4430.
https://github.com/libtmux/libtmux-go/blob/e74ab0bb253c36637aa5e25ff6d3ff1565b96ba2/capabilities.json

what:
- Scope the registry and gating sentences to ports that publish a
  registry and state that a port without one is not on the map and
  makes no promise about these features
- Leave the port names out of the guide, so it does not go stale when
  a port publishes its registry
tony added a commit to libtmux/docs that referenced this pull request Oct 24, 2026
why: The guide said each port records the optional features in a typed
capability registry and that a library decides from the daemon's
release. A capabilities.json sits at the root of ten ports' trunks, and
none of Python (libtmux), PowerShell or Elixir has one. Python's gates
exist only in the open drafts tmux-python/libtmux#779 and #780, and
the branch of #780 carries no capabilities.json either. Those three
ports cannot appear on pages generated from registries, so the
sentence promised pages and gates that do not exist for them.

Evidence, pinned to the trunk heads read on 2026-10-24: a root
capabilities.json exists at libtmux-go e74ab0b, libtmux-rs a6ce1fe,
libtmux-ts 84f1366, libtmux-java 08ee74b, libtmux-ruby d8ce4bb,
libtmux-lua e058c83, libtmux-dotnet 0e25b51, libtmux-cxx 384c8e1,
libtmux-swift b58e7e1 and libtmux-julia ff27c5c, and is absent from
tmux-python/libtmux e5cb17c, libtmux-powershell 1c360cf and
libtmux-elixir 2cc4430.
https://github.com/libtmux/libtmux-go/blob/e74ab0bb253c36637aa5e25ff6d3ff1565b96ba2/capabilities.json

what:
- Scope the registry and gating sentences to ports that publish a
  registry and state that a port without one is not on the map and
  makes no promise about these features
- Leave the port names out of the guide, so it does not go stale when
  a port publishes its registry
tony added a commit to libtmux/docs that referenced this pull request Oct 24, 2026
what:
- Add the tmux support guide, linked from the guides index. It lists
  the minimum by port: 3.2a for Python and libtmux-mcp, 3.2a for tmuxp
  as the floor of its libtmux dependency, 3.3 for Elixir and 3.3a for
  every other port, so none needs a release newer than 3.3a. It also
  says how a library judges the daemon: releases compare in full, so
  3.3 is below 3.3a; the daemon on the socket is checked by the version
  it reports; in a port that enforces its floor, every typed method,
  raw command, batch, workspace load and MCP tool passes the check
  before the command runs. Python's has_minimum_version is called by no
  operation, and Elixir has no runtime refusal
- Move the shared concept, example, guide and topic pages and the Java,
  Kotlin and Scala pages from 3.2 or 3.2a to 3.3a, along with the JVM
  example introductions (jvm-examples.ts and the java, kotlin and scala
  models), Ruby's MCP pages (3.3 to 3.3a) and the Julia install note
  (3.7c to 3.3a). Python and tmuxp pages stay at 3.2a, Elixir at 3.3
- Say on the C#, C++, Go, Java, Rust, Swift and TypeScript workspace
  compatibility pages and the Go and Rust MCP entry pages that an older
  daemon is refused before any effect, and link the guide
- Leave the staged F#, Julia, Ruby and Scala guides as pinned; they
  follow when their ports move their pins
- Test every statement of a minimum on the site against its port's
  floor, in tmux-minimum.test.ts: wrong floors fail beside clean
  controls, and each exemption is tied to its own statement

why: Pages, example prerequisites and install notes gave 3.2 or 3.2a for
ports that require 3.3a, so a reader on 3.2a followed instructions the
library refuses. Python still declares 3.2a; its raise to 3.3a is only
the open draft tmux-python/libtmux#779. Floors are from libtmux
e5cb17c, tmuxp 7965262, libtmux-elixir 2cc4430 and libtmux-java
08ee74b. CI: run 40121484011, test job green.
tony added a commit to libtmux/docs that referenced this pull request Oct 25, 2026
why: The guide said each port records the optional features in a typed
capability registry and that a library decides from the daemon's
release. A capabilities.json sits at the root of ten ports' trunks, and
none of Python (libtmux), PowerShell or Elixir has one. Python's gates
exist only in the open drafts tmux-python/libtmux#779 and #780, and
the branch of #780 carries no capabilities.json either. Those three
ports cannot appear on pages generated from registries, so the
sentence promised pages and gates that do not exist for them.

Evidence, pinned to the trunk heads read on 2026-10-24: a root
capabilities.json exists at libtmux-go e74ab0b, libtmux-rs a6ce1fe,
libtmux-ts 84f1366, libtmux-java 08ee74b, libtmux-ruby d8ce4bb,
libtmux-lua e058c83, libtmux-dotnet 0e25b51, libtmux-cxx 384c8e1,
libtmux-swift b58e7e1 and libtmux-julia ff27c5c, and is absent from
tmux-python/libtmux e5cb17c, libtmux-powershell 1c360cf and
libtmux-elixir 2cc4430.
https://github.com/libtmux/libtmux-go/blob/e74ab0bb253c36637aa5e25ff6d3ff1565b96ba2/capabilities.json

what:
- Scope the registry and gating sentences to ports that publish a
  registry and state that a port without one is not on the map and
  makes no promise about these features
- Leave the port names out of the guide, so it does not go stale when
  a port publishes its registry
@tony
tony force-pushed the bump-min-tmux-000 branch from c27dd92 to b473103 Compare November 7, 2026 02:19
@tony
tony force-pushed the bump-min-tmux-000 branch 2 times, most recently from cf80dab to 80d725d Compare November 22, 2026 03:26
tony added 29 commits November 28, 2026 20:47
why: Pane, Window, Session and Server chose optional flags such as -E,
-k and -C from the client executable's -V, so a current client talking
to a 3.3a daemon sent flags the daemon rejects with a native error
instead of taking the warn-and-ignore path.

what:
- Add Server._has_gte_version, which compares the connected daemon's
  release, and use it at every optional-flag gate
- Read the daemon's release for exact-3.7 break-pane naming too
- Patch that decision in the warn-on-old-tmux tests
- Test a client that reports the newest release against a 3.3a daemon

Making _has_gte_version consult the client again fails the new test.
The server, pane, capture, window and session modules pass on 3.7d.
why: Every command spawned a version probe plus the command, and each
optional-flag decision spawned another, so a lookup took two to four
tmux processes. The in-band if-shell -F fence already detects a
replaced daemon, so the release only needs probing again after the
fence fires or the daemon disappears.

what:
- Give each Server a VersionCache holding the release last checked for
  its endpoint (binary, selectors, TMUX_TMPDIR and TMUX)
- Read it in prepare() and Server._get_version(), and share it with
  list accessors through fetch_objs
- Clear it when the fence refuses. When no daemon answers, clear it and
  check once more, which validates the executable for an absent
  endpoint exactly as the first call does and cannot have had an effect
- Read the endpoint directly on the first call, for an absent endpoint
  and in Server.kill(); never cache an absent endpoint
- Test one probe across three commands, a list accessor and a flag
  decision; a stale cached release refused with no effect, forgotten
  and re-read; a daemon killed from outside detected and a new session
  started after a fresh check; kill() probing afresh
- Clear the cache in the existing disappearance and changed-report
  tests so they still exercise the probe

tmux spawns per call, before and after, on 3.7d with config /dev/null:
Server.cmd("list-sessions") 2 and 1, Server.sessions 3 and 1, and
Pane.capture_pane with two optional flags 4 and 1. Wall time, best of
two runs on a shared WSL2 host (it varies by 30 percent between runs;
spawn counts do not): 100 list-sessions 3.02s and 1.94s, 100
Server.sessions 4.11s and 1.72s, 50 capture_pane 0.83s and 0.88s.

Breaking each guard fails its tests: not clearing on a fence refusal,
skipping the gone-daemon retry, and never storing the release. The
version check module passes on 3.7d (83 tests).
why: The compatibility page said the version check never caches, which
stopped being true once each Server reused its checked release.

what:
- Say a Server probes its endpoint once and reuses the release
- Say the fence refuses a replaced daemon with no effect
- Say kill() and an absent endpoint read the endpoint directly
why: libtmux-mcp and tmuxp reuse the daemon-first version check for
their own tmux subprocesses, and had to read private Server methods to
do it.

what:
- Add libtmux._internal.support with MINIMUM, VersionTooLow,
  require_version, is_at_least, server_version(server) and check_fence,
  wrapping the existing helpers with no behaviour change
- Test the exported names, an older daemon refused through
  server_version, a checked release returned, and a fence marker turned
  into VersionTooLow while an unrelated line is ignored
- Run the module doctest
why: libtmux-mcp and tmuxp import libtmux._internal.support, so its
names need a reference page beside the other internals.

what:
- Add an internals API page for libtmux._internal.support
- Add its card to the internals index
why: Refusal below the floor was covered only with a monkeypatched
probe.

what:
- Start a real 3.2a or 3.3 daemon and drive it with a 3.3a client: a
  write, a new session, a raw tmux_cmd kill-server and a list accessor
  all raise VersionTooLow, and a sentinel option and the session list
  stay unchanged
- Check that a cold 3.2a or 3.3 executable cannot create its socket,
  and that a real 3.3a daemon passes as the control
- Skip unless the three LIBTMUX_TEST_*_TMUX variables name native
  builds, the convention libtmux-mcp and tmuxp use

The seven native cases pass against 3.2a, 3.3 and 3.3a builds. Making
require_version accept everything fails the four refusal cases.
why: The native refusal tests skip unless real 3.2a, 3.3 and 3.3a
builds are available, so CI needs a job that provides them.

what:
- Add an unsupported-versions job that builds tmux 3.2a, 3.3 and 3.3a
  from source, exports the three native paths and runs the version
  check module
- Leave the supported matrix starting at 3.3a
why: tmux 3.8 adds after-swap-window, client-closed, client-created,
marked-pane-changed, session-added-to-group and
session-removed-from-group, and drops after-queue. Hooks.from_stdout
raised TypeError on the first hook its dataclass lacked, so show-hooks
on 3.8 broke parsing.

what:
- Add the six 3.8 hooks as Hooks fields
- Skip hooks the table does not know instead of failing the parse
- Cover the 3.8 hooks in the set/show/unset grid, gated on 3.8
- Gate the after-queue case to tmux up to 3.7
why: From 3.8, new-pane -x/-y/-X/-Y give the on-screen footprint
including the default border (regress/floating-pane-geometry.sh), so a
pane asked for 80 columns reads pane_width 78. The test and the
floating_panes doctest assumed content-box sizing and failed on 3.8.

what:
- Document the border offset on Pane.new_pane and Window.new_pane
- Expect width/height minus 2 and x/y plus 1 on 3.8+, in the test and
  doctest
why: tmux 3.8 display-popup returns early for control-mode clients
(cmd-display-menu.c: CLIENT_CONTROL check), so the command never ran and
the popup tests timed out waiting on their marker files.

what:
- Add a pty_client fixture that attaches a terminal-backed client
- Use it in the display_popup flag, close_on_success and target_client
  tests
- Note the 3.8 control-client behaviour on Pane.display_popup
why: The per-Server version cache holds a threading.Lock, so
copy.deepcopy(Server(...)) and pickle.dumps(Server(...)) raised
"cannot pickle '_thread.lock' object". Both work on master.

what:
- Give VersionCache __getstate__/__setstate__ that drop the cached
  release and create a fresh lock, so a copy checks its daemon again
  rather than trusting a release checked by another object
- Test deepcopy and pickle round trips keep the endpoint and start
  without a checked release

Removing __getstate__ makes the round-trip test fail with the original
TypeError.
why: server_version(server) returned the release the Server had
cached, so after a 3.3a daemon was replaced by 3.2a on the same socket
it still answered "3.3a". check_fence had no way to tell a Server that
its cached version was stale, so a consumer dispatching its own fenced
subprocess could not invalidate it either.

what:
- Clear the Server's cached version before server_version probes
- Accept an optional server in check_fence and clear its cached version
  when the fence fires, before re-raising VersionTooLow
- Test a real 3.3a daemon replaced by 3.2a: server_version refuses
  it and leaves nothing cached
- Test that a fired fence clears the cache and a foreign marker does not
- Import libtmux._internal.support at module level in the tests

Each guard has a deliberate break that fails its test: server_version
reading the cache, and check_fence keeping it.
why: get_version and the has_*_version helpers read the tmux client
executable, which can be a different release from the daemon a Server
talks to. libtmux checks the daemon through libtmux._internal.support,
so the executable helpers are legacy and belong out of common.

what:
- Add libtmux/_internal/version.py holding get_version, get_version_str,
  has_version, has_gt/gte/lte/lt_version, has_minimum_version, their
  private helpers, TMUX_MIN_VERSION and TMUX_MAX_VERSION
- Each public helper emits a DeprecationWarning (stacklevel 2) saying it
  reads the client executable and naming the libtmux._internal.support
  replacement, e.g. is_at_least(server_version(server), "3.4")
- Keep cache_clear() on get_version and get_version_str, typed so mypy
  accepts it
- Re-export every helper from libtmux.common, and serve the two
  constants through a module __getattr__ that warns, so old imports keep
  working
- Resolve tmux_cmd through libtmux.common at call time so tests that
  replace it keep working
- Point the tests that patch TMUX_MIN_VERSION and _query_version at the
  module that now owns them
why: The tests that exercise get_version and the has_*_version helpers
test the legacy executable API, so they belong beside the other legacy
tests and not among the suite that libtmux's own behaviour is built on.

what:
- Move the helper tests from tests/test_common.py to
  tests/legacy_api/test_version_helpers.py unchanged: memoization, cache
  keying, comparisons, version parsing and validation
- Silence DeprecationWarning for that module only, since it deliberately
  calls the deprecated helpers
- Leave tmux_cmd, session_check_name and the other common tests in place
why: The helpers now read like deprecated API but nothing proved they
warn, point at the caller, or name the replacement, so dropping a
warning would go unnoticed.

what:
- Parametrize over all eight public helpers: each emits a
  DeprecationWarning that names the client executable, its own
  libtmux.common name and libtmux._internal.support, and points at the
  caller's file
- Check TMUX_MIN_VERSION and TMUX_MAX_VERSION warn through
  libtmux.common and still return their values
- Check an unknown attribute still raises AttributeError
- Check get_version.cache_clear and get_version_str.cache_clear survive
why: The doctests called has_gte_version, which reads the client
executable and now warns. They run against the daemon the server fixture
talks to, so that is the release to gate on.

what:
- Replace has_gte_version("X") with is_at_least(server_version(server),
  "X") in the Pane, Server and Window doctests, importing both from
  libtmux._internal.support
why: The floating-pane examples called has_gte_version, which reads the
client executable and now warns, and the format-token page described
the legacy helpers as if they were the way to read a version.

what:
- Use is_at_least(server_version(server), "X") from
  libtmux._internal.support in the floating-pane examples
- Say on the format-token page that get_version and get_version_str are
  deprecated and point at server_version for the daemon's release
why: The suite gates tests on the release of the tmux it launches, which
is the executable. The deprecated libtmux.common helpers warn on every
call, so the suite needs its own small gate to keep libtmux's tests free
of deprecation warnings.

what:
- Add tests/tmux_client.py with client_gte, client_lte and clear_caches,
  built on the private helpers in libtmux._internal.version so the
  letter-stripping comparison stays what the tests were written against
- Flush the caches through clear_caches in the autouse conftest fixture
- Read the daemon's release in the non-UTF-8 locale test through
  Server._get_version
- Make the newer-client-executable test fake the executable's release
  where the helper now lives
why: These tests called has_gte_version and has_lte_version from
libtmux.common, which now warn that they read the client executable.

what:
- Replace the helper calls in the hooks, options, pane, capture-pane,
  server, session and window tests with client_gte and client_lte from
  tests/tmux_client.py, with the same version comparisons
- Reword the window-name test docstring that cited get_version
why: libtmux must not call the deprecated executable version helpers
itself, but nothing stopped a doctest or a test from reintroducing one;
the warning would only scroll past in the summary.

what:
- Turn a DeprecationWarning whose message starts with libtmux.common.
  into an error when it is raised from libtmux or from tests outside
  tests/legacy_api, which keeps exercising the helpers on purpose

Each break fails and the restored tree passes: a doctest calling
has_gte_version and a test outside legacy_api calling it.
why: Users upgrading need to know that tmux servers below 3.3a are now
refused, which version helpers warn and what replaces them, and what was
fixed for newer tmux releases.

what:
- Record the tmux 3.3a minimum, checked against the running server
- Record the deprecated executable version helpers with a migration
- Record flags following the server's release and the tmux 3.8 hooks
- Record the completion example that waits for real output
why: Trunk already ships the tmux 3.8 hook table and a refresh() that
reads the client's tmux version, so rebasing left duplicate Hooks
fields and calls to two helpers this branch replaced.

what:
- Drop the duplicate 3.8 Hooks fields; trunk's table declares them
- Read the daemon version in refresh(), as the rest of the branch does
- Gate the removed-hook test on client_gte
- Expect the borderless position in the floating-pane example, which
  turns borders off on tmux 3.8
why: This branch deprecates libtmux.common.has_gte_version, which reads
the client executable, and the suite turns DeprecationWarning into an
error. The run_shell tests in tests/test_formats.py still called it,
so they failed.

what:
- Check the release with is_at_least(server_version(server), ...),
  the replacement the deprecation message names
- Bind server before the 3.5 skip in test_run_shell_cwd
why: Commands cache the daemon's release under the -L/-S flag and its
value apart, while _version_endpoint() passed _socket_args()'s joined
form ("-Lname"). The cache keeps one entry, so each path evicted the
other and a version check between two commands probed the daemon again
(four probes where one was intended).

what:
- Split _socket_args()'s selectors into flag and value in
  _version_endpoint()
why: The module called has_gte_version(), which this branch deprecates
and the suite turns into an error, so the file failed at collection on
every tmux.

what:
- Check is_at_least(server_version(server), ...) inside each test and in
  shown(), which now takes the server
- Replace the module-level skipif with a skip in the test body
why: The compatibility page moved to the top of the docs, so the entry's
link to project/compatibility failed the docs build with an unknown
document.

what:
- Link {doc}`/compatibility`
why: master has required tmux 3.3a since 0.65.0 (#888), so the entry's
"Minimum tmux>=3.3a (was >=3.2a)" no longer describes what this branch
changes: it checks the running server's release instead of the tmux
executable's.

what:
- Retitle the #779 Breaking changes entry and drop the "was >=3.2a"
  sentence
…ease

why: Master's run_shell refusal (#918) reads the capability through
has_gte_version with tmux_bin, which asks the tmux executable. This
branch removes that import from server.py and checks every gate
against the server's release, so the call raised NameError and, with
the import restored, would have read the wrong tmux. Its Raises entry
also became ambiguous here, since this branch re-exports VersionTooLow
from libtmux._internal.support.

what:
- Use Server._has_gte_version for the run-shell-output-in-copy-mode
  check, like the other run_shell gates
- Name libtmux.exc.VersionTooLow by its dotted path in the Raises
  section so the docs resolve one target
why: Master's v0.70.0 adds strict ty and Ruff ANN typing, per-command
deadlines, launch-error normalization, and runnable changelog doctests
that the version probe and legacy helpers must honour.

what:
- Propagate active command deadlines and OS launch errors through
  versions._run with non-blocking post-kill pipe cleanup
- Accept generic lookup targets in QueryList.filter so Server traversal
  still reaches keygetter
- Type _internal/version.py, VersionCache state hooks, and version test
  doubles without Any or type-ignore comments
- Update options_and_hooks, Client.request_clipboard Raises, and CHANGES
  for v0.70.0 doctest and Sphinx checks
@tony
tony force-pushed the bump-min-tmux-000 branch from 60dacae to f262b36 Compare November 29, 2026 03:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tmux-versions tmux version support, feature gates, new tmux tokens behavior-change Fixes a bug by changing observable or documented behaviour; needs a minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify connected tmux daemon meets the 3.3a minimum before dispatch

1 participant