feat: enforce branches-only author mutation worktree guard (Closes #274) #374

Merged
sysadmin merged 3 commits from feat/issue-274-branches-only-worktrees into master 2026-07-07 09:33:19 -05:00
Owner

Summary

Enforce that author-side MCP mutations run only from worktrees under branches/, blocking the control checkout and paths outside the branches tree.

Changes

  • Add author_mutation_worktree assessment helpers
  • Integrate branches-only guard into verify_preflight_purity after dirty/violation checks
  • Preserve preflight ordering: worktree dirty → whoami/capability violations → reviewer violations → branches-only guard
  • Add unit and preflight integration tests

Closes #274

## Summary Enforce that author-side MCP mutations run only from worktrees under `branches/`, blocking the control checkout and paths outside the branches tree. ## Changes - Add `author_mutation_worktree` assessment helpers - Integrate branches-only guard into `verify_preflight_purity` after dirty/violation checks - Preserve preflight ordering: worktree dirty → whoami/capability violations → reviewer violations → branches-only guard - Add unit and preflight integration tests Closes #274
jcwalker3 added 1 commit 2026-07-07 04:47:11 -05:00
Add author_mutation_worktree assessment and integrate it into MCP
preflight so author mutations fail closed outside branches/ session
worktrees, with tests for control-checkout and branches-path cases.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
jcwalker3 added 1 commit 2026-07-07 08:38:30 -05:00
sysadmin requested changes 2026-07-07 08:45:15 -05:00
Dismissed
sysadmin left a comment
Owner

The implementation of the branches-only author mutation guard in _enforce_branches_only_author_mutation breaks the existing integration tests in tests/test_commit_payloads.py. Specifically, the integration tests call gitea_commit_files from a temporary directory (tempfile.TemporaryDirectory()) which does not live under branches/, and because worktree_path / environment variables are not resolved from the active issue lock file or mapped to a branches/ layout in those tests, the mutation guard blocks the call and raises a RuntimeError ('workspace is the stable control checkout' or 'is not under branches/'). Please update either the mutation workspace resolution (to fallback gracefully for tests / support lock file paths) or adapt tests/test_commit_payloads.py to use a branches/ layout so that the test suite passes.

The implementation of the branches-only author mutation guard in `_enforce_branches_only_author_mutation` breaks the existing integration tests in `tests/test_commit_payloads.py`. Specifically, the integration tests call `gitea_commit_files` from a temporary directory (`tempfile.TemporaryDirectory()`) which does not live under `branches/`, and because `worktree_path` / environment variables are not resolved from the active issue lock file or mapped to a `branches/` layout in those tests, the mutation guard blocks the call and raises a `RuntimeError` ('workspace is the stable control checkout' or 'is not under branches/'). Please update either the mutation workspace resolution (to fallback gracefully for tests / support lock file paths) or adapt `tests/test_commit_payloads.py` to use a `branches/` layout so that the test suite passes.
jcwalker3 added 1 commit 2026-07-07 09:31:28 -05:00
Merge prgs/master into feat/issue-274-branches-only-worktrees; keep both
already_landed_reconcile and author_mutation_worktree imports. Allow
branches/ worktrees when PROJECT_ROOT is the session worktree; align
commit-payload tests with branches-only guard (#274).
sysadmin approved these changes 2026-07-07 09:33:14 -05:00
sysadmin left a comment
Owner

The implementation of the branches-only author mutation worktree guard has been verified. The new head SHA resolves the previous integration test failure, and the entire test suite passes cleanly. Approved.

The implementation of the branches-only author mutation worktree guard has been verified. The new head SHA resolves the previous integration test failure, and the entire test suite passes cleanly. Approved.
sysadmin merged commit 273eba7fb3 into master 2026-07-07 09:33:19 -05:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#374