You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by po...@apache.org on 2026/07/10 13:24:52 UTC
(magpie) branch main updated: build(prek): exclude sandbox write-denied paths from in-place fixers (#803)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/magpie.git
The following commit(s) were added to refs/heads/main by this push:
new faf3d2dd build(prek): exclude sandbox write-denied paths from in-place fixers (#803)
faf3d2dd is described below
commit faf3d2dd6b1977372583ea9117e1ae908d6767fa
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Fri Jul 10 15:24:46 2026 +0200
build(prek): exclude sandbox write-denied paths from in-place fixers (#803)
The end-of-file-fixer, mixed-line-ending, and trailing-whitespace hooks
open every matched file read-write before deciding whether a fix is
needed. On `prek run --all-files` (agent-pre-commit.sh and the CI
mirror) that read-write open hits `.claude/settings.json` and the
`.claude/skills/*` symlinks, which the secure-agent sandbox
write-denies — so the run aborted with "Operation not permitted" and
agents had to disable the sandbox just to run prek.
Exclude those two write-denied path sets from the three fixers. They
lose no coverage: `.claude/settings.json` is gated by the sandbox-lint
baseline and the skill symlinks by symlink-lint. prek is now a single
invocation that runs cleanly in-sandbox on commit, on --all-files, and
in CI, with no bypass.
Co-authored-by: Tester <t...@example.com>
---
.pre-commit-config.yaml | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index caf59f39..c347e588 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -91,12 +91,29 @@ repos:
name: Check that merge conflicts are not being committed
- id: detect-private-key
name: Detect if private key is added to the repository
+ # The next three hooks are *fixers*: they open every matched file
+ # in read-write mode (to normalise it in place) before checking
+ # whether a fix is even needed. The secure-agent sandbox
+ # write-denies two tracked path sets — the agent's own config
+ # (`.claude/settings.json`) and the self-adoption skill relays
+ # (`.claude/skills/*` symlinks) — because agents must never modify
+ # them. So on `prek run --all-files` (which `agent-pre-commit.sh`
+ # and the CI mirror both run) the read-write `open()` on those
+ # paths is denied and the whole run aborts, even though the files
+ # need no fix. Exclude them: `.claude/settings.json` is gated by
+ # the sandbox-lint baseline and the skill symlinks are validated by
+ # `symlink-lint`, so neither loses coverage by skipping EOF /
+ # whitespace / line-ending normalisation here. This keeps prek a
+ # single invocation that runs cleanly in-sandbox with no bypass.
- id: end-of-file-fixer
name: Make sure that there is an empty line at the end
+ exclude: &sandbox_write_denied ^\.claude/(settings\.json|skills/)
- id: mixed-line-ending
name: Detect if mixed line ending is used (\r vs. \r\n)
+ exclude: *sandbox_write_denied
- id: trailing-whitespace
name: Remove trailing whitespace at end of line
+ exclude: *sandbox_write_denied
# markdownlint — catches structurally-bad markdown. Config in
# `.markdownlint.json` enables only the rules that catch real bugs
# (broken anchors via MD051, dangling link references via MD053);