Testing

Every script resolves against $_HI_ROOT, this checkout under any name, and the runner derives it from its own path, with _HI_HOME its parent, so a fresh clone needs no setup. With a second say-hi tree on the machine (an install beside a dev checkout), set it on every invocation: a shell that sourced an install exports the whole _HI_* set at paths that exist, and a suite run against the wrong tree reports fewer cases rather than failing.

export _HI_HOME=/path/to/parent-of-say-hi
tests/test_runner.sh

Contents

Running the tests

tests/test_runner.sh times each suite and prints a colored pass/fail summary:

tests/test_runner.sh                    # every suite
tests/test_runner.sh aliases shellcheck # just the named suite(s)
tests/test_runner.sh --group fast       # what CI runs on every platform
tests/test_runner.sh --group fast,ci    # ...plus the ci group, as ubuntu runs it
tests/test_runner.sh --group fast --shard 1/2 # half of it, as a CI shard runs
tests/test_runner.sh --host-report      # ...prefixed with what this machine is
tests/test_runner.sh --verbose          # every transcript, nothing collapsed
  • ci is the checks a second platform could only repeat - the workflows and manifests read as text, and the release tooling only Ubuntu runs (packaging_ci and its four parts, files of their own beside packaging’s portable half, and test_runner_ci, runner_test.sh’s ci part). Ubuntu’s fast job runs it; release.yml runs it against the bumped manifests.
  • A passing suite’s transcript collapses to one status line; failures replay in full and are recapped under the summary table. --verbose (_HI_VERBOSE=1) streams every transcript live, for a case that fails only under the runner.
  • A case that takes a second or more is noted with its time, and the ten slowest of a run are listed under the summary as Slowest cases, each under its suite: a suite’s time alone does not say which case spent it.
  • A failed case is run once more under set -x - once, never more. A second failure is FAILED, with the last lines of that trace under it: the comparison that failed, with its values, so a case with no message of its own still names its cause. A pass the second time is FLAKY, and a sign the case needs making sturdier. On Windows (WSL included), the BSDs, and arm64 (macOS included) it is not counted as a failure - it is listed under Flaky cases at the end of the run, a GitHub warning on CI. On native Linux x64, the least loaded platform, a flake is a failure like any other (_HI_FLAKY_OK=1/0 overrides either way). A failure that took over 30s is rerun too, for its trace alone - it is FAILED whatever the rerun does, never FLAKY - and ended once it has had that time again and half a minute, with the trace it got to: where a hung case stands. Only the coverage sweeps go without (_HI_TRACE_RERUN=0, their tracers owning xtrace), and say which job traces the case. None of it costs a passing case more than the mkdir of its directory.
  • Each try of a case - the first and its rerun - runs in a new, empty $_HI_WORKDIR, so a rerun never starts over the file, link, or fixture its first try left, and a flake can pass it. What a suite builds once for its cases to read - in its setup, or a cache like _hi_fake_path’s - goes in $_HI_SUITE_WORKDIR; a path a registration line expands is the suite’s, never the case’s. _HI_RERUN_CHECK=1 runs every passing case a second time and fails one that cannot pass it - one that changed $HOME, the tree, or anything else outside its directory - at about twice a run’s time.
  • A case says why it failed on its first failure, so a flake has a reason too and nothing waits on the rerun: _hi_because "<what was wrong>" on the failing arm, or _hi_why <variable>... where the assertion says it all - that prints the statement, read off the suite’s file, and each variable’s value (_hi_why -N adds the N lines above, for a bare return 1). Both run only once the assertion has failed. A case whose claim is one command’s output, words, out-var or refusal says so with _hi_prints, _hi_says, _hi_var_is or _hi_refused, which report for it. Every failing arm of a case ends in one of these, and the lint group’s drift suite reads each test_* function for one that does not: a return 1 with nothing printed in or just above it, or a bare assertion as the last statement. It fails an assertion that compares a command substitution too ([ "$(cmd)" = want ]): _hi_why prints the statement and its variables, so the value goes into one first (got="$(cmd)"), and the reason has it.
  • An end-to-end case that fails prints the end of its session’s transcript and, where it is about sessions or trees, what the target held: its trees and their claims, its multiplexers’ sessions, its processes (_hi_show_transcript, _hi_show_target). A failure line with neither beside it is a bug in the suite, and drift fails a function of tests/targets/ that prints one alone. Where a flake may pass, an output probe line comes ahead of the rerun: how many of 20 captures came back short from a subshell, a child bash, and a process substitution, and from a child bash writing a file, with the runtime’s version and the load.
  • Suites running side by side replay only once the last one finishes, so a progress line fills the wait (finished suites, cases, failures, elapsed, what is still running, and the case each is in): redrawn in place at a terminal, a line per finished suite plus a 30s heartbeat on CI. _HI_PROGRESS=0/1 overrides.
  • A suite that neither starts nor finishes a case for ten minutes is ended, with what it started, and reported FAILED (hung) with that case named in the recap and its processes listed - the tree under the suite and its group, each with its terminal, state and wait channel where ps -o has them, so a shell stopped by a signal (T, with a terminal) tells from one waiting on a pipe; the other suites carry on. _HI_SUITE_STALL=<seconds> moves the limit, and 0 lifts it. Suites that run one at a time (e2e, backends, bench) are watched only where it is set, since a case there may build an image.
  • _HI_RUN_DEADLINE=<seconds> ends the whole run that long after it started: each suite still running is reported FAILED (deadline) the same way, and each not yet started as never run. Every CI step that runs the suites sets it under its job’s limit (ci.yml’s jobs three minutes under, a job that runs the suites more than once or through a VM wrapper under that run’s or wrapper’s own share), since a job its limit ends keeps no log of what it was doing.
  • The machine is sampled every two seconds while suites run, and the run ends with a Machine use section: CPU busy (average, 90th percentile, peak), memory in use at its peak, and CPU busy by how many suites were running at once - low CPU with every slot full says a wider run (_HI_RUNNER_WIDTH) or another shard has room. Under GitHub Actions the same table goes to the job’s summary page. _HI_USAGE=0 turns it off, _HI_USAGE_STEP=<seconds> moves the interval.
  • The e2e and backends groups run one suite at a time, since they share one container daemon; _HI_E2E_WIDTH=<n> runs n at once, as ci.yml’s e2e shards do with 2. Each suite’s containers, ports, and names are its own.
  • A suite whose backend is missing reports SKIPPED, never green; so does a single case (an image that would not build, a tool not installed). --require-run (CI’s lint, e2e, and backends jobs pass it) turns both into failures: the suite goes red, its transcript replays, and each stood-down case is named in the recap.
  • --host-report (_HI_HOST_REPORT=1) prints one block before the first suite: bash, OS, CPU and memory, userland (GNU/BSD/busybox), the locale’s glyph verdict, which tree $_HI_HOME resolves to, which backends answer, and tool versions. Every ci.yml job but the lint runs passes it. The tree half prints on every run when the tree under test is not the one the runner was invoked from — the quietest way to get a wrong result here.
  • Every test script also runs directly, e.g. tests/lint/shellcheck_test.sh.
  • Under a wrapper that leaves a controlling terminal but a background process group (timeout from a prompt, a wsl.exe session), run setsid -w timeout … tests/test_runner.sh … — setsid outside, so timeout still kills the runner’s group. Without it the interactive sessions the load and install_location suites start stop on SIGTTIN until the deadline. GitHub’s ubuntu runner has no controlling terminal. The BSDs stop one without any terminal: there tcgetpgrp on a pipe answers 0, so an interactive bash whose stderr is a pipe takes it for a foreign terminal (SYNTAX.md); a hung case’s process table shows it as state T with no terminal.
  • Under WSL 2, drop the /mnt/ entries from $PATH first: interop’s ~50 /mnt/c/... directories are served over 9p, and the package check’s uncached command -v misses make one full_check take 30–37s instead of 30ms - half a minute a check, when the pty cases’ deadline was 30s. windows-e2e.yml’s wsl-suites job does this and has the measurements.

