Skip to content

fix(installer): fast-forward updates, no interactive shell, idempotent .zshrc integration - #210

Merged
ss-o merged 2 commits into
mainfrom
bug-203
Sep 19, 2026
Merged

ss-o merged 2 commits into
mainfrom
bug-203

Conversation

@ss-o

@ss-o ss-o commented Sep 19, 2026

Copy link
Copy Markdown
Member

Summary

Behaviour changes worth knowing: -b now names a branch (refs/heads/), and -i skip -a annex no longer writes the annex block, since -i skip means "do not touch .zshrc".

Closes #203
Closes #204
Closes #205

Verification

  • sh ./tests/installers.sh: 27 cases pass, 5 of them new (fetch and fast-forward without clean or reset, non-fast-forward refusal with the checkout state, comment probe, annex rerun idempotency with a non-interactive burst, -i skip with an annex profile). The git double now logs calls, accepts fetch and merge, fails clean, reset, and pull loudly, and can simulate a non-fast-forward; a zsh double refuses any interactive flag.
  • Mutation probe: restoring zsh -ic makes the annex case fail (expected one annex burst, saw empty), so the test checks what it claims.
  • shellcheck -s sh clean on both files; public/checksum.txt regenerated after the commit hook reformatted install.sh.

Finding outside this change

check-linux.yml and check-macos.yml run the real installer as sh -x ./public/sh/install.sh -- -i skip, -- -a annex, and -- -a loader. POSIX getopts stops at --, so every flag becomes an operand and all three steps have always run the default profile: the annex and loader paths have never been exercised by those steps. Not changed here; proposed as a separate issue.

Agent handoff

No handoff needed.

Copilot AI balanced review requested due to automatic review settings September 19, 2026 00:38
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Deploying src with  Cloudflare Pages  Cloudflare Pages

Latest commit: b36e84e
Status: ✅  Deploy successful!
Preview URL: https://52bb24f3.zi-src.pages.dev
Branch Preview URL: https://bug-203.zi-src.pages.dev

View logs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Startup isolation, path rewriting, branch validation, and integration detection still have correctness issues.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 3 Medium severity · 1 Low severity

Open (5)
What changed in this PR

Improves installer safety, rerun idempotency, and non-interactive annex setup.

Changes:

  • Replaces destructive updates with fast-forward-only Git operations.
  • Improves .zshrc integration detection and annex handling.
  • Adds installer regression tests and updates checksums.
File Description
public/​sh/​install.sh Implements safer updates and profile integration.
tests/​installers.sh Adds regression coverage for updated behavior.
public/​checksum.txt Updates the installer checksum.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread public/sh/install.sh Outdated
Comment thread public/sh/install.sh
Comment thread public/sh/install.sh Outdated
Comment thread public/sh/install.sh Outdated
Comment thread public/sh/install.sh Outdated
…t .zshrc integration

Update path (#203): fetch the requested branch and merge --ff-only, the
same operation as `zi self-update`; refuse with the checkout state when a
fast-forward is impossible. `git clean -d -f -f` and `git reset --hard`
are gone, so local state in the checkout is never discarded.

.zshrc probe (#205): detect an existing integration by a real source line
instead of any mention of the file names, so a comment cannot suppress the
integration; keep the result separate from `-i skip`. The annex and zunit
profiles skip when `-i skip` was given or when .zshrc already loads
z-shell/z-a-meta-plugins, so a rerun no longer appends a second block.
The .zshrc text keeps using $HOME while the installer itself keeps the
real path, which also repairs the closing `git log` that ran outside the
checkout.

Annex burst (#204): run the just-written fragment in `zsh -c` after
sourcing zi.zsh, never an interactive shell that executes the user's
startup files; a failure prints that annexes install on the next shell
start instead of aborting after .zshrc was modified.

Harness: the git double logs calls, accepts fetch and merge, fails
clean, reset, and pull loudly, and can simulate a non-fast-forward; a zsh
double refuses any interactive flag. Five new cases cover the update
path, the refusal, the comment probe, the annex rerun, and -i skip.

Closes #203
Closes #204
Closes #205
… not read as grep options

Also keep ShellCheck quiet on the literal $HOME text with the disable
comment the file already uses for that pattern.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants