Skip to content

Add tmux version detection and a capture-format drift guard#282

Merged
andyrewlee merged 1 commit into
mainfrom
tmux-version-detection
Jun 8, 2026
Merged

Add tmux version detection and a capture-format drift guard#282
andyrewlee merged 1 commit into
mainfrom
tmux-version-detection

Conversation

@andyrewlee

Copy link
Copy Markdown
Owner

Close-the-loop stack — PR 11/12

Problem

There was no tmux version or capability detection anywhere in the codebase, so version-variant tmux output degraded silently. The pane-mode snapshot capture lists a fixed set of format fields; if a tmux version renames/reorders them, parsePaneModeState quietly returns HasState:false — a snapshot that always looks like "no mode state," with nothing pointing at the version mismatch.

Change

  • internal/tmux/version.go: ServerVersion() (parses tmux -V), ParseTmuxVersion, and TmuxVersion.AtLeast for capability comparisons.
  • Table-driven unit tests across 3.2a / 3.6a / 3.10 / next-3.5 / garbage.
  • A real-tmux format-drift guard: capture a live pane and assert the mode state parses (HasState), failing loudly with the detected version if the hardcoded format ever drifts.

Test

All pass 2/2 locally vs tmux 3.6a (unit tests are pure; the guard + sanity test use real tmux). Runs under PR 5's version matrix, so the format guard is checked on both 3.2a and 3.6a.

🤖 Generated with Claude Code

@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from 79049bc to f2baf94 Compare June 8, 2026 02:26
@andyrewlee andyrewlee force-pushed the harness-assert-nonblank branch from 3ca87ff to ebc1990 Compare June 8, 2026 02:26
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from f2baf94 to eb748fe Compare June 8, 2026 02:30
@andyrewlee andyrewlee force-pushed the harness-assert-nonblank branch 2 times, most recently from c4b2262 to fcf1910 Compare June 8, 2026 02:39
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from eb748fe to 2e4fb8a Compare June 8, 2026 02:39
@andyrewlee andyrewlee force-pushed the harness-assert-nonblank branch from fcf1910 to f09babd Compare June 8, 2026 02:42
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from 2e4fb8a to aa9c340 Compare June 8, 2026 02:42
@andyrewlee andyrewlee force-pushed the harness-assert-nonblank branch from f09babd to 6b16c61 Compare June 8, 2026 02:45
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from aa9c340 to 022ca0b Compare June 8, 2026 02:45
@andyrewlee andyrewlee force-pushed the harness-assert-nonblank branch from 6b16c61 to d6cf1a5 Compare June 8, 2026 02:50
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from 022ca0b to a7dab8a Compare June 8, 2026 02:50
@andyrewlee andyrewlee force-pushed the harness-assert-nonblank branch from d6cf1a5 to b49300e Compare June 8, 2026 02:58
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch 2 times, most recently from 89e338c to 695663d Compare June 8, 2026 03:02
@andyrewlee andyrewlee force-pushed the harness-assert-nonblank branch 2 times, most recently from 069fe07 to ba11a30 Compare June 8, 2026 03:05
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from 695663d to 428c742 Compare June 8, 2026 03:05
There was no tmux version or capability detection anywhere in the
codebase, so version-variant tmux output degraded silently. The pane-mode
snapshot capture in particular lists a fixed set of format fields and, if
a tmux version renames or reorders them, parsePaneModeState quietly
returns HasState:false — a snapshot that always looks "no mode state"
with nothing pointing at the version mismatch.

Add internal/tmux/version.go: ServerVersion() (parsing `tmux -V`),
ParseTmuxVersion, and TmuxVersion.AtLeast for capability comparisons,
with table-driven unit tests covering version parsing and comparison
across 3.2a/3.6a/3.10/next-builds/garbage.

Add a real-tmux guard test that captures a live pane and asserts the
mode state parses (HasState), failing loudly with the detected version if
the hardcoded format ever drifts — turning silent degradation into a
diagnosable failure.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from 428c742 to 5bca605 Compare June 8, 2026 03:08
@andyrewlee andyrewlee changed the base branch from harness-assert-nonblank to main June 8, 2026 03:08
@andyrewlee andyrewlee merged commit d93f921 into main Jun 8, 2026
10 checks passed
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