Six groups (--group <name>, or a comma list; --list prints the membership) - ci above, and:

  • fast — dependency-free unit suites, the first thing every CI platform job runs; test_lib, test_lib_report, test_lib_par, and test_runner are the harness testing itself. Suites run side by side (one per CPU), each with its own workdir and tally files, transcripts replayed in table order, so the run reads like a serial one and takes about as long as its slowest suite. _HI_RUNNER_WIDTH=1 runs one at a time, as --verbose does. --shard <i>/<n> keeps every n-th suite of the selection from the i-th on, to split a group across runners: windows-client.yml runs fast as four slices (1/4 to 4/4) on each of x64 and arm64, eight checks of their own (backgrounded suites barely overlap under MSYS, so only more machines shorten it), and ci.yml shards e2e and backends.
  • lint — the lint gate: its own ubuntu CI job, beside fast’s; the macOS, Windows, and BSD jobs run fast alone, since linting text does not depend on the userland. Run npm ci --prefix .github first, or its two Markdown checks skip.
  • bench — hot-path timings against ceilings, plus the payload’s two size budgets.
  • e2e — ssh, ssh_disconnect, ssh_relay, ssh_wire, install_methods, repo, docker, framework, home_prompt, ssh_keep: throwaway containers driving hi.sh’s real connection path (_say_hi). ssh_wire counts one session’s bytes through a ProxyCommand and checks them against the figure hi prints on its connect line. ssh_keep holds a kept session in tmux, in screen, and in zellij (alpine’s package) through a dropped link and a reattach, hi --end, its timeout, a hi --keep typed inside a session, the multiplexer’s own name typed bare there, a second pane, a session killed outright, and a link cut at a terminal with the session left or lost, and on a target with none of the three holds a dropped session’s tree for the retry and removes it at its window’s end, and removes the tree of an ordinary session killed with no exit hook run, by its watcher and by the next connect, reading each answer off the target rather than the multiplexer’s redrawn transcript. Two are not about sessions: repo builds the package repository with throwaway keys and installs from it as apt, dnf, and apk clients, signatures verified, and home_prompt installs hi over each distro’s stock /etc/skel rc to check which prompt wins at home.
  • backends — podman, nerdctl, nomad, kube: split from e2e because they need extra runner setup.

bench always runs one suite at a time, since it measures; e2e and backends do too unless _HI_E2E_WIDTH is set, since they contend on one container daemon.

