The core provides domain actions and managed execution. Pure tests, packed public examples and owned real-tmux checks qualify implemented behavior. WRITING.md governs prose, comments, and commits.
Setup
Use mise with the ranges in .tool-versions: Erlang/OTP
29.x and Elixir 1.20.x. The Mix project requires at least Elixir 1.20.4.
Linux builds also require a C11 compiler and Linux headers for the owned
I/O helper. No NIF or third-party runtime package is required. CC may name
one compiler executable. Install prerequisites before timing checks:
$ mise install
To install newer releases within those ranges without editing the file:
$ mise upgrade erlang elixir
With mise active in your shell, verify that Elixir runs on OTP 29 and was
compiled for OTP 29:
$ elixir --version
Mise selects the newest OTP build for an Elixir prefix; the prefix does not
lock the OTP suffix. If a future 1.20 patch adds a newer OTP build, select
its exact 1.20.x-otp-29 version. asdf requires exact versions and cannot
consume these floating ranges directly.
CI reads both ranges from .tool-versions and passes them to setup-beam
in loose mode, which selects the Elixir build for the installed OTP major.
The action's direct version-file mode requires exact versions.
The native Linux matrix reads the tmux releases and the reference
Elixir/OTP pair from priv/tmux/support.json. It also tests the resolved
.tool-versions pair with the newest listed tmux release. Every cell checks
the actual OTP patch, Elixir version and compiled OTP major before testing.
Missing prerequisites fail the cell. Required Linux checks succeeds only
when the plan, the core checks and every native cell succeed; no macOS job is
required.
A push and a pull request plan only the oldest and newest listed tmux release
(3.3 and 3.8). A release and a dispatch with scope=full plan every listed
release. See "Running CI against any tmux" below for the rest of the dispatch
inputs.
Hex is required only for package archive checks. Install it separately from the check loops if it is missing:
$ mix local.hex --force
The core has no third-party runtime dependencies. ExDoc is a development-only dependency; install it before timing documentation checks:
$ mix deps.get
tmux is not needed for pure unit or packed-core checks. The
implementation floor is tmux 3.3, and support must be proved against that
version rather than inferred from a newer local binary.
Running CI against any tmux
A plan job runs scripts/ci_plan on
priv/tmux/support.json and decides the native cells, so the workflow lists no
version. The shared
build-tmux action
builds each cell's tmux. The first and last
required_linux entries are the edges. The release workflow runs the full
scope before it publishes anything.
Run the Core checks workflow on any branch, against any tmux version, tag,
branch or full commit of github.com/tmux/tmux. Put the comma-separated list in
tmux-ref, with scope=custom:
$ gh workflow run scaffold.yml \
--ref my-branch \
-f scope=custom \
-f tmux-ref=3.6b,master
The action builds a release the manifest lists from its checksummed archive and requires it to report that version. It resolves any other ref to a commit and builds that, whatever version it reports. Each ref runs on the reference Elixir/OTP pair.
Name other Elixir or OTP versions with elixir and otp; they replace the
reference and tracking pairs, multiply with the refs, and run
scripts/check_runtime/check_runtime.exs custom, which prints the runtime identity and
asserts nothing. The os input picks the Ubuntu image of the native cells.
The tmate input opens a tmate
session on exactly one native cell, before the tests or after a failure. The
session admits only the GitHub account that dispatched the run and ends after
30 minutes. The plan refuses it when the run has more than one cell:
$ gh workflow run scaffold.yml \
--ref my-branch \
-f scope=custom \
-f tmux-ref=master \
-f elixir=1.19.5 \
-f otp=28.3 \
-f tmate=on-failure
Run every cell a release runs, without tagging:
$ gh workflow run scaffold.yml \
--ref my-branch \
-f scope=full
Dispatch runs do not cancel one another or the push run of the same branch.
Current checks
Check that the active runtime matches the development selectors, minimum versions and compiled OTP major:
$ time elixir scripts/check_runtime/check_runtime.exs tracking
Use reference instead of tracking to require the exact reference pair.
Check formatting after an edit:
$ time mix format --check-formatted
Before handing off a change, validate the Mix project with warnings treated as errors:
$ time mix compile --warnings-as-errors
Check public function specs and type documentation against the compiled API. The check also fails when a public type, spec or callback names a private type, because the generated reference cannot link it:
$ time mix run scripts/check_public_contracts.exs
Compile the consumer fixtures and check the expected Elixir 1.20 diagnostics:
$ time mix run scripts/check_consumer_types.exs
Typespecs document contracts; the compiler infers types from implementation patterns and guards. These fixtures verify selected valid and invalid uses, not arbitrary criteria or every value-dependent return type. The integer codec fixture requires a warning; the action-value fixture records a case inference does not currently reject. Match outcomes and validate values at runtime. Neither a declaration count nor a silent compiler proves every contract.
With dependencies already installed, render the public reference and guides:
$ time mix docs --warnings-as-errors
Check rendered local files and HTML fragments without network requests:
$ time elixir scripts/check_docs_links/check_docs_links.exs
The link check reports ExDoc's optional host-provided version catalogue separately. It does not verify external websites or publication.
Set DOCS_SOURCE_REF to the reviewed commit, branch or release tag when building
documentation for that revision. ExDoc uses main by default. Rendered copies
resolve source-file and artwork-directory links without changing the originals.
With Hex already installed, build the local archive:
$ time mix hex.build
Run critical pure tests in the inner loop, or all unit tests in the mid loop:
$ time mix test
Check generated field, operator and relation documentation after schema changes:
$ time mix run scripts/generate_schema.exs --check
Regenerate it with mix run scripts/generate_schema.exs before the check.
The default suite excludes the integration tag. Linux integration fixtures
need an explicit tmux executable or tmux on PATH. The fixture starts its server
with LibTmux.Server.start/1, in a private directory, and stops it with
LibTmux.Server.stop/2. It never starts the default server. The BEAM cannot
hold a pidfd, so a test names a process by its start time and waits for that
exact process with a short bounded poll
(LibTmux.Test.Processes); it adds no fixed readiness sleep.
Run the real fixture checks in the outer loop with the exact tmux binary being qualified:
$ LIBTMUX_TMUX=/path/to/tmux mix test --include integration
CI runs the complete existing suite with two ExUnit cases at once and two BEAM schedulers to fit the Linux runner. The native tests still exercise their explicit concurrent fault schedules. Source download, prerequisites and tmux compilation run before the timed test step. These cells qualify implemented cases; they do not establish unimplemented API support.
Check packed-core consumption and metadata outside the checkout:
$ time mix run scripts/check_package.exs
Real checks round-trip command and format syntax with hostile bytes. The field encoder protects backslashes and control bytes before tmux prints them; the conservative decoder handles one free-form field, and snapshot capture uses versioned rows of individually escaped fields. Neither assumes raw separator bytes cannot occur in values. The pure control parser enforces byte/event limits, but transport receive bounds and shared lane safety need separate qualification.
The ownership guide describes the one-shot helper, resource ceilings and remaining distribution gates.
These gates exercise implemented core behavior and fixture ownership. They
do not establish compatibility for unexercised operations. Do not add empty source or tests to make a command
appear useful. Public task programs are shipped in examples/. Check their
displayed copies with elixir scripts/check_example_docs/check_example_docs.exs, then run
MIX_ENV=test mix run scripts/check_package.exs --examples outside inner/mid
loops. The package check executes the extracted programs outside the checkout
and verifies native teardown, including a failed caller.
Check budgets
Time the entire command, including startup and setup. Record duration and scope in the pull request. Tool installation happens before a timed loop.
| Loop | Budget | Stretch | Scope |
|---|---|---|---|
| Inner | Under 5 seconds | Under 2 seconds | Formatting or critical tests for the edited code |
| Mid | Under 30 seconds | Under 10 seconds | Unit suites, lint, and generated-file checks |
| Outer | Under 5 minutes | Under 60 seconds | Compilation, packaging, docs, and integration matrices |
Formatting and changed pure tests belong in the inner loop; the complete unit suite belongs in the mid loop. Compilation, packaging and real tmux fixtures and documentation rendering belong in the outer loop. Dependency installation stays outside all check loops. Do not run network operations, installs, builds, browsers, sleeps, or broad corpus scans in the inner or mid loop.
Investigate waits longer than one second; use events and subscriptions for readiness instead of fixed sleeps. Slow tests need an outer-loop tag and a one-line reason. Fix redundant setup, polling, and slow paths before adding tests to an over-budget loop. Benchmarks are separate: each run stays under 10 minutes, and a full sweep stays under one hour.
Adding implementation
Add tests for critical behavior and regressions, not copies of the implementation. A regression test must fail for the intended reason before its passing result becomes evidence. Prefer pure ExUnit tests for parsing, encoding, and selection; exercise protocol and resource ownership against real tmux as well.
mix test starts in test_helper.exs, which
removes TMUX, TMUX_PANE and every LIBTMUX_SOCKET* variable from the
process, sets TMUX_TMPDIR to a fresh owner-only directory short enough for
a socket, and refuses to run when it cannot. A Server with no socket, or a
bare tmux, therefore reaches no server of yours. A server still answering
in that directory when the suite ends fails the run and keeps the directory.
Commands outside mix test, such as the packed examples, are not covered:
give them a socket of your own, for example LIBTMUX_SOCKET_PATH in an
uncommitted .env that your shell loads.
Every tmux fixture uses a unique, owned socket and temporary directory.
Clear inherited TMUX and TMUX_PANE. Never connect tests to the default
server, and only stop servers or remove files owned by that run. Use
bounded, event-based readiness and verify cleanup on success and failure.
Use ExUnit supervision for BEAM children and explicit teardown for owned OS processes. A successful teardown call is not proof that a child exited. Enable asynchronous tests only when sockets, state, and cleanup are isolated. Distinguish protocol acknowledgement from operation completion in assertions.
Each support claim needs its own required CI cell. The tmux floor must run
against tmux 3.3 itself; 3.3a is a separate compatibility case. Platform
and transport coverage remain unverified until implementation exercises
them. Missing prerequisites in a required cell fail that cell; report
optional skips explicitly.
Pull requests
Keep changes on a topic branch in a separate worktree. Preserve unrelated edits and keep each PR focused on one reviewable change. Follow the commit format in WRITING.md.
Describe the problem, resulting behavior, and relevant validation. Report passing, failing, skipped, and unverified checks separately. Scope claims to what the checks actually exercise; declaration validation cannot establish runtime compatibility, performance, or release readiness.
Publication
Pushing a v<version> tag runs the required Linux checks at that revision,
then submits the core package and its documentation to public Hex. The
tag must match the root Mix version. The job uses Hex Workload Identity in
the hex GitHub environment. With Hex 2.7 or later, mix hex.publish --yes
prints the approval link and expiry when Hex stages a release. The job
succeeds once Hex accepts both uploads. Approve the staged release on Hex
when ready.
Creating a release tag requires separate authorization.
Releases are numbered 0.1.N: 0.1.0, then 0.1.1, 0.1.2 and so on, with
no -alpha or other prerelease tag unless the maintainer asks for one.
After approval, verify the published version from its tagged checkout.
For v0.1.2, wait up to 60 seconds for the versioned HexDocs page, then
install and run that package version in isolation.
$ elixir scripts/wait_for_hexdocs/wait_for_hexdocs.exs \
https://hexdocs.pm/libtmux/0.1.2/
$ elixir scripts/check_hex_install.exs 0.1.2
The core keeps a CHANGELOG.md that its files list ships.
scripts/check_release/check_release.exs refuses a release while it is
missing, opens with another package's name, lacks an ## Unreleased heading
or is not matched by files, and
scripts/check_release/tests/check_release_test.exs runs it against a broken
copy of the tree for each case. WRITING.md says which file an entry
goes in.