Skip to content

test(herdr): a test pane's zsh starts at a prompt, not in zsh's new-user wizard - #502

Merged
devswha merged 2 commits into
mainfrom
fix/test-zsh-new-user-wizard
Oct 6, 2026
Merged

devswha merged 2 commits into
mainfrom
fix/test-zsh-new-user-wizard

Conversation

@devswha

@devswha devswha commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Change

Since #499 the test herdr session starts its panes with an empty ZDOTDIR, so that a pane's zsh reads none of the user's own files. On a Linux host whose login shell is zsh, a zsh with no startup file at all opens its new-user wizard (zsh-newuser-install) in every pane. The wizard takes the first keys a test types into the shell: exec '…/claude' … arrived as xec '…', the fixture never started, and every contract test that runs a program in a pane failed in its setup (server/prompt.contract.test.ts at expect(existsSync(log)).toBe(true)).

CI is not affected (its panes run bash), and neither were the macOS runs #499 was made on. A developer machine on Linux with zsh is, and so is any session that verifies a PR locally on one.

scripts/test-herdr.ts now puts an empty .zshrc into that directory. zsh reads it as nothing, so the pane still reads none of the user's files, and with a startup file present it does not open the wizard. A pane reads the file when its shell starts, so a test server that is already running needs no restart.

No changelog entry: nothing a user of the app notices.

Validation

  • Ubuntu, zsh as the login shell, herdr 0.9.3, on a herdr session of its own: with the empty directory the wizard showed in a new pane and a typed echo did not run; with the empty .zshrc there was no wizard and the command ran.
  • On the default test session (herdr-web-ui-test, zsh panes): bun test ./server/prompt.contract.test.ts failed in its first fixture before the change and passes after it (11 passed, 0 failed); bun test ./server/pi.contract.test.ts passes (9 passed).
  • Not run on macOS. The change only adds an empty file to a directory the test session already owns.

🤖 Generated with Claude Code

…ser wizard

Since #499 the test herdr session starts its panes with an empty ZDOTDIR, so
that a pane's zsh reads none of the user's own files. On a Linux host whose
login shell is zsh, a zsh with no startup file at all opens its new-user
wizard (zsh-newuser-install) in every pane, and the wizard takes the first
keys a test types into the shell: `exec '…/claude' …` arrived as
`xec '…'`, the fixture never started, and every contract test that runs a
program in a pane failed in its setup.

The directory now holds an empty .zshrc. zsh reads it as nothing, and with
a startup file present it does not open the wizard. A pane reads the file
when its shell starts, so a test server already running needs no restart.

Measured on Ubuntu with zsh as the login shell, on a herdr session of its
own: with the empty directory the wizard showed and a typed command did not
run; with the empty .zshrc no wizard and the command ran. On the default
test session, server/prompt.contract.test.ts went from failing in its first
fixture to 11 passed, and server/pi.contract.test.ts passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 57457a47-f97d-479f-b50b-42fdc01dd2dc
📥 Commits

Reviewing files that changed from the base of the PR and between b1ef802 and 5134309.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ce36a082-ccac-423d-b6bc-d751248c76b5
📥 Commits

Reviewing files that changed from the base of the PR and between 29ea99a and b1ef802.

📒 Files selected for processing (1)
  • scripts/test-herdr.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Tests
    • Test setup now creates the required shell configuration when it is missing, allowing server startup checks to proceed.

Walkthrough

The test script now creates zdotdir and ensures .zshrc exists before checking whether the test server responds.

Changes

Test setup initialization

Layer / File(s) Summary
Initialize Zsh files
scripts/test-herdr.ts
The script imports writeFileSync, creates zdotdir, and writes an empty .zshrc only when the file does not already exist. The server socket check follows this setup.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: kilhyeonjun

Merge Risk: ⚪ Minimal · up to b1ef8

The test helper now prepares its Zsh configuration before checking server readiness. No concrete regression was established, so the change appears ready to merge after normal checks.

Architecture Summary

Architecture risk: 🔵 Low · up to b1ef8

The change affects 1 system.

Changed systems: scripts

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — scripts (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in scripts/test-herdr.ts: Adds the writeFileSync import from node:fs.
  • observed — Modified behavior in scripts/test-herdr.ts: Creates zdotdir before checking whether the socket responds and ensures .zshrc exists without overwriting it. Previously, directory creation occurred only when the socket did not respond, immediately before starting the server.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the test-pane zsh startup issue and the change that prevents the new-user wizard from intercepting input.
Description check ✅ Passed The description includes both required sections. It explains the problem and resulting behavior, and lists relevant validation results, including the untested macOS environment.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@devswha
devswha merged commit a659fb9 into main Oct 6, 2026
4 checks passed
@devswha
devswha deleted the fix/test-zsh-new-user-wizard branch October 6, 2026 07:31
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