refactor: migrate pnpm-store/playwright-dev/claude-dev/mistral-dev to h4_ensure_volume_writable - #88
Merged
Conversation
…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>
✅ PR Validation Passed
📋 Pipeline Status
🤖 Generated by @helpers4 CI • 2026-09-08 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #87 (merged,
helpers4-common1.2.0 published to GHCR).pnpm-store,playwright-dev,claude-dev,mistral-devcarried its own inline copy of the named-volume ownership logic. Their runtime scripts now sourcehelpers4-common'scommon.shand callh4_ensure_volume_writableinstead.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.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 -nsyntax checks, JSON validated on all 4 featuresinstall.shcallsh4_ensure_volume_writableexactly once, with--sharedonly onclaude-dev/mistral-devhelpers4-common1.2.0 from GHCR)🤖 Generated with Claude Code