Skip to content

fix(deploy): guard associative-array lookup so extension sync can't abort deploy.sh - #39

Draft
yulonglin wants to merge 1 commit into
mainfrom
worktree-fix-ext-nounset
Draft

fix(deploy): guard associative-array lookup so extension sync can't abort deploy.sh#39
yulonglin wants to merge 1 commit into
mainfrom
worktree-fix-ext-nounset

Conversation

@yulonglin

Copy link
Copy Markdown
Owner

Summary

  • install_editor_extensions (scripts/shared/helpers.sh) read wanted_map[${ext:l}] without a :- default. Under set -euo pipefail (deploy.sh line 15), zsh treats reading a missing associative-array key as a fatal, uncatchable error — not a normal non-zero exit.
  • Any editor extension installed but absent from config/vscode_extensions.txt triggered this, killing deploy.sh at the editor-settings step (~line 381 of 1340). The || log_warning "Editor settings deployment failed" guard could not catch it, so the failure was silent — everything after that line (Finicky, Ghostty, Zed, gitui, Claude, Codex, Serena, Mouseless, Alfred repair, text replacements, all launchd/cron jobs) was skipped without any error message.
  • Fix: add the :- default so a missing key reads as empty, matching the intended "not in wanted list → mark for removal" logic.
  • Swept the other 3 associative arrays in the repo (SSH_THEME_OVERRIDES, pids, git_settings) — none have the same issue since they only read keys they iterate from the array's own key list.

Test plan

  • Reproduced the exact zsh nounset failure standalone: zsh -c 'set -euo pipefail; typeset -A m; m[foo]=1; for e in FOO BAR; do [[ -z "${m[${e:l}]}" ]] && echo miss; done; echo END' dies before printing END.
  • Confirmed the :--guarded form reaches the end under the same set -euo pipefail.
  • Run ./deploy.sh --editor end-to-end on a machine with an unlisted Cursor/VSCode extension installed, confirm it now completes deployment past the editor-settings step.

…bort deploy.sh

Under `set -euo pipefail` (deploy.sh line 15), zsh treats reading a missing associative-array key as a fatal error that terminates the shell outright — it is not a normal non-zero exit, so the `|| log_warning` guard on the deploy_editor_settings call cannot catch it.

Any installed editor extension absent from config/vscode_extensions.txt therefore killed deploy.sh at the extension-sync step (~line 381 of 1340), silently skipping every later component: developer config files, Finicky, Ghostty, Zed, gitui, Claude, Codex, Serena, Mouseless, Alfred, text replacements, and all launchd/cron jobs.

Add the `:-` default so a missing key reads as empty. wanted_map was the only associative array in the repo read with a possibly-absent key; the other three (SSH_THEME_OVERRIDES, pids, git_settings) only read keys they iterate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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