fix(hooks): keep pre-commit working tree host-owned #282

Merged
David merged 1 commit from fix/dev-371-precommit-host-owned-target into main 2026-06-19 10:00:47 +02:00
Owner

What

Mount the pre-commit cargo target cache at /cargo-target (outside the /build bind mount) and set CARGO_TARGET_DIR=/cargo-target, instead of nesting the named volume at /build/target. The volume name (dev-mokosh-apps-target-${USER}) is unchanged, so the cache still persists and is shared with just dev.

Why (DEV-371)

Nesting the named target volume under the /build bind mount makes the Docker daemon materialize a root-owned ./target/ directory on the host, which then needs sudo to remove and dirties the working tree. Pointing cargo at a sibling mount keeps the host working tree fully owned by the developer. This aligns with the governance Option A standard (target cache lives outside the source bind mount).

## What Mount the pre-commit cargo target cache at `/cargo-target` (outside the `/build` bind mount) and set `CARGO_TARGET_DIR=/cargo-target`, instead of nesting the named volume at `/build/target`. The volume name (`dev-mokosh-apps-target-${USER}`) is unchanged, so the cache still persists and is shared with `just dev`. ## Why (DEV-371) Nesting the named `target` volume under the `/build` bind mount makes the Docker daemon materialize a root-owned `./target/` directory on the host, which then needs `sudo` to remove and dirties the working tree. Pointing cargo at a sibling mount keeps the host working tree fully owned by the developer. This aligns with the governance Option A standard (target cache lives outside the source bind mount).
fix(hooks): keep pre-commit working tree host-owned
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 1m29s
Create release / Create release from merged PR (pull_request) Has been skipped
c204e32df5
Mount the cargo target cache at /cargo-target (outside the /build bind mount) and point cargo at it with CARGO_TARGET_DIR, instead of nesting the named volume at /build/target, which makes the Docker daemon create a root-owned target/ on the host that needs sudo to remove. The cache still persists in the named volume. Aligns with the governance Option A standard.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

#DEV-371
David merged commit 471736c59e into main 2026-06-19 10:00:47 +02:00
David deleted branch fix/dev-371-precommit-host-owned-target 2026-06-19 10:00:48 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!282
No description provided.