feat(helpers4-common): add h4_ensure_volume_writable - #87
Merged
Merged
Conversation
Four features (pnpm-store, playwright-dev, claude-dev, mistral-dev) each
carry their own copy of "named volume starts root-owned, chown it for the
current user" — not 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.
Adds h4_ensure_volume_writable <path> [--shared] covering both cases in one
implementation. 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.
Landing this on its own first, ahead of migrating the four consumers to call
it: `devcontainer features test` resolves a consumer's `dependsOn` on
helpers4-common from the *published* GHCR registry, not this repo's local
src/ tree, so a consumer PR bundled with this one would fail its own CI
against a not-yet-published function (see AGENTS.md's existing note on this
exact sequencing issue).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
✅ PR Validation Passed
📋 Pipeline Status
🤖 Generated by @helpers4 CI • 2026-09-08 |
Merged
3 tasks
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
pnpm-store,playwright-dev,claude-dev,mistral-dev) each carry their own copy of "named volume starts root-owned, chown it for the current user" — not 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, andchmod o+rwXto share it once someone else already has.h4_ensure_volume_writable <path> [--shared]covering both cases in one implementation.stat/id/sudoharness.AGENTS.md's design-constraints note (which still described the old copy-this-pattern approach) to point at the new helper.Sequencing: landing this on its own first, ahead of migrating the four consumers to call it —
devcontainer features testresolves a consumer'sdependsOnonhelpers4-commonfrom the published GHCR registry, not this repo's localsrc/tree, so a consumer PR bundled with this one would fail its own CI against a not-yet-published function (AGENTS.md already documents this exact sequencing issue). The four-consumer migration PR needsrelease.ymlrun manually after this merges, to actually publishhelpers4-common1.2.0 to GHCR before that PR's CI can resolve the new function.Board card: "Factor named-volume ownership handling into helpers4-common" (Backlog, Medium priority).
Test plan
bash -nsyntax check, JSON validatedh4_ensure_volume_writable🤖 Generated with Claude Code