Repository navigation
docs: tighten tdd workflow red-green validation - #896
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds a "Git Checkpoints" section to the TDD workflow requiring checkpoint commits after RED (mandatory for production changes), after GREEN (confirming the same test target), and after REFACTOR; tightens RED/GREEN validation rules, forbids editing production code before RED confirmation, and recommends checkpoint commit messages. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Test as Test Runner
participant Git as Git Repo
participant Prod as Production Code
Dev->>Test: Add failing test that exercises buggy path
Test->>Dev: Fails (runtime RED) or fails to compile as intended (compile-time RED)
Dev->>Git: Create RED checkpoint commit (`test: add reproducer...`)
Dev->>Prod: Implement minimal change (no prod edits before RED)
Dev->>Test: Rerun the same relevant test target
Test->>Dev: Previously failing test passes (GREEN)
Dev->>Git: Create GREEN checkpoint commit (`fix: ...`)
Dev->>Prod: Refactor while tests remain green
Dev->>Test: Run tests to confirm green
Test->>Dev: Tests remain green
Dev->>Git: Create REFACTOR checkpoint commit (`refactor: ...`)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR tightens the
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([Start TDD Cycle]) --> B[Step 1-2: Write User Journeys\nand Generate Test Cases]
B --> C[Step 3: Run Tests]
C --> D{Valid RED?}
D -->|Unrelated failure\ne.g. broken setup| C
D -->|Runtime RED\ntest executes and fails| E
D -->|Compile-time RED\nnew test exposes buggy path| E
E[🔴 RED Validated] --> F["Git Checkpoint\n`test: add reproducer for <feature or bug>`"]
F --> G[Step 4: Implement Minimal Fix\nStage changes — defer commit]
G --> H[Step 5: Run Tests Again]
H --> I{GREEN?}
I -->|Still failing| G
I -->|All pass| J[✅ GREEN Validated]
J --> K["Git Checkpoint\n`feat: implement <feature>` or `fix: resolve <bug>`"]
K --> L[Step 6: Refactor\nKeep tests green]
L --> M[Step 7: Verify Coverage\n80%+ required]
M --> N{"Coverage\n≥ 80%?"}
N -->|No| L
N -->|Yes| O["Optional Git Checkpoint\n`refactor: clean up after <feature or bug> implementation`"]
O --> P([TDD Cycle Complete])
Reviews (6): Last reviewed commit: "adjust: scope tdd checkpoints to active ..." | Re-trigger Greptile |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
skills/tdd-workflow/SKILL.md (1)
100-118: Strong RED-gate validation that addresses all PR objectives.This enhancement provides comprehensive guidance that prevents common TDD pitfalls:
- Distinguishes intended failures from unrelated issues (lines 106-108)
- Explicitly allows compile-time RED when exposing the bug (line 107)
- Prevents premature production changes (line 112)
- Requires actual test execution (line 110)
The Git checkpoint guidance (lines 114-118) with recommended commit format is clear and actionable.
✨ Minor style refinement
Line 102 could be slightly more concise:
-Before modifying business logic or other production code, you must verify all of the following: +Before modifying business logic or other production code, you must verify the following:This addresses the static analysis style hint, though the current wording is perfectly clear.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/tdd-workflow/SKILL.md` around lines 100 - 118, The paragraph starting "This step is mandatory and is the RED gate for all production changes." is a bit wordy; please tighten that sentence for style by combining redundant phrases and using a more concise construction (e.g., "This step is the mandatory RED gate for production changes.")—edit the SKILL.md content around that sentence to use the shorter phrasing while keeping all existing validation bullets and the Git checkpoint guidance unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@skills/tdd-workflow/SKILL.md`:
- Around line 100-118: The paragraph starting "This step is mandatory and is the
RED gate for all production changes." is a bit wordy; please tighten that
sentence for style by combining redundant phrases and using a more concise
construction (e.g., "This step is the mandatory RED gate for production
changes.")—edit the SKILL.md content around that sentence to use the shorter
phrasing while keeping all existing validation bullets and the Git checkpoint
guidance unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 18caaee5-d57b-4673-b4dd-f1401b2f8913
📒 Files selected for processing (1)
skills/tdd-workflow/SKILL.md
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="skills/tdd-workflow/SKILL.md">
<violation number="1" location="skills/tdd-workflow/SKILL.md:103">
P2: Step 3 defines contradictory RED criteria by requiring successful compilation while also allowing compile-time RED failures.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
skills/tdd-workflow/SKILL.md (2)
103-103: Consider consolidating redundant compile-time RED explanations.Lines 103 and 107 both explain when compile-time RED is valid. The guidance would be clearer with a single, consolidated explanation.
♻️ Proposed consolidation
Merge the concepts into line 103 and remove line 107:
-Before modifying business logic or other production code, you must verify all of the following: -- The relevant test target compiles successfully, or the compile failure is itself the RED signal (i.e., the new test instantiates the buggy code path and a compile-time RED is the intended failure) +Before modifying business logic or other production code, you must verify all the following: +- The relevant test target compiles successfully, or the compile failure is itself the RED signal when the new test newly instantiates, references, or exercises the buggy code path and exposes the intended defect - The new or changed test is actually executed - The result is RED - The failure is caused by the intended business-logic bug, undefined behavior, or missing implementation -- A compile-time RED is valid if the new test newly instantiates, references, or exercises the buggy code path and exposes the intended defect - The failure is not caused only by unrelated syntax errors, broken test setup, missing dependencies, or unrelated regressionsThis also addresses the LanguageTool suggestion to use "all the following" for conciseness.
Also applies to: 107-107
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/tdd-workflow/SKILL.md` at line 103, Consolidate the two redundant explanations about compile-time RED into a single sentence by merging the content of the line starting "The relevant test target compiles successfully, or the compile failure is itself the RED signal..." and removing the later duplicate around line 107; rephrase to the concise form "All the following must hold: the relevant test target compiles successfully, or a compile-time failure is the intended RED (e.g., the new test instantiates the buggy code path)" so the guidance is clear, non-redundant, and uses "all the following" as suggested by LanguageTool.
108-108: Clarify "not caused only by" to avoid ambiguity.The phrase "not caused only by" could be misinterpreted as allowing failures that are partially caused by unrelated issues. Consider rephrasing for clarity.
♻️ Proposed clarification
-- The failure is not caused only by unrelated syntax errors, broken test setup, missing dependencies, or unrelated regressions +- The failure is not caused by unrelated syntax errors, broken test setup, missing dependencies, or unrelated regressionsAlternative if you want to be more explicit:
-- The failure is not caused only by unrelated syntax errors, broken test setup, missing dependencies, or unrelated regressions +- The failure stems from the intended defect, not from unrelated syntax errors, broken test setup, missing dependencies, or unrelated regressions🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/tdd-workflow/SKILL.md` at line 108, Reword the ambiguous phrase "not caused only by" to a clearer statement that the failing test must be attributable to the student's change rather than solely to unrelated issues; replace the line with something like "The failure must be caused by the student's change and not solely by unrelated syntax errors, broken test setup, missing dependencies, or external regressions" so readers understand the failure must primarily stem from the submitted change (reference the existing sentence containing "not caused only by" in SKILL.md).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@skills/tdd-workflow/SKILL.md`:
- Line 103: Consolidate the two redundant explanations about compile-time RED
into a single sentence by merging the content of the line starting "The relevant
test target compiles successfully, or the compile failure is itself the RED
signal..." and removing the later duplicate around line 107; rephrase to the
concise form "All the following must hold: the relevant test target compiles
successfully, or a compile-time failure is the intended RED (e.g., the new test
instantiates the buggy code path)" so the guidance is clear, non-redundant, and
uses "all the following" as suggested by LanguageTool.
- Line 108: Reword the ambiguous phrase "not caused only by" to a clearer
statement that the failing test must be attributable to the student's change
rather than solely to unrelated issues; replace the line with something like
"The failure must be caused by the student's change and not solely by unrelated
syntax errors, broken test setup, missing dependencies, or external regressions"
so readers understand the failure must primarily stem from the submitted change
(reference the existing sentence containing "not caused only by" in SKILL.md).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 72755ac3-be8b-44ff-96ff-e8b5627b2705
📒 Files selected for processing (1)
skills/tdd-workflow/SKILL.md
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
thanks for the pr. triaged and queued for maintainer review. |
|
Tested manually: Two commits added Fix is in the 2nd commit Tests are in the 1st commit |
…ed-green-guards docs: tighten tdd workflow red-green validation
Why
In practice, the current
tdd-workflowwording still leaves room for ambiguous behavior:What Changed
test + RED,fix + GREEN, optionalrefactorSummary by cubic
Refines the TDD workflow docs to require a validated RED before any production changes, with clear runtime vs compile-time criteria and guards against unrelated failures. Adds a Git checkpoint flow with commit-after-RED and defer-fix-until-GREEN rules, scoped to commits on the current active branch and reachable from HEAD, no squashing until complete, plus compact message templates that capture evidence; separate evidence-only commits aren’t needed when RED/GREEN is shown.
Written for commit 9cc5d08. Summary will update on new commits.
Summary by CodeRabbit