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/09/21 01:48:24 UTC

(magpie) 01/01: fix(ci): exclude the vetted-ops policy from the sandbox-write-denied hooks

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch fix/prek-exclude-vetted-ops-policy
in repository https://gitbox.apache.org/repos/asf/magpie.git

commit 1d5b9c0535f824ecdca64750f6b5a8e8e95052bb
Author: Jarek Potiuk <po...@apache.org>
AuthorDate: Mon Sep 21 03:48:04 2026 +0200

    fix(ci): exclude the vetted-ops policy from the sandbox-write-denied hooks
    
    #1308 added a `permissions.deny` rule on
    `.apache-magpie-overrides/tools/vetted-ops/**` without extending the
    `sandbox_write_denied` exclude that exists for exactly this case. A deny
    rule becomes a sandbox filesystem write-deny, so end-of-file-fixer,
    mixed-line-ending and trailing-whitespace abort `prek run --all-files`
    inside an agent session with `Operation not permitted`, even though the
    file needs no fix.
    
    The policy keeps its coverage: `vetted_ops.config` parses it on every
    dispatch, so a malformed file fails the call.
    
    Also states the rule in the comment, since the coupling is easy to miss:
    a new `permissions.deny` rule on an in-repo path needs that path added
    here too.
    
    Generated-by: Claude Opus 5
---
 .pre-commit-config.yaml | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 757753eb..6b78476a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -109,14 +109,20 @@ repos:
       # and the whole run aborts, even though the files need no fix.
       # Exclude them: `.claude/settings.json` is gated by the
       # sandbox-lint baseline, the skill symlinks are validated by
-      # `symlink-lint`, and the upgrade hook script is checked for
-      # existence and correct wiring by `check-family-plugins.py`, so
-      # none of them loses coverage by skipping EOF / whitespace /
-      # line-ending normalisation here. This keeps prek a single
-      # invocation that runs cleanly in-sandbox with no bypass.
+      # `symlink-lint`, the upgrade hook script is checked for
+      # existence and correct wiring by `check-family-plugins.py`, and
+      # the vetted-ops policy is parsed by `vetted_ops.config` on every
+      # dispatch (a malformed file fails the call), so none of them
+      # loses coverage by skipping EOF / whitespace / line-ending
+      # normalisation here. This keeps prek a single invocation that
+      # runs cleanly in-sandbox with no bypass.
+      #
+      # Adding a `permissions.deny` rule on an in-repo path means adding
+      # that path here too — the deny becomes a sandbox write-deny, and
+      # every one of these three hooks aborts the run without it.
       - 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/)|plugins/magpie-setup/hooks/)
+        exclude: &sandbox_write_denied ^(\.claude/(settings\.json|skills/)|plugins/magpie-setup/hooks/|\.apache-magpie-overrides/tools/vetted-ops/)
       - id: mixed-line-ending
         name: Detect if mixed line ending is used (\r vs. \r\n)
         exclude: *sandbox_write_denied