zara-coding: add stale-safe approval-gated branch deletion #464

Open
nsaspy wants to merge 5 commits from rage/1-zara-coding-branch-delete into main
Owner

Advances #1.

Adds coding.git.branch.delete as a narrowly destructive, canonical-approval-gated Git operation.

Safety contract:

  • requires zara_requires_approval=true;
  • repository stays inside configured allowed roots;
  • validates the branch ref with Git;
  • requires a full 40- or 64-hex expected object ID rather than a symbolic revision;
  • scans the bounded canonical worktree inventory and refuses deletion if the branch is checked out anywhere;
  • uses git update-ref -d <ref> <expected_head> so a moved/stale branch fails closed;
  • exposes no arbitrary Git argv and uses bounded shell=False execution.

The compare-and-set deletion behavior was also checked against a real temporary Git repo: matching expected head deletes; stale expected head is rejected.

RED-first commit 68db4c9d; domain/tool/surface-contract/docs follow. Full registry/plugin/Nix CI required before merge.

Advances #1. Adds `coding.git.branch.delete` as a narrowly destructive, canonical-approval-gated Git operation. Safety contract: - requires `zara_requires_approval=true`; - repository stays inside configured allowed roots; - validates the branch ref with Git; - requires a full 40- or 64-hex expected object ID rather than a symbolic revision; - scans the bounded canonical worktree inventory and refuses deletion if the branch is checked out anywhere; - uses `git update-ref -d <ref> <expected_head>` so a moved/stale branch fails closed; - exposes no arbitrary Git argv and uses bounded `shell=False` execution. The compare-and-set deletion behavior was also checked against a real temporary Git repo: matching expected head deletes; stale expected head is rejected. RED-first commit `68db4c9d`; domain/tool/surface-contract/docs follow. Full registry/plugin/Nix CI required before merge.
Some checks failed
CI / test (pull_request) Failing after 20s
This pull request has changes conflicting with the target branch.
  • plugins/zara-coding/README.md
  • plugins/zara-coding/test/test_plugin.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin rage/1-zara-coding-branch-delete:rage/1-zara-coding-branch-delete
git switch rage/1-zara-coding-branch-delete

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff rage/1-zara-coding-branch-delete
git switch rage/1-zara-coding-branch-delete
git rebase main
git switch main
git merge --ff-only rage/1-zara-coding-branch-delete
git switch rage/1-zara-coding-branch-delete
git rebase main
git switch main
git merge --no-ff rage/1-zara-coding-branch-delete
git switch main
git merge --squash rage/1-zara-coding-branch-delete
git switch main
git merge --ff-only rage/1-zara-coding-branch-delete
git switch main
git merge rage/1-zara-coding-branch-delete
git push origin main
Sign in to join this conversation.
No description provided.