Skip to content

fix: generalize workflow-gate orthogonal relief to all phases, allow out-of-repo paths (#164)#327

Merged
azalio merged 1 commit into
mainfrom
fix/164-orthogonal-relief-all-phases-out-of-repo
Jul 3, 2026
Merged

fix: generalize workflow-gate orthogonal relief to all phases, allow out-of-repo paths (#164)#327
azalio merged 1 commit into
mainfrom
fix/164-orthogonal-relief-all-phases-out-of-repo

Conversation

@azalio

@azalio azalio commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Single-source change in src/mapify_cli/templates_src/hooks/workflow-gate.py.jinja and its codex sibling src/mapify_cli/templates_src/codex/hooks/workflow-gate.py.jinja, rendered into all 4 generated trees (.claude/hooks/, .codex/hooks/, both templates/ mirrors) via make render-templates.

Test plan

  • pytest tests/test_workflow_gate.py -v — 52/52 passed, including 5 new tests (INIT_STATE relief, INIT_STATE counter-test, INIT_STATE out-of-repo repro, DECOMPOSE out-of-repo, DECOMPOSE in-repo counter-test) and the flipped test_research_orthogonal_out_of_repo_allowed
  • Audited and fixed ~22 tests using an absolute /test.py placeholder path that incidentally resolved outside tmp_path (would have silently flipped 8 DENY-asserting tests to ALLOW under the new out-of-repo relief) — changed to a repo-relative path; verified none of the ALLOW-asserting tests depended on the old out-of-repo resolution
  • make check (lint + full test suite + check-render) — 3255 passed, 3 skipped, 12 deselected, all green
  • /security-review on the diff — no findings (this hook is a process-discipline nudge for an already-fully-trusted local agent, not a privilege boundary; file_path is never attacker-controlled; scope_glob still enforces independently after the relief)

Closes #164

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Edits that are clearly outside the current subtask’s allowed file scope are now permitted across more blocked phases.
    • Paths that resolve outside the repository are treated as allowed orthogonal edits.
  • Bug Fixes

    • Reduced overly conservative blocking for out-of-repo paths and other orthogonal file changes.
    • Updated denial messages to better explain when edits are allowed.

…out-of-repo paths (#164)

The RESEARCH-phase relief added in #174 scoped Edit/Write blocking to the
current subtask's affected_files, but only during RESEARCH, and it
deliberately kept blocking any path resolving entirely outside the repo.
A second report against neuro-vlad hit the identical block during
INIT_STATE while editing ~/.claude/CLAUDE.md, a path outside that repo's
tree entirely.

is_orthogonal_to_current_subtask() now treats out-of-repo paths as
unconditionally orthogonal (no subtask's affected_files can ever
legitimately name a path outside the repo it was declared in), and the
orthogonal-relief exception in main() now fires for any blocking phase,
not just RESEARCH. scope_glob constraints still apply independently
after the relief when configured.

Updated ~22 tests using an absolute "/test.py" placeholder path that
incidentally resolved outside the tmp_path repo root (would have
silently flipped from DENY to ALLOW under the new out-of-repo relief)
to a repo-relative path, added 5 new tests covering the INIT_STATE and
DECOMPOSE cases, and flipped the existing out-of-repo test to its new
expected behavior.

The Bash-write bypass (cat >, tee, sed -i) remains a documented,
deliberately deferred limitation.
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 27aabcc5-7bbd-439d-9ef8-93137ae10507

📥 Commits

Reviewing files that changed from the base of the PR and between a2efe3a and 801a3bd.

📒 Files selected for processing (9)
  • .claude/hooks/workflow-gate.py
  • .codex/hooks/workflow-gate.py
  • CHANGELOG.md
  • src/mapify_cli/templates/codex/hooks/workflow-gate.py
  • src/mapify_cli/templates/hooks/workflow-gate.py
  • src/mapify_cli/templates_src/codex/hooks/workflow-gate.py.jinja
  • src/mapify_cli/templates_src/hooks/workflow-gate.py.jinja
  • tests/test_mapify_cli.py
  • tests/test_workflow_gate.py

📝 Walkthrough

Walkthrough

The workflow gate's orthogonality check now treats any path that cannot be normalized to a repo-relative path as automatically orthogonal (allowed), and the "orthogonal hotfix" exception in main() was broadened from RESEARCH-only to all blocking phases across six duplicated hook implementations, with corresponding changelog, message, and test updates.

Changes

Workflow gate orthogonal relief

Layer / File(s) Summary
Core gate logic
.claude/hooks/workflow-gate.py, .codex/hooks/workflow-gate.py
is_orthogonal_to_current_subtask now returns True immediately for paths unresolvable to repo-relative form; deny messages and main()'s orthogonal-hotfix exception were generalized from RESEARCH-only to all blocking phases.
Template copies
src/mapify_cli/templates/{codex/,}hooks/workflow-gate.py, src/mapify_cli/templates_src/{codex/,}hooks/workflow-gate.py.jinja
Same orthogonality, messaging, and main() exception changes mirrored across all packaged template and jinja source copies.
Changelog and tests
CHANGELOG.md, tests/test_workflow_gate.py, tests/test_mapify_cli.py
Changelog documents the broadened relief; test fixtures updated to repo-relative paths, RESEARCH out-of-repo test flipped to expect allow, and new tests added for INIT_STATE/DECOMPOSE orthogonal relief.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

Poem

A hop through six files, all in a row,
"Blocked!" said the gate, but now let it go—
Paths far outside get a free pass at last,
Not just in RESEARCH, but every phase cast. 🐇
Tests all renamed, relative and neat,
This bunny approves — the gate's now complete! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: expanding orthogonal relief to all blocking phases and allowing out-of-repo paths.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/164-orthogonal-relief-all-phases-out-of-repo

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@azalio azalio merged commit 228b0d0 into main Jul 3, 2026
7 checks passed
@azalio azalio deleted the fix/164-orthogonal-relief-all-phases-out-of-repo branch July 3, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

workflow-gate blocks Edit/Write during RESEARCH for unrelated/orthogonal fixes (and is bypassable via Bash)

1 participant