Skip to content

Insert-if-missing zsh baseline ordering across all 6 delivery mechanisms - #55

Merged
darkn3rd merged 2 commits into
masterfrom
insert_line
Aug 29, 2026
Merged

Insert-if-missing zsh baseline ordering across all 6 delivery mechanisms#55
darkn3rd merged 2 commits into
masterfrom
insert_line

Conversation

@darkn3rd

Copy link
Copy Markdown
Owner

Summary

The .zshrc baseline (prompt/history/completion setup) used to be written by a single full-content files: step. Several other lessons (sdkman/rbenv/pyenv/asdf/go/rust/rvm/cpan) independently append their own lines into the same .zshrc/.bashrc. Since a file: step is a full overwrite, whichever kind of step (file vs append) a given tool happened to apply last to the same destination would silently win/wipe the other - Salt was the one tool that visibly hit this, papered over with a blanket order: last on every append.

This PR replaces the full-content write with three appends: entries (grouped by concern: prompt setup, shell options, completion system), reusing the existing appends:/append: mechanism rather than introducing a new step type. They're attached via a noop: zsh_baseline carrier placed in COMMON_AREA, which every tool already applies before any gated area - no needs:/meets: coupling required for 4 of 5 tools. Salt is the exception (its include:-based area pull-in doesn't reliably preserve common-before-areas by textual position), so it gets a small generic order: passthrough field instead of the old blanket order: last hack.

No bash/Ruby glue code was introduced to work around any tool's own gaps - where a tool was missing real support for the noop type (previously only exercised by the plain-bash-installer's windows.yml), a first-class case was added to that tool's own install_step dispatcher instead.

Changes

  • scriptbox/config/ubuntu2204.yml: split files.ubuntu_default_zshrc into 3 concern-grouped appends: entries, attached via a new noop: zsh_baseline COMMON_AREA carrier (order: 1).
  • resolve_order.rb / generate_chef_databag.rb: generic optional order: field, passed through to every generator (only Salt's template consumes it).
  • Puppet/Chef/Ansible/Salt: added a real noop case to each install_step dispatcher (CFEngine needed none - it already no-ops silently for any unrecognized type).
  • Salt's install_step.jinja: order: last on every append is now order: {{ step.get('order', 'last') }} - the baseline runs first via order: 1, every other append is unchanged.
  • scriptbox/config/helpers/common.yml: fixed append_line() (bash + PowerShell) to create the destination file if missing, rather than silently no-op'ing - a real bug this change exposed, since every prior append target was guaranteed to already exist by some other step.

Test plan

  • rake generate:all - all 5 CM-tool generators regenerate cleanly
  • rake test - 76/76 passing
  • Live-verified all 6 delivery mechanisms (Puppet, Chef, Ansible, Salt, CFEngine, plain bash installer), each both on a fresh box and re-provisioned/drifted: baseline lands first in .zshrc, in the correct internal order, before every other lesson's own appended lines, with no duplication on re-provision.

@darkn3rd
darkn3rd merged commit 28b53ff into master Aug 29, 2026
22 checks passed
@darkn3rd
darkn3rd deleted the insert_line branch August 29, 2026 18:53
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