Skip to content

fix: refresh image-managed dotfiles over the home volume on start (#89) - #91

Merged
BrettKinny merged 1 commit into
mainfrom
fix/89-dotfile-volume-shadow
Jun 30, 2026
Merged

fix: refresh image-managed dotfiles over the home volume on start (#89)#91
BrettKinny merged 1 commit into
mainfrom
fix/89-dotfile-volume-shadow

Conversation

@BrettKinny

Copy link
Copy Markdown
Collaborator

Closes #89. v1.0 blocker — the bug lives in v1.0's headline feature (pull/compose upgrades).

Problem

docker-compose.yml / the GHCR install mounts only squarebox-home:/home/dev, so the named volume shadows the image-baked dotfiles (.bashrc, starship.toml). Docker seeds a volume from the image only at first creation, so upgraded containers silently keep whatever dotfile shipped when their volume was born — image updates never reach them.

This already bit rc1→rc2: PR #88's fzf keybindings stayed dead on upgraded shells. It also made #90 (sqrbx-help) embarrassing — the MOTD advertised a help screen documenting Ctrl+R/Ctrl+T shortcuts that were dead on those same upgraded containers.

Fix

  • Ship managed dotfiles to a non-volume path (/usr/local/lib/squarebox/dotfiles/) the volume can't shadow.
  • squarebox-entrypoint runs new refresh-dotfiles.sh on every start, re-seeding .bashrc/starship.toml over the (possibly stale) volume copy.
  • Skips any path the operator bind-mounted (desktop install path) → host-managed files are never clobbered.
  • Best-effort (set -uo pipefail, always exit 0, || true) → a dotfile refresh can never abort container boot.
  • Runs as root before the privilege drop so refreshed files get the resolved PUID:PGID.

Verification (real containers, docker build + run)

  • ✅ e2e dotfiles suite, 5/5: source present, refresh installed, live ~/.bashrc matches image source (proves start-time refresh ran), staled bashrc restored, refresh exits 0.
  • ✅ Bind-mounted read-only host bashrc preserved untouched (mountpoint guard).

Changes

  • scripts/squarebox-refresh-dotfiles.sh (new) — single source of truth
  • scripts/squarebox-entrypoint.sh — call it at both exec points
  • Dockerfile — ship managed dotfiles to the non-volume source + chmod
  • scripts/e2e-test.sh — new dotfiles suite, wired into the sqrbx-update CI job (which gates publish)
  • uat-checklist.md — manual cross-version upgrade scenario (e2e only simulates within one image)
  • CLAUDE.md + dotfiles/bashrc header — document the dual mechanism

After this lands I'd cut v1.0.0-rc3, run the manual upgrade UAT, then tag v1.0.0.

🤖 Generated with Claude Code

The pull/compose deployment path mounts only squarebox-home:/home/dev, so
the named volume shadows the image-baked dotfiles (.bashrc, starship.toml).
Docker seeds a volume from the image only at first creation, so upgraded
containers silently keep whatever dotfile shipped when their volume was born
— dotfile updates never reach them. This already bit rc1→rc2: PR #88's fzf
keybindings stayed dead on upgraded shells.

Fix: ship the managed dotfiles to a non-volume path
(/usr/local/lib/squarebox/dotfiles/) and have squarebox-entrypoint run
refresh-dotfiles.sh on every start to re-seed them over the volume copy. The
refresh skips any path the operator bind-mounted (the desktop install path),
so host-managed files are never clobbered, and is best-effort (never aborts
boot). Done as root before the privilege drop so files get the resolved
PUID:PGID.

Verified in a real container: staled volume bashrc is restored from the
image, and a read-only bind-mounted host bashrc is preserved untouched.

- scripts/squarebox-refresh-dotfiles.sh: new, single source of truth
- squarebox-entrypoint: call it at both exec points
- Dockerfile: ship managed dotfiles to the non-volume source path
- e2e: new `dotfiles` suite (5 tests), wired into the sqrbx-update CI job
- uat-checklist: manual cross-version upgrade scenario
- docs: CLAUDE.md + bashrc header explain the dual mechanism

Closes #89

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@BrettKinny
BrettKinny merged commit 3858ccf into main Jun 30, 2026
14 checks passed
@BrettKinny
BrettKinny deleted the fix/89-dotfile-volume-shadow branch June 30, 2026 11:17
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.

Persisted /home/dev volume shadows image-baked .bashrc — dotfiles/bashrc updates never reach upgraded containers

1 participant