A case stands down through two guards: _hi_check_requires <bin> when a command is missing, _hi_check_capable <capability> when a facility is — something command -v cannot answer (_hi_par_check_capable is the parallel twin for a fast case; an e2e case asks _hi_capable directly and skips inline). The roster is _hi_capable in tests/lib/fixtures.sh:

Capability How it answers Why it can be no
symlink probe: makes one, tests [ -L ] a filesystem that refuses or silently copies reads as no
pty probe: python3 can import pty no pty layer to drive an interactive case with
mkdir_mode probe: a mkdir -m whose mode lands a Windows-owned temp tree makes the directory and refuses the chmod
gpg_agent probe: an agent in a throwaway homedir Git for Windows ships gpg with no agent it can start
lockout probe: writes into a chmod 555 dir root bypasses the bits, so the write succeeds
fork_concurrency uname (MSYS/Cygwin) background subshells have to genuinely overlap
mode_bits uname (MSYS/Cygwin) a reported permission string has to reflect chmod’s own bits
netem /proc/modules or /sys/module modprobe sch_netem has not run on the host; a container can’t
applet_shims probe: sh runs a shim on PATH a busybox sh runs its own applet over a PATH entry of that name

The starved case in the ssh e2e suite is the one that asks for netem: it shapes a container’s own link with tc qdisc … netem, which needs the module loaded on the host kernel, not just present in it. ci.yml’s e2e job loads it in its setup step, so the capability gate mainly matters on a local or dev machine that hasn’t modprobe‘d it.

Where a suite lives

tests/<the directory it tests>/. tests/common/, tests/config/, tests/scripts/, and tests/packaging/ mirror the tree; tests/hi/ and tests/load/ cover the two root scripts; tests/lint/ is the lint gate, tests/bench/ the timings, tests/targets/ the container/ssh e2e suites, and tests/harness/ the suites that test the harness. The harness itself is tests/test_lib.sh, a façade over tests/lib/; a suite sources the façade and nothing else (HI.34).

The container suites run their cases in parallel

ssh, ssh_relay, ssh_keep, install_methods, docker, podman, nerdctl, framework, and kube spend nearly all their wall clock waiting on containers, so their cases run in batches: _hi_par_case (tests/lib/parallel.sh) submits a case to a background subshell, _hi_par_wait collects the batch. Each case writes its verdict to a file the parent tallies, registers what it started on a teardown ledger the exit trap sweeps, and buffers its output to replay in submission order. Cases that read another case’s files stay serial.

A batch is capped at four, or the CPU count if smaller — unbounded fan-out thrashes the docker daemon on a laptop. A suite whose cases are plain local processes (configure’s pty runs, install_location’s shells, the harness suites’ nested runners) sets _HI_PAR_LOCAL=1 and gets the whole CPU count. _HI_PAR_WIDTH overrides both; nomad pins itself to 1, since its single-node dev agent gains nothing from two cases at once. A case still running after _HI_PAR_CASE_LIMIT seconds (300; 0 for none) is stopped with its process tree printed into its transcript, and fails; the rest of the batch replays as usual.

_HI_PAR_WIDTH=1 tests/test_runner.sh ssh   # serial, same code path - for bisecting a flake
_HI_PAR_WIDTH=8 tests/test_runner.sh ssh   # a big machine, if the daemon can take it

The pty-driven cases (configure_pty, install_run) kill a child that has written nothing to its transcript for 60s, or has run five times that, and count it a failure: a slow host still drawing is not a wedge. A killed case prints the host’s load and the last lines it drew. rc_lines’ one pty case keeps a plain 60s. _HI_CASE_TIMEOUT raises the deadline on a host slow for reasons the suites cannot fix, as _HI_SSH_CASE_TIMEOUT (90s) does for the ssh cases. The login shells _hi_login_env starts (install_location’s dialect pass) are bounded the same way at 180s by _HI_LOGIN_TIMEOUT: unbounded, one that wedges shows only as a case count that stops moving, for as long as the job allows.

The install-method suite

install_methods is ssh’s sibling: ssh runs one install against every login shell; install_methods runs one login shell against every way say-hi gets onto a machine — the .deb, .rpm, .apk, a Homebrew-shaped keg, a system-wide install.sh --prefix, and a packaged tree with its /etc/profile.d announcement removed. They share the case runner in tests/lib/ssh.sh.

hi ships its payload to every ssh target and never reads a say-hi already there, so every case asserts the same two things: the session runs out of its own tree ($_HI_ROOT is not the installed path), and the installed tree is still whole once the session is gone. One case more makes no session: the rc block hi --install --print-rc hands out, in the keg box’s ~/.bashrc, loads hi in that box’s own shell before and after what brew upgrade does to the keg.

The three package cases build what they install with packaging/mkpkg.sh, so they need nfpm; without it they stand down yellow per case, which --require-run catches. ci.yml’s e2e job installs the pinned nfpm so they run.

Coverage and profiling

