fix(hooks): mount cargo target outside bind mount via CARGO_TARGET_DIR #16

Merged
David merged 2 commits from fix/dev-371-precommit-host-owned-target into main 2026-06-19 09:59:35 +02:00
Owner

What

Move the dev-youtrack-mcp-cargo-target named volume in the just pre-commit recipe from /build/target to /cargo-target (outside the /build bind mount) and point cargo at it with --env CARGO_TARGET_DIR=/cargo-target on each of the four cargo steps. The volume name is unchanged, so the cache still persists.

Why (DEV-371)

Nesting the named volume at /build/target inside the /build host bind mount makes the Docker daemon materialize a root-owned ./target directory on the host, which then needs sudo to remove. Mounting the cache outside the bind mount keeps the host working tree clean.

Governance

Implements Option A from the governance standard: relocate the target cache off the bind mount and select it via CARGO_TARGET_DIR.

## What Move the `dev-youtrack-mcp-cargo-target` named volume in the `just pre-commit` recipe from `/build/target` to `/cargo-target` (outside the `/build` bind mount) and point cargo at it with `--env CARGO_TARGET_DIR=/cargo-target` on each of the four cargo steps. The volume name is unchanged, so the cache still persists. ## Why (DEV-371) Nesting the named volume at `/build/target` inside the `/build` host bind mount makes the Docker daemon materialize a root-owned `./target` directory on the host, which then needs `sudo` to remove. Mounting the cache outside the bind mount keeps the host working tree clean. ## Governance Implements Option A from the governance standard: relocate the target cache off the bind mount and select it via `CARGO_TARGET_DIR`.
fix(hooks): mount cargo target outside bind mount via CARGO_TARGET_DIR
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 5m29s
93b0caee4e
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; only its mount path moves off the bind mount. Aligns with the governance Option A standard.

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

#DEV-371
Merge branch 'main' into fix/dev-371-precommit-host-owned-target
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / fmt + clippy + build + tests (pull_request) Successful in 35s
123fdbad9e
David merged commit 1f8b2a866c into main 2026-06-19 09:59:35 +02:00
David deleted branch fix/dev-371-precommit-host-owned-target 2026-06-19 09:59:36 +02:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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
pandoras-box/youtrack-mcp!16
No description provided.