From 83d3364ce8570d0e2693f3479b3fb1ecd5c40e01 Mon Sep 17 00:00:00 2001 From: Clayde Date: Tue, 31 Mar 2026 08:16:41 +0000 Subject: [PATCH] Fix #58: Make test execution mandatory when a test suite exists Updated implement.j2 and address_review.j2 to require that tests pass before committing. Pre-existing failures are exempt but must be mentioned in the PR summary. If no test runner is discoverable, the step is skipped. Co-Authored-By: Claude Sonnet 4.6 --- src/clayde/prompts/address_review.j2 | 4 +++- src/clayde/prompts/implement.j2 | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/clayde/prompts/address_review.j2 b/src/clayde/prompts/address_review.j2 index 59b7978..6aaf5a4 100644 --- a/src/clayde/prompts/address_review.j2 +++ b/src/clayde/prompts/address_review.j2 @@ -18,7 +18,9 @@ Steps: 1. Check out the branch: git checkout {{ branch_name }} && git pull origin {{ branch_name }} 2. Read and understand each review comment 3. Make the requested changes -4. Run tests if applicable +4. Run tests if a test command is discoverable (check CLAUDE.md, README, Makefile, package.json, pyproject.toml, justfile): + - If no test runner is discoverable, skip this step. + - If a test suite exists: ensure all tests pass after your changes (pre-existing failures are exempt). Do NOT commit if your changes introduced new test failures. 5. Commit with a clear message referencing the review, e.g.: "Address review: " 6. Push: git push origin {{ branch_name }} diff --git a/src/clayde/prompts/implement.j2 b/src/clayde/prompts/implement.j2 index 68e51d6..cfab171 100644 --- a/src/clayde/prompts/implement.j2 +++ b/src/clayde/prompts/implement.j2 @@ -18,7 +18,9 @@ Steps: 2. Create or switch to branch: git checkout -b {{ branch_name }} (or git checkout {{ branch_name }} if it exists) 3. Implement the plan carefully, following existing code style and paying attention to agents.md files if they exist 4. Write or update tests if applicable -5. Run tests if a test command is discoverable (check CLAUDE.md, README, Makefile, package.json, pyproject.toml, justfile) +5. Run tests if a test command is discoverable (check CLAUDE.md, README, Makefile, package.json, pyproject.toml, justfile): + - If no test runner is discoverable, skip this step. + - If a test suite exists: first note any pre-existing failures (run tests on the base branch before your changes if needed), then ensure all tests pass after your changes (pre-existing failures are exempt). If there are pre-existing failures, you MUST mention them in your PR summary. Do NOT commit if your changes introduced new test failures. 6. Review your own changes for correctness, edge cases, and style and run "just cleanup" if it exists before committing 7. Commit with a clear message, e.g.: "Fix #{{ number }}: " 8. Push: git push origin {{ branch_name }}