bashcov (tests/coverage_v2.sh) runs over the full suite sweep — every suite the box’s backends can host — by hand or by coverage.yml: after every green CI run on a push to main, and on every same-repo, non-draft PR into main, where the gather-bashcov job posts its figure beside main’s in one comment edited in place, with the PR’s passed-case count from its CI run beside main’s (the push that merges the PR reuses its figure). The figure is for finding untested arms. Never a gate: 90% is the target for new code, and the PR comment flags a PR whose figure falls below it without failing anything. The sweep pins _HI_PAR_WIDTH=1, since a batch writing into a suite’s one trace stream side by side loses lines, and puts a bash-as-sh link first on its own PATH: bashcov does not follow a dash child, so a #!/bin/sh file a suite executes as sh … (common/targets.sh, common/mux.sh) would read 0% where /bin/sh is dash.

It reports one subject: every tracked *.sh file outside tests/ (its scratch/ included), docs/ and .github/ (_HI_COV_NOT_SUBJECT in tests/lib/coverage.sh), a file no suite loads included, at 0%. The sweep leaves its worst-first ranking as files in its outdir and its unrun lines as missed, and tests/coverage_v2.sh --untested <revision> lists the lines changed since that revision that are on missed, less the ones xtrace never prints: a line that only closes a block with a redirect (done <file), an empty case arm, the rest of a command the line above continues with a \, and an array assignment’s lines above the one that closes it. gather-bashcov puts those lines, for the PR’s diff, in the comment. The test_runner_ci suite runs --untested and tests/coverage_v2.sh --merge over fixtures.

In CI the sweep is sharded (--shard i/n, which _hi_cov_select_suites passes to test_runner.sh with _HI_SHARD_BY=bashcov: the suites dealt by $_HI_TEST_COSTS_BASHCOV, the seconds CI took tracing each, costliest first to the lightest slice, so the slices take about as long; tests/scratch/shard_costs.sh --coverage re-reads them off a coverage run) and merged by a gather job: a plain JSON hash union of the --command-name-keyed .resultset.json files, safe because shards partition the suite table.

The Windows client’s shards and ci.yml’s e2e shards are dealt the same way, by _HI_SHARD_BY=gitbash ($_HI_TEST_COSTS_GITBASH, each suite’s time under Git Bash on arm64), _HI_SHARD_BY=e2e ($_HI_TEST_COSTS_E2E), and _HI_SHARD_BY=backends ($_HI_TEST_COSTS_BACKENDS, which leaves kube a runner to itself); tests/scratch/shard_costs.sh re-reads any of them off a CI run’s summary tables.

bashcov reads bash’s xtrace, and skews in known ways: a heredoc body counts as covered whether or not it ran, and children under a bare env -i or inside containers drop out of the trace. More readings are artifacts, not gaps, and tests/coverage_v2.sh’s header is their list: a scratch-tree copy, an eval inside a $( ), the sh … case above, and the lines xtrace never prints (an empty case arm, a redirect line). Rule those out before writing a test against a number. An arm the sweep cannot reach here (zsh’s, an old bash’s, a tool no sweep has) sits between # hi-nocov-begin: <why> and # hi-nocov-end comments, which the driver leaves out of its figure. bashcov’s trace pipe is non-blocking, and bash drops a line written while it is full, so tests/lib/coverage_env.sh makes it blocking ahead of each suite; with bashcov’s reader the bottleneck, a parallel suite gains nothing. A suite still running after _HI_COV_SUITE_LIMIT seconds (600) is stopped, and the driver prints the processes running then: a stall names its suite rather than running the job out. It skips configure_pty, which runs near ten times slower under bashcov on a CI runner than anywhere else measured, so no figure counts it. It needs gem install --user-install bashcov (found off the gem bin directory if not on $PATH), and writes a .simplecov into the checkout for the run, refusing to start rather than overwrite one you have.

pages.yml publishes the figure as a shields endpoint (badges/coverage-v2.json), labelled bashcov. A completed Coverage run is pages.yml’s only automatic trigger, so the badge is never older than its sweep.

common/zsh.zsh and common/config.fish sit outside the sweep: bashcov’s xtrace is a bash mechanism, so no line-coverage figure for them is honest. What stands in: tests/lint/dialects_test.sh’s floor checks (checks 2–5), and tests/common/exports_test.sh and tests/hi/prompt_test.sh, which drift-check common/config.fish against common/core.sh line by line.

tests/profile.sh is for a tripped --group bench ceiling: _hi_bench says whether a path got slower, this says which command in it did. It profiles the four bash paths the bench guards through timep, in a container (tests/dockerfiles/timep.Dockerfile): timep enable -fs base64-encoded loadable-builtin .so files into the running shell, which is worth sandboxing, and the box settles three requirements timep does not check — glibc ≥ 2.38, a bash with enable -f, and an exec-capable /dev/shm. Missing any, timep exits 0 and writes arithmetic errors instead of times, so profile.sh grades the output, not the status. The checkout is mounted read-only; $_HI_TIMEP mounts a local copy of timep you have read. Read the ranking, not the milliseconds. ci.yml’s profile job runs it beside bench and uploads the profiles artifact (14 days); it is advisory (continue-on-error), the bench ceilings stay the gate.

tests/scratch/trace_volume.sh <suite> ranks a suite’s traced lines by function, the cost bashcov pays, and tests/scratch/trace_sweep.sh ranks every suite the same way: the first place to look when a CI job nears its time limit.

Timing and shared state

