Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 5.62 KB

REVIEW.md

File metadata and controls

49 lines (33 loc) · 5.62 KB

Code and architecture review (tmux-python/libtmux)

Posture: experimental (pre-1.0 typed Python API over tmux; align observable semantics and terminology with libtmux ports).

Posture defines experimental, stable and private.

Review the complete change against <base>, including untracked files. Report all findings in one pass without editing files. Writing conventions · Contributing gates · AI policy.

1. Layer ownership

Layer Modules Owns Must not own
Domain hierarchy server.py, session.py, window.py, pane.py, client.py, options.py, hooks.py, neo.py Object identity, target formatting, tmux option/hook/pane operations, lenient list accessors (Server.sessions), and refresh invariants CLI presentation (tmuxp config schemas) or MCP tool schemas (libtmux-mcp)
Query and format schema formats.py, _internal/query_list.py, _internal/dataclasses.py Format-string constants, QueryList filtering, and lookup predicates (filter, get) Subprocess spawning or tmux daemon lifecycle
Transport and wire common.py, _internal/env.py, _internal/control_mode.py cmd() execution, environment scrubbing, tmux version parsing, and -C control-mode client lifecycle Hardcoded caller workflows or silent sleep() retries
Test fixtures and helpers pytest_plugin.py, test/* Isolated tmux -L <socket> -f /dev/null server, session, window, and pane lifecycles Leaking sockets or mutating the user's live tmux server

Changing the map

Do not BLOCK against <base>:REVIEW.md's prior owner row when a pull request migrates an invariant cleanly to a single owner, updates callers, tests, and REVIEW.md in the same diff, and states the old and new owner in the pull request description.

Adapters and format leaks

  • Adapter versus duplicated rule: Boundary modules (pytest_plugin.py, neo.py, downstream CLI or MCP adapters) translate fixtures, dataclasses, and presentation. Block when an outer caller re-implements tmux target resolution, version parsing, or option coercion that Server, Session, Window, Pane, or options.py already owns, or imports cross-package _internal symbols.
  • Zero-import format leaks: Check dependency direction even when imports stay clean. Block core modules (server.py, session.py, window.py, pane.py, common.py) that parse test-framework or snapshot container formats (.ambr), branch on PYTEST_CURRENT_TEST, or store test-only fields on domain objects.

Rejected here

  • Caller-side tmux subprocesses in tmuxp or libtmux-mcp: Extend Server, Session, Window, or Pane in libtmux when downstream tools need a tmux capability.
  • Timing sleep() loops in tests or lifecycle helpers: Query tmux state or wait on deterministic format or channel readiness instead of sleeping.
  • Asymmetric behavior across new_* and attach or lookup paths: Check sibling methods across Server, Session, Window, and Pane whenever target resolution, environment handling, or option parsing changes.
  • Silent partial multi-step state: When an operation spans multiple tmux commands (create session or window, then set options, layout, or environment), check what tmux server state already persisted if step N fails and ensure callers can observe or recover it before retrying.
  • Unpinned tmux version workarounds: Track version-specific tmux server quirks in .github/workarounds.toml (issue_only = true with reason_no_lock and an upstream tmux/tmux issue URL, or a package predicate) verified by the shared check-workarounds action in CI.

2. Regression baseline and decision

  1. For bug fixes and behavioral changes, reproduce the failure on <base> (or on <pre_fix_head> when fixing a defect introduced earlier in the same open pull request) against an isolated tmux -L test server, and record the tmux -V version tested.
  2. Verify the production-only revert check fails the new test inside the real owner call (for behavioral changes), then run uv run ruff check . .github/scripts, uv run ruff format . .github/scripts --check, uv run ty check, uv run pytest, and the shared libtmux/.github/actions/check-workarounds action, which CI runs.
  3. Emit BLOCK or NO FINDINGS (plus optional non-blocking NOTE items). Before emitting BLOCK on placement, state the strongest boundary-adapter or ownership-transfer counter-case and why it fails, and name a concrete test, command, or code observation that would prove the finding wrong.

3. Verdict

These rules decide which findings block.

  • Base run: A finding that code misbehaves shows its check run on <base> and on the change, with one line of output from each.
  • Existing and separate: Behavior <base> already has does not block. Report it as a NOTE, unless the change adds a promise the behavior breaks; then the broken promise is the finding.
  • Unverified: A gate nobody ran is unverified. Name the command that would run it. It holds the merge until someone runs it, and it does not make the verdict BLOCK.
  • Behavior defects: A behavior defect blocks when a caller can reach it in a supported environment, or when it breaks a promise in the pull request description, a docstring, help text or the changelog. Otherwise it is a NOTE.
  • Checks and claims: A weakened check, a rule written in a second place and a behavior claimed as tested with no test that bites block whether or not a caller reaches them.