fix(IW-556): keep the developer's tmux config out of the plumbing test #574

Merged
mph merged 17 commits from IW-556 into main 2026-09-16 15:21:24 +00:00
Member

Summary

test/start.bats case "the tmux session does not carry iw's internal plumbing" failed on a developer machine at every run: IW_HOME was absent from the pane.

Cause. -L <socket> isolates the tmux socket, not the config. The test's server still read ~/.config/tmux/tmux.conf, and that config runs set-environment -gu IW_HOME on purpose, so fish supplies a live value. iw was correct; the test depended on the developer's config.

Fix. The case runs iw start with HOME="$TEST_PARENT", which holds no tmux or fish config. TmuxAdapter does not change.

Rejected:

  • new-session -e IW_HOME=… in TmuxAdapter: it freezes IW_HOME in each session, which that config prevents on purpose.
  • XDG_CONFIG_HOME: tmux 3.6a still reads ~/.config/tmux/tmux.conf.
  • A test-started server with -f /dev/null: the pane would hold the test's environment, so the case would no longer test sessionEnv.

Defects

  • Fixed: the false red in start.bats (Defect 1 of the analysis).
  • Not fixed, filed as #572 (low priority): iw start on a tmux server that already runs gives the pane that server's IW_* values (Defect 2).
  • Seen again and noted on #200: review-state update --append-artifact duplicates an artifact.

Testing

  • Before: the case failed at line 145. After: it passes.
  • Mutations of sessionEnv at core/adapters/Tmux.scala:74: dropping IW_HOME fails the case (line 145); keeping every IW_* name fails it (line 142). Both reverted.
  • bats test/start.bats: 6/6 pass. ./iw ./test e2e: exit 0. Pre-commit and pre-push hooks (format, scalafix, compile with warnings as errors, unit tests): pass.

Release notes are not included: the change touches a test only.

Closes #556

🤖 Generated with Claude Code

## Summary `test/start.bats` case "the tmux session does not carry iw's internal plumbing" failed on a developer machine at every run: `IW_HOME` was absent from the pane. **Cause.** `-L <socket>` isolates the tmux socket, not the config. The test's server still read `~/.config/tmux/tmux.conf`, and that config runs `set-environment -gu IW_HOME` on purpose, so fish supplies a live value. `iw` was correct; the test depended on the developer's config. **Fix.** The case runs `iw start` with `HOME="$TEST_PARENT"`, which holds no tmux or fish config. `TmuxAdapter` does not change. Rejected: - `new-session -e IW_HOME=…` in `TmuxAdapter`: it freezes `IW_HOME` in each session, which that config prevents on purpose. - `XDG_CONFIG_HOME`: tmux 3.6a still reads `~/.config/tmux/tmux.conf`. - A test-started server with `-f /dev/null`: the pane would hold the test's environment, so the case would no longer test `sessionEnv`. ## Defects - Fixed: the false red in `start.bats` (Defect 1 of the analysis). - Not fixed, filed as #572 (low priority): `iw start` on a tmux server that already runs gives the pane that server's `IW_*` values (Defect 2). - Seen again and noted on #200: `review-state update --append-artifact` duplicates an artifact. ## Testing - Before: the case failed at line 145. After: it passes. - Mutations of `sessionEnv` at `core/adapters/Tmux.scala:74`: dropping `IW_HOME` fails the case (line 145); keeping every `IW_*` name fails it (line 142). Both reverted. - `bats test/start.bats`: 6/6 pass. `./iw ./test e2e`: exit 0. Pre-commit and pre-push hooks (format, scalafix, compile with warnings as errors, unit tests): pass. Release notes are not included: the change touches a test only. Closes #556 🤖 Generated with [Claude Code](https://claude.com/claude-code)
start.bats "the tmux session does not carry iw's internal plumbing" fails at
baseline: IW_HOME missing from the captured pane env

Artifacts:
- analysis.md

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011M2HjEYoJpcfD43KYP6zxt
start.bats "the tmux session does not carry iw's internal plumbing" fails at
baseline: IW_HOME missing from the captured pane env

Artifacts:
- tasks.md
- review-state.json (tasks_ready)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011M2HjEYoJpcfD43KYP6zxt
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011M2HjEYoJpcfD43KYP6zxt
The intake review showed that sending all of sessionEnv through
`new-session -e` freezes the secrets that tmux.conf removes on purpose.
Michal chose the narrow scope: IW_HOME, IW_TMUX_SOCKET and removal
entries for held-back IW_* names only.

Also add a BATS case that starts the server with -f, so the repository
holds Defect 1, record the cases the narrow scope leaves open (R5), and
correct the review's non-blocking notes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Michal chose to close Risk R5 in this fix: the session gets a removal
entry for each of the six plumbing names and for IW_HOME even when the
iw process does not hold them, because a tmux server that iw did not
start can hold them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
start.bats "the tmux session does not carry iw's internal plumbing" fails at baseline: IW_HOME missing from the captured pane env

Task index regenerated after Decision D1 bounded the -e scope.

Artifacts:
- tasks.md
- review-state.json (tasks_ready)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Only `-e NAME=` changes the first pane, so Michal chose it (Decision D2).
One change fixes both defects, so Phase 1 now holds the whole fix with
all its tests first, and Phase 2 holds the tmux contract case and the
documentation. tasks.md also states the IW_HOME rule as D1 does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Issue: IW-556
Phase: 1 - `new-session -e` gives each session its `IW_*` state

This commit marks the checkpoint for phase 1 context generation.
Use dx-fix IW-556 to return to this point.

It also applies Michal's decision from the context review:
IW_TMUX_SOCKET follows the same set-or-remove rule as IW_HOME.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The case read a pane on a tmux server that loads ~/.config/tmux/tmux.conf,
because -L isolates the socket and not the config. A config that unsets
IW_HOME made the case fail on that machine only. iw start now runs with a
HOME that holds no config, so the pane shows what iw gave the session.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Michal reduced IW-556 to the test: new-session -e would freeze IW_HOME,
which the developer's tmux config prevents on purpose. D1 and D2 are
marked superseded, Defect 2 moves to FOLLOW-UPS.md with low priority,
and the phase context and task index describe the one-line test fix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
docs(IW-556): follow-ups filed (#572, comment on #200), phase 1 done
Some checks failed
CI / changes (pull_request) Successful in 3s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 11s
CI / lint (pull_request) Successful in 16s
CI / test (pull_request) Has been cancelled
CI / dashboard-build (pull_request) Has been cancelled
CI / compile (pull_request) Has been cancelled
73ac5cd5d9
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
chore(IW-556): update review-state to all_complete
All checks were successful
CI / changes (pull_request) Successful in 2s
CI / lint (pull_request) Successful in 10s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 8s
CI / compile (pull_request) Successful in 1m22s
CI / dashboard-build (pull_request) Successful in 2m37s
CI / test (pull_request) Successful in 18m49s
4136b168f8
mph merged commit 9b90522d66 into main 2026-09-16 15:21:24 +00:00
Sign in to join this conversation.
No description provided.