The Windows and BSD runners are where a timing assumption shows up, so the harness makes these choices on purpose:

  • Isolation per suite. test_lib.sh gives each suite a fresh mktemp -d root holding its XDG_CONFIG_HOME (absent until a case makes it), XDG_RUNTIME_DIR, and HOME, so parallel suites never share hi’s payload, overlay, or ssh-tags caches, nor a developer’s real sockets, and no dotfile of a developer’s rides a stream a suite builds. docker keeps its contexts through DOCKER_CONFIG and podman its storage through XDG_DATA_HOME, both set from the home the run started in; _HI_TEST_KEEP_HOME=1 leaves HOME alone, for a toolchain that resolves through it. Cleanup removes that root by its recorded path - never whatever a variable points at by then.
  • Pinned caps. _HI_PROBE_TIMEOUT is 10 in the suites (a user’s 2s is for real CLIs; the suites probe shell shims); the pty cases’ cap is 60s, _hi_login_env’s 180s. A cap bounds a wedge, never a pace.
  • Meetings over sleeps. A case proving concurrency has its shims wait for each other (bounded) rather than sleep a fixed time and hope.
  • The pty rig’s verdict is a file. Each child writes its verdict line to <label>/verdict as well as the pty; a BSD pty can drop a fast child’s last output.

Written down as not races:

  • kill -0 as “still running”. _hi_wait_pid and _hi_par_slot poll it, and a pid bash has reaped can be reused. The job table would say better, but only through $(jobs), and whether a command substitution sees the parent’s jobs varies: where it did not (Git Bash, OpenBSD), the timeout stopped counting and a hung case hung its shard. So the poll stays; a reused pid needs the old one to exit and a stranger to take its number inside one poll’s window.
  • Wall-clock deadlines. $SECONDS is the wall clock, chosen over counted iterations (process.sh says why); a VM whose clock NTP steps mid-run can shorten one, a trade taken knowingly.
  • One HOME for the parallel fresh-shell cases in install_location_test.sh: zsh’s compdump, fish’s variables, and shell history each write through their own lock or append, and no case reads another’s.
  • Build-once fixture helpers (_hi_fake_path, _hi_real_path, _hi_git_fixture, _hi_stub_tools, _hi_capable mkdir_mode): safe while their callers are serial, as every caller is; build one before a _hi_par_begin, never inside a parallel case.

On Windows arm64, an overlay stream that gzip calls truncated (“unexpected end of file”) is the runner’s, not the code’s: under load, a subshell in _hi_stage_tar has died with a segmentation fault (exit 139) in the emulated x64 MSYS runtime there. payload_test.sh wraps _hi_overlay_tar to print its exit status and stderr, so look for exited 139 before chasing the gzip error; a rerun is the answer unless it recurs. The same runners have handed a capture nothing from a hi run that exited 0, and a process substitution nothing from a list that was there a call earlier. The output probe above says whether the host is dropping output at that moment and from which writer. _hi_run_said (tests/lib/report.sh) runs a program into a file and names a run that wrote nothing, which tells a silent run from a capture that lost its words, for plugins_test.sh’s hi and the whole runs of doctor.sh and install.sh, the slowest cases there are: where a flake may pass, a run that wrote nothing is made once more and listed under Flaky cases. A run that said anything is never made twice.

A case that fails only on one BSD runner can be reproduced locally: tests/scratch/bsd_vm.sh up boots FreeBSD’s cloud image under qemu with KVM, and tests/scratch/bsd_vm.sh cases <suite> <word> runs matching cases there through tests/scratch/run_cases.sh.

The images are files; the build contexts are not

Every image a suite builds is a real Dockerfile under tests/dockerfiles/: sshd-debian, sshd-alpine, sshd-fedora, and sshd-bash32 for the ssh targets, alpine-shell for the bare shell ones, installed-* for the pre-installed targets (installed-pkg takes the .deb/.rpm/.apk as a build arg), framework for the thirteen shell frameworks and tools (the framework a build arg naming a script under frameworks/), apt-client for the repo suite’s apt subscriber (openssh-client preinstalled, no Ubuntu archive in its sources, so the cases fetch from the repository under test alone), and fish33, fish4, zsh55, and timep for the lint gate and the profiler. Only the build context is generated per case: the entrypoint.sh, and for the pre-installed cases the repo itself. Suites reach a file through _hi_dockerfile <stem>; variants differing only by a package list or base image are one file plus a --build-arg (PKGS, BASE). docs/tapes/fixtures.sh builds its demo-* images from the same folder, spelling the path out, since a tape render does not source test_lib.sh. The lint gate checks both directions: no Dockerfile without a caller, no caller naming a missing Dockerfile.

What is pinned, and what deliberately is not

