Skip to content

refactor: migrate pnpm-store/playwright-dev/claude-dev/mistral-dev to h4_ensure_volume_writable - #88

Merged
baxyz merged 1 commit into
mainfrom
factor-volume-ownership-into-helpers4-common
Sep 8, 2026
Merged

baxyz merged 1 commit into
mainfrom
factor-volume-ownership-into-helpers4-common

Conversation

@baxyz

@baxyz baxyz commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #87 (merged, helpers4-common 1.2.0 published to GHCR).

  • Each of pnpm-store, playwright-dev, claude-dev, mistral-dev carried its own inline copy of the named-volume ownership logic. Their runtime scripts now source helpers4-common's common.sh and call h4_ensure_volume_writable instead.
  • pnpm-store / playwright-dev (exclusive-per-container volumes, keyed by ${devcontainerId}): h4_ensure_volume_writable "$PATH" — no --shared.
  • claude-dev / mistral-dev (shared-across-projects volumes, keyed by ${localEnv:USER}): h4_ensure_volume_writable "$PATH" --shared.
  • Same external behavior for all four — this is a pure internal refactor, verified against helpers4-common's already-tested branch logic (see feat(helpers4-common): add h4_ensure_volume_writable #87's test coverage).

Board card: "Factor named-volume ownership handling into helpers4-common" (Backlog, Medium priority) — closes it together with #87.

Test plan

  • bash -n syntax checks, JSON validated on all 4 features
  • Confirmed each install.sh calls h4_ensure_volume_writable exactly once, with --shared only on claude-dev/mistral-dev
  • CI (now able to resolve helpers4-common 1.2.0 from GHCR)

🤖 Generated with Claude Code

…mmon

pnpm-store, playwright-dev, claude-dev, and mistral-dev each carried their
own copy of "named volume starts root-owned, chown it for the current user"
— and it wasn't actually one pattern. pnpm-store/playwright-dev's volumes are
exclusive per container (keyed by ${devcontainerId}), so an unconditional
chown is safe. claude-dev/mistral-dev's are deliberately shared across every
concurrently-running project for the same host user (keyed by
${localEnv:USER}), where blindly chowning would steal the volume out from
under another project's still-running session — they instead claim it only
while still root-owned, and chmod o+rwX to share it once someone else already
has.

Extracts both into helpers4-common's h4_ensure_volume_writable <path>
[--shared], verified locally against all 5 branches (non-shared: no-op when
already owned, chown otherwise; shared: chown when root-owned, no-op when
already mine, chmod when owned by someone else; sudo-unavailable warning
path) with a mocked stat/id/sudo harness, then end-to-end through pnpm-store's
actual generated runtime script against a real directory.

Each dependent feature's runtime script now sources common.sh and calls the
shared helper instead of carrying its own copy — same external behavior,
single implementation of the subtler --shared case instead of four
independently-maintained ones. AGENTS.md's design-constraints section, which
still described the old copy-this-pattern approach, points at the helper now.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

✅ PR Validation Passed

All checks passed!


📋 Pipeline Status

Job Status
🧾 Conventional Commits passing
🔖 Version Bump passing
🧪 Feature Tests passing
🐚 ShellCheck passing

🤖 Generated by @helpers4 CI • 2026-09-08

@baxyz
baxyz merged commit 4db3a74 into main Sep 8, 2026
40 checks passed
@baxyz
baxyz deleted the factor-volume-ownership-into-helpers4-common branch September 8, 2026 20:35
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