Skip to content

fix(installer): fix completions when legacy minimal was previously installed - #741

Merged
twitchyliquid64 merged 1 commit into
mainfrom
tom/installer
Jul 14, 2026
Merged

fix(installer): fix completions when legacy minimal was previously installed#741
twitchyliquid64 merged 1 commit into
mainfrom
tom/installer

Conversation

@twitchyliquid64

@twitchyliquid64 twitchyliquid64 commented Jul 14, 2026

Copy link
Copy Markdown
Member

I think i was the only one hitting this lol

Summary by CodeRabbit

  • Bug Fixes

    • Improved zsh completion reliability by detecting and recovering from stale completion caches.
    • Zsh completion updates now refresh outdated cache data automatically.
    • Uninstall removes the zsh completion cache only when it was created by the installer, preserving unrelated user data.
    • Dry-run mode now accurately reports cache cleanup without modifying files.
  • Tests

    • Added coverage for stale-cache recovery, upgrades, reruns, uninstall behavior, and dry-run handling.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The installer now manages zsh’s .zcompdump cache during completion generation, stale-cache recovery, upgrades, and uninstall. Specifications and tests cover conditional cleanup, dry-run behavior, announcements, and preservation of unrelated user caches.

Changes

zsh completion cache lifecycle

Layer / File(s) Summary
Install-time cache refresh
scripts/install.sh, docs/specs/07-spec-installer/07-spec-installer.md
Generated zsh initialization detects stale compinit registration and refreshes .zcompdump; completion generation also clears an existing cache.
Conditional uninstall cleanup
scripts/install.sh, docs/specs/07-spec-installer/07-spec-installer.md
Uninstall removes .zcompdump only when zsh completions were recorded, with dry-run and failure handling.
Specification and test coverage
scripts/install_test.sh, docs/specs/07-spec-installer/07-spec-installer.md
Tests and proof expectations cover upgrades, reruns, dry-run behavior, cleanup, and data-only installs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Installer
  participant ZshInit as zsh init
  participant Compinit as compinit
  participant Cache as .zcompdump
  Installer->>Cache: clear cache during completion generation
  ZshInit->>Compinit: run compinit
  ZshInit->>Cache: remove stale cache when min is unregistered
  ZshInit->>Compinit: rerun compinit
Loading

Possibly related PRs

Suggested reviewers: norrietaylor

Poem

I’m a rabbit with a cache-clearing tune,
Fresh zsh completions now arrive soon.
Stale dumps hop out of sight,
Dry-runs leave user files right,
And uninstall cleans up just right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the installer completion fix for legacy Minimal installs.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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
  • Create stacked PR
  • Commit on current branch

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

@twitchyliquid64
twitchyliquid64 enabled auto-merge (squash) July 14, 2026 00:14

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
scripts/install.sh (1)

612-621: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Silent failure path is inconsistent with the rest of the file's warning conventions.

The uninstall-side cache removal (Line 317) warns when rm -f fails, but this generation-time clear swallows a failed removal silently. Since the comment already documents this as "as non-fatal as the rest of R9.3," a matching warning would improve observability with negligible cost, though impact is low since the stale dump gets a fresh chance to be cleared on the next regeneration/uninstall.

♻️ Optional: warn on failed clear for consistency
         if [ "$1" = zsh ] && [ -f "$zcompdump" ]; then
             if rm -f "$zcompdump" 2>/dev/null; then
                 say "  completions: cleared compinit dump cache $zcompdump"
+            else
+                say "  completions: warning: could not clear compinit dump cache $zcompdump"
             fi
         fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/install.sh` around lines 612 - 621, Update the zsh compinit dump
removal block in the generation path to warn when rm -f "$zcompdump" fails,
matching the uninstall-side warning convention while keeping the failure
non-fatal. Preserve the existing success message and conditional behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/install.sh`:
- Around line 612-621: Update the zsh compinit dump removal block in the
generation path to warn when rm -f "$zcompdump" fails, matching the
uninstall-side warning convention while keeping the failure non-fatal. Preserve
the existing success message and conditional behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f08cc7d-466d-4bca-9394-a90eb4806024

📥 Commits

Reviewing files that changed from the base of the PR and between 2283de9 and 51861b3.

📒 Files selected for processing (3)
  • docs/specs/07-spec-installer/07-spec-installer.md
  • scripts/install.sh
  • scripts/install_test.sh

@twitchyliquid64
twitchyliquid64 merged commit d754900 into main Jul 14, 2026
30 checks passed
@twitchyliquid64
twitchyliquid64 deleted the tom/installer branch July 14, 2026 01:08
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.

2 participants