fix: scope patch audits to the selected project root - #210
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 7:26 PM ET / 23:26 UTC. ClawSweeper reviewWhat this changesThe PR makes patch audits use project-relative Git paths, exclude project state and sibling changes, and record both sides of renames, with regression tests and documentation. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main and v0.8.0 retain the faulty audit path. No blocking correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherClawpatch checks workspace changes before running a repair and fingerprints changed files to record the patch. Those records later identify the files used by the explicit PR-creation workflow. flowchart TD
A[Selected project root] --> B[Git workspace changes]
B --> C[Project-relative path filtering]
C --> D[Exclude project state]
D --> E[Clean workspace check]
D --> F[Before and after fingerprints]
F --> G[Patch file records]
G --> H[Explicit PR creation]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Use one project-relative Git boundary for review filtering and patch auditing, preserving state exclusion, rename pairs, and non-Git fallback behavior. Do we have a high-confidence way to reproduce the issue? Yes: main combines repository-relative Git paths with project-relative state filtering and file reads, establishing the nested-root failure directly. The contributor reports a matching before/after CLI run; this review did not execute it. Is this the best way to solve the issue? Yes: reusing the existing dirtyFiles boundary is the narrowest maintainable repair and matches the downstream expectation that patch paths are project-relative. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b979f94701be. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
clawpatch --root app fix ...could reject a clean monorepo project because Git reports paths relative to the repository, while Clawpatch filtered state and read file contents relative toapp. State files and sibling changes looked like source edits, and actual content edits could be fingerprinted at nonexistentapp/app/...paths. Rename audit records also omitted the original path.User Impact
Nested-project repairs ignore their own state and sibling-project edits, fingerprint the correct source files, and record both sides of renames using project-relative paths.
Why This Change Was Made
Reuse the existing
dirtyFilesGit boundary, which already canonicalizes project and Git roots, filters outside-project paths, and preserves rename pairs. Remove the separate status parser from change auditing and tighten the snapshot return type to its actual always-present map.Evidence
appproject, generated state, and a sibling file exits 3:dirty worktree blocks fix.fix --provider mockwith exit 0 and statusapplied, preserving the sibling file. No model API calls are involved in this deterministic workflow proof.pnpm typecheck,pnpm lint, focused audit/Git/workflow tests (131 passed), andpnpm buildpass.