Upstream base images are digest-pinned, non-negotiably. Every FROM in tests/dockerfiles/ that names an upstream image (12 of 21: alpine, ubuntu, debian, fedora, bash, zshusers/zsh, ohmyfish/fish) carries a @sha256: — what makes a failed e2e run reproducible and a base-image move a deliberate, reviewable act. tool-versions.yml reports a moved tag weekly, which is how a base image reaching EOL gets noticed. The other 9 are FROM ${BASE} over an image a suite or a tape builds locally (hi-test-sshd and the like; see --build-arg BASE= in tests/targets/*_test.sh), with no upstream digest to pin; Scorecard flags them as unpinned containerImage dependencies, and .scorecard.yml annotates the check test-data rather than pretending it’s clean. (Its code-review check is deliberately not annotated: the 0/9 there is accurate, no second reviewer, and no reason code says so truthfully.) Nothing in tests/dockerfiles/ reaches a release; the release path’s workflows and actions are SHA-pinned separately.

The same tags named in shell and YAML are guarded, not watched. alpine: and debian: also appear as plain tags in tests/lib/backend.sh, docs/tapes/fixtures.sh, and ci.yml’s packaging smoke, where the digest check cannot see them. lint_image_tags fails when a tag named anywhere in the tree disagrees with the digest-pinned ones; lint_image_digests when two Dockerfiles pin one tag to different digests.

Every framework fetch is pinned. Six to a release and a hash, each downloaded to a file and sha256sum -cd before use: frameworks/plgo.sh’s release binary (v1.26), frameworks/tmux.sh’s fzf release (v0.74.4, since bookworm’s apt fzf predates $FZF_DEFAULT_OPTS_FILE), frameworks/tide.sh’s fisher (4.4.5, installing tide v6.2.0), and the atuin, mise, and starship installers. atuin.sh (v18.20.1) and mise.sh (v2026.8.14) name the release tag in the download URL, so hash and version move together (mise.run is regenerated per release whatever MISE_VERSION says, so pinning that alone drifts); starship.sh (v1.26.0, via --version) fetches the generic starship.rs/install.sh, so its hash pins that day’s copy of the installer — a mismatch needs a fresh hash, not a version bump. The frameworks without releases are pinned by commit: the oh-my-zsh and oh-my-bash installers by commit and hash, each fed its framework through a local mirror fetched at a commit (omz.sh, which p10k.sh runs first, and omb.sh), the bash-it and powerlevel10k checkouts by commit, and atuin’s bash-preexec by commit and hash. Every pin is named in its script and bumped by hand. The image builds under pipefail, so a 404, a checksum mismatch, or an installer changing shape fails the build rather than shipping an image with the framework missing.

The lint gate

--group lint is five suites, thirty-four checks between them. Each suite is its own process (shellcheck, dialects, tools, drift, drift_docs) with its own tally in the summary table, so a failure in one never hides what the others found.

CI’s lint suites job passes --require-run, so a check that skips yellow locally for want of a tool fails there. Its binaries are pinned in .github/actions/setup-tool/tools.txt: eight columns, name|pin|kind|url|verify|check|tag-prefix|sha256 (the file’s header documents each), the last a sha256 of the download, one for every platform or one per platform (linux-x86_64=<hex>,darwin-aarch64=<hex>), so a pin moves only with its checksum. tool-versions.yml drift-checks every row weekly, with every action SHA, image digest and npm pin beside them: Dependabot opens no version-update pull request, so its one tracking issue is where a bump starts. .github/scripts/check_tool_versions.local.sh adds this repo’s inline pins and image checks. markdownlint-cli2 and prettier are pinned in .github/package-lock.json instead, installed by npm ci --prefix .github and run from .github/node_modules/.bin. After the group, the same job runs lychee (settings in lychee.toml) offline over the tracked Markdown, so a broken relative link or #fragment fails the PR that makes it; link-check.yml’s weekly sweep checks the external URLs.

shellcheck (tests/lint/shellcheck_test.sh) — one check, and most of the group’s cost. A fatal guard runs before it: every source of a $_HI_CONFIG_DIR/... path must carry a # shellcheck source= directive, or .shellcheckrc’s source-path=SCRIPTDIR under shellcheck -x resolves a bare basename to the sourcing file itself and re-parses it until the kernel OOM-kills it (~33GB resident).

  • 1. shellcheck over every *.sh, one invocation per CPU, replayed in order (_HI_SC_WIDTH=1 for one at a time).

dialects (tests/lint/dialects_test.sh) — four shell-dialect checks. 3–5 skip yellow without docker, but with docker present a base image that won’t build is a failure: it’s digest-pinned, so “won’t build” means the image no longer carries the version the check claims.

  • 2. Native syntax checks: zsh -n / fish --no-execute over the files those shells parse for themselves, with whatever zsh and fish this machine has.
  • 3. The fish 3.3 floor: the same files in a pinned fish 3.3.1 (tests/dockerfiles/fish33.Dockerfile, oh-my-fish’s prebuilt image), since newer fish accepts constructs older fish rejects. It has caught a $( ), which fish before 3.4 refuses anywhere in a file, and a { ... } group in common/paths.sh, a brace expansion before fish 4, which refuses a comment inside one with “Mismatched braces” and fails even a clean one at run time. So paths.sh is also sourced there with _HI_DISABLE_LOCAL=1, and its gate is one guarded line per toggle.
  • 4. The fish 4 ceiling: the same files in a pinned fish 4 (tests/dockerfiles/fish4.Dockerfile, Ubuntu 26.04’s), for a construct fish 3 accepts that fish 4 rejects.
  • 5. The zsh 5.5 floor sources common/zsh.zsh in a real interactive zsh 5.5.1 (tests/dockerfiles/zsh55.Dockerfile) and asks for a prompt, the aliases, a resolved host color, and the prompt separator — zsh’s risky constructs parse everywhere and only misbehave on an old zsh. 5.5.1 because it is RHEL 8’s, while bookworm, noble, alpine, and macOS all ship 5.9; the image is upstream’s zshusers/zsh:5.5.1, since a distro apt install failed on hosted runners only.

tools (tests/lint/tools_test.sh) — eight external-tool wrappers, each skipping yellow when its tool isn’t installed (CI has all eight):

  • 6. shfmt over the same *.sh list, style from .editorconfig. Fix a red run with shfmt -w on the paths it names, not shfmt -w ., which also reformats common/zsh.zsh (zsh, ships as-is).
  • 7. checkbashisms over the #!/bin/sh files, which dash and busybox sh really do parse on minimal targets.
  • 8. mandoc over docs/hi.1 (mandoc -T lint -W warning).
  • 9. The editors demo’s vimrc (docs/tapes/editors/vimrc), loaded under vim -u … -es the way the alias does, so a syntax error shows here rather than on the recording.
  • 10. typos over the whole tree, allowlisted by .typos.toml.
  • 11. osv-scanner over every lockfile git keeps, as Scorecard’s Vulnerabilities check reads them after a merge. Advisory: a finding prints yellow and never fails the gate, as SECURITY.md gives a moderate or low advisory until the next routine bump. An advisory with no patched release goes in the osv-scanner.toml beside its lockfile, with its reason and an expiry date. It queries api.osv.dev.
  • 12. markdownlint (markdownlint-cli2, rules in .markdownlint.yaml) over the Markdown git knows about, tracked or new.
  • 13. prettier –check over the same list, style in .prettierrc.yaml, skipping .prettierignore’s files, with .github/prettier-plugin-docs.mjs, which writes each doc’s ## Contents list from its ## and ### headings, SETTINGS.md’s table from scripts/settings, and USAGE.md’s commands from common/flags and docs/tapes/usage: a stale one fails like any other formatting, and a flag with no usage row fails outright. Fix with prettier --write --plugin ./.github/prettier-plugin-docs.mjs on the paths it names.

drift (tests/lint/drift_test.sh, and drift_docs_test.sh for the seven over the docs and settings: 19-22 and 25-27) — twenty-one repo-consistency sweeps, each checking that something written down elsewhere still agrees with the tree:

  • 14. The bash-3.2 grep: no mapfile, associative arrays, namerefs, ${x,,}, wait -n, or ${!a[@]+…} — each explained in GLOSSARY.md by its GLOSSARY: HI.NN tag.
  • 15. One-userland spellings: SYNTAX.md’s enforced rows - echo -e, sed -r and -i, grep -P, readlink -f, xargs -r, head -n -N, date %-X, gawk-only functions, mktemp -t with no X’s, and basic-sed alternation.
  • 16. Paired spellings: stat -c only beside its stat -f twin, and strict mode switched off again in every file an interactive shell sources (HI.15).
  • 17. The $HOME default sweep: nothing may fall back to $HOME when it derives the say-hi tree — over *.zsh, *.fish, and *.md too, since the docs teach the rule as much as the code obeys it.
  • 18. Ignored payload: no file the payload or a package ships is one .gitignore swallows, asked of git itself — the suites read the working tree, so nothing else would notice it never reached a commit.
  • 19. GLOSSARY tags: every GLOSSARY: HI.NN in the tree names a code GLOSSARY.md defines, and every entry is referenced; matched by code, not title.
  • 20. The settings rows: every row of scripts/settings (the rows SETTINGS.md’s Every setting table is written from and hi --configure reads its items from) names a variable the shipped tree still reads, and none is one the doc’s Not settings lists.
  • 21. The defaults block: each _HI_*_DEFAULT in common/core.sh is its row’s <default> where the row states a value, no bash or zsh file reads a setting or a block name with a literal default of its own, and common/targets.sh’s two copies match the block.
  • 22. The <check> column: every row’s <check> is a kind scripts/lib.sh’s _hi_setting_check knows, the rows whose check is toggle are common/core.sh’s $_HI_TOGGLES, and names follow polarity (CONTRIBUTING.md): every toggle is _HI_DISABLE_*, and no flag is but the four default-on settings _HI_DISABLE_LOCAL leaves alone, excused by name.
  • 23. The docker-compatible family: common/core.sh’s $_HI_CONTAINER_CLIS and common/targets.sh’s copy name the same CLIs (HI.51), since neither file can read the other.
  • 24. The runtime directory: common/core.sh’s _hi_runtime_dir and common/targets.sh’s cache directory build the same path, with the same ownership guards, in their two dialects.
  • 25. Liquid syntax: no page the Pages build renders may carry a raw Liquid delimiter outside a guarded span — Liquid tokenizes before Markdown, so a fence gives no shelter.
  • 26. Site links: a relative link on a page the site builds lands on a page the site builds too, not a dot-path or anything _config.yml excludes (which renders on GitHub and 404s on Pages); link those as absolute github.com URLs.
  • 27. The tldr page: every hi --flag example in docs/tldr.md names a common/flags row, and there are at most eight examples (the upstream cap).
  • 28. tests/dockerfiles/: every image definition has a caller and vice versa.
  • 29. Image tags: every plain image tag named in shell or YAML is one of the digest-pinned FROM tags in tests/dockerfiles/.
  • 30. Image digests: two Dockerfiles pinning the same image:tag agree on its digest — check 29 strips digests before comparing, so it can’t see one tag pinned two ways.
  • 31. The eval roster: every eval in the payload and scripts/ has a row in tests/lint/eval_roster saying what it evaluates, and every file’s count of its kin (a source of a path in a variable, a shell’s -c, a recursive rm) matches its row; a row nothing matches fails too, so the roster only counts down.
  • 32. mise.toml: every [tools] version in mise.toml and .config/mise/conf.d/*.toml is its home’s pin (tools.txt’s row, ci.yml’s node-version, coverage.yml’s BASHCOV_VERSION, demos.yml’s vhs version:), and every tools.txt row is a [tools] key or named on an apt: line.
  • 33. Case reasons: no suite’s case fails on a bare last-line assertion, a silent || return 1, or a compared substitution with nothing saying why; the scan first runs on a case written to fail it.
  • 34. Case subjects: every _hi_* a case negates or hands a reporter is defined somewhere in the tree, since ! f passes on a name nothing defines.

Test levers

Six environment variables the tree reads that are not settings: they exist so a suite, the bench, or a demo can pin what a real run derives. _HI_TARGETS_TTL (seconds targets.sh reuses its list; 0 sweeps every call), _HI_PROBE_TIMEOUT (seconds one backend CLI gets), _HI_PAYLOAD_CACHE (0 builds the payload and overlay archives fresh), _HI_CTL_PERSIST (seconds a shared ssh control socket lingers; 0 gives a connect a private one, closed after), _HI_HEADER_VERSION (the header’s version cell, otherwise the release stamp or git describe) and _HI_WATCH_STEP (seconds between a session tree’s watcher’s checks on its shell, otherwise 60 — ssh_keep’s killed and expired cases set 2). Their defaults are the shipped behaviour; hi --configure writes none of them. _HI_LOAD_NO_INIT=1 is adjacent but not a lever: it makes load.sh define its functions without running the profile chain, for scripts/install.sh to source.

Relaying

hi chains: from a session on B you can hi C, and the second hop is a full hi session — from a disposable session too, because hi.sh is a member of $_HI_PAYLOAD and arrives with its exec bit (hence the cat write-back, HI.09). ssh_relay is the proof: A → B → C, config intact on the final hop, cleanup traps firing on both B and C, on a clean exit and on the link being killed mid-relay. The one tier that cannot relay is the container transport’s bash-less fallback, which ships aliases.sh alone and never loads paths.sh — there hi is not defined.

Local-only

The payload carries no scripts/, tests/, or .git, so on a target every local command (hi --doctor, --preview, --install, …) says it needs the full checkout rather than running, and --update says so in a package install too, which ships scripts/ but no .git. Which flag needs what is common/flags’ <needs> column; docs/hi.1 is the long form, drift-checked against the flags by tests/hi/parse_test.sh.

Why the harness is hand-rolled

bats-core, shellspec, and a python/pytest driver were weighed as replacements for tests/test_lib.sh and tests/lib/*.sh (a paper study: no suite was ported, no timings). test_runner.sh stays either way, so a candidate has to hand it something it can still collect through $_HI_COUNTS_FILE/$_HI_FAILS_FILE. Scored on that basis:

  this harness bats-core shellspec a pytest driver
macOS bash 3.2 native (it’s what’s shipped) claimed, “Bash 3.2 or above” bash 3.2.57 named and CI-tested n/a - drives shells, isn’t one
Git Bash, install step none - it’s the tree source-only; no MSYS2/Cygwin/WSL tier documented Git Bash, msys2, cygwin, busybox-w32, WSL all tested import pty fails - Unix only, stdlib says so
runtime-generated cases plain bash for, unrestricted bats_test_function (workaround; order is issue #860) Parameters:dynamic allows a for loop, but no function/variable access parametrize/pytest_generate_tests, fully dynamic
skip vs. --require-run three tiers, wrapper turns every skip into a fail skip; no fail-mode documented Skip/Pending; no fail-mode documented needs pytest-error-for-skips, a second package
parallel, ordered replay own scheduler, submission-order replay needs GNU parallel; order not guaranteed own --jobs; ordering undocumented needs pytest-xdist; reorders for scheduling
coverage topology suite = top-level process, bashcov merged kcov known to read 0% on some .bats files (kcov#462) built-in --kcov, whose DEBUG trap misses a child bash coverage.py measures Python only - subprocess bash is invisible to it
lint-gate reach already *.sh; shellcheck, shfmt, checkbashisms all apply shellcheck parses .bats since 0.7; shfmt/checkbashisms don’t know the extension DSL keywords (It/When/Then); no shellcheck dialect found not shell at all - opts the driver out of the gate entirely
new dependency none GNU parallel none found required pytest + xdist + a pty replacement on Windows

Keep it. Every candidate loses at least one row, usually more, and the sweep’s wall clock is container boot and e2e deadlines rather than per-case dispatch, so speed would not have decided it. Reopen it if Git Bash leaves the platform matrix, bashcov goes unmaintained, or one of the three documents an ordered parallel mode and a skip-as-failure flag without a second package.


This site uses Just the Docs, a documentation theme for Jekyll.