Skip to content

Add test-coverage workflow helper script and progress tracker#18

Open
Copilot wants to merge 11 commits intomasterfrom
copilot/add-test-coverage-script
Open

Add test-coverage workflow helper script and progress tracker#18
Copilot wants to merge 11 commits intomasterfrom
copilot/add-test-coverage-script

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 17, 2026

The repository needed a test-coverage-ralph.sh script that drives a one-test-per-iteration coverage loop and a test-coverage-progress.txt tracker, matching the provided workflow prompt requirements. This PR adds those artifacts under the workflows/test-coverage/ workflow structure and ensures they are validated by existing workflow tests.

  • Coverage loop helper script

    • Adds workflows/test-coverage/test-coverage-ralph.sh with iteration validation, tooling checks, and a structured prompt for Claude sandbox runs
    • Uses the workflow-local test-coverage-progress.txt path for context
  • Progress tracker artifact

    • Adds workflows/test-coverage/test-coverage-progress.txt as the append-only notes target for iterations
  • Workflow validation

    • Extends workflow tests to assert the helper script exists, is executable, and includes the guardrail language in its prompt

Example snippet:

prompt=$(cat << EOF
@/path/to/workflows/test-coverage/test-coverage-progress.txt
Use the notes from /path/to/workflows/test-coverage/test-coverage-progress.txt as context for prior coverage progress.
WHAT MAKES A GREAT TEST:
...
ONLY WRITE ONE TEST PER ITERATION.
EOF
)
result=$(docker sandbox run claude "$prompt")
Original prompt

test-coverage-ralph.sh
1 set -e
A Ralph script for writing tests on untested features:
3 if [ -z "$1" ]; then
4 echo "Usage: $0 "
5 exit 1
6 fi
7
8 for (( i = 1 ;i<=$1;i++)) do
9 result=$(docker sandbox run claude "@test-coverage-progress.txt
10 WHAT MAKES A GREAT TEST:
11 A great test covers behavior users depend on. It tests a feature that, if broken, would frustrate or block users.
12 It validates real workflows not implementation details. It catches regressions before users do.
13 Do NOT write tests just to increase coverage. Use coverage as a guide to find UNTESTED USER-FACING BEHAVIOR.
14 If uncovered code is not worth testing (boilerplate, unreachable error branches, internal plumbing),
15 add /* v8 ignore next / or / v8 ignore start */ comments instead of writing low-value tests.
16
17 PROCESS:
18 1. Run pnpm coverage to see which files have low coverage.
19 2. Read the uncovered lines and identify the most important USER-FACING FEATURE that lacks tests.
20 Prioritize: error handling users will hit, CLI commands, git operations, file parsing.
21 Deprioritize: internal utilities, edge cases users won't encounter, boilerplate.
22 3. Write ONE meaningful test that validates the feature works correctly for users.
23 4. Run pnpm coverage again coverage should increase as a side effect of testing real behavior.
24 5. Commit with message: test():
25 6. Append super-concise notes to test-coverage-progress.txt: what you tested, coverage %, any learnings.
26
27 ONLY WRITE ONE TEST PER ITERATION.
28 If statement coverage reaches 100%, output COMPLETE.
29 ")
30
32
echo "$result" 31
33 if [[ "$result" == "COMPLETE" ]]; then
34 echo "100% coverage reached, exiting."
35 tt notify "AI Hero CLI: 100% coverage after $i iterations"
36 exit 0
37 fi
38 done


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 17, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

Copilot AI and others added 2 commits January 17, 2026 13:40
Co-authored-by: OctavianTocan <55554752+OctavianTocan@users.noreply.github.com>
Co-authored-by: OctavianTocan <55554752+OctavianTocan@users.noreply.github.com>
@OctavianTocan
Copy link
Copy Markdown
Owner

@copilot This PR doesn't follow the way the project structures Ralph features. You have just added scripts at random.

Copilot AI and others added 7 commits January 17, 2026 13:44
Co-authored-by: OctavianTocan <55554752+OctavianTocan@users.noreply.github.com>
Co-authored-by: OctavianTocan <55554752+OctavianTocan@users.noreply.github.com>
Co-authored-by: OctavianTocan <55554752+OctavianTocan@users.noreply.github.com>
Co-authored-by: OctavianTocan <55554752+OctavianTocan@users.noreply.github.com>
Co-authored-by: OctavianTocan <55554752+OctavianTocan@users.noreply.github.com>
Co-authored-by: OctavianTocan <55554752+OctavianTocan@users.noreply.github.com>
Co-authored-by: OctavianTocan <55554752+OctavianTocan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Ralph script for writing tests on untested features Add test coverage workflow helper script and progress tracker Jan 17, 2026
Copilot AI requested a review from OctavianTocan January 17, 2026 13:54
Co-authored-by: OctavianTocan <55554752+OctavianTocan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 17, 2026

@copilot This PR doesn't follow the way the project structures Ralph features. You have just added scripts at random.

Moved the test-coverage helper script and progress file under workflows/test-coverage and updated workflow tests accordingly in 07d64e3. No UI changes.

Copilot AI changed the title Add test coverage workflow helper script and progress tracker Add test-coverage workflow helper script and progress tracker Jan 17, 2026
@OctavianTocan OctavianTocan marked this pull request as ready for review January 18, 2026 23:46
Copilot AI review requested due to automatic review settings January 18, 2026 23:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds infrastructure for a test-coverage workflow that uses Claude in a Docker sandbox to iteratively improve test coverage. The implementation provides a helper script that runs coverage improvements in a loop and a progress tracking file for maintaining iteration history.

Changes:

  • Added test-coverage-ralph.sh bash script with iteration validation, Docker/pnpm dependency checks, and a structured prompt for Claude
  • Added test-coverage-progress.txt as an append-only notes file for tracking coverage progress across iterations
  • Extended workflow tests to verify the helper script exists, is executable, and contains required guardrail text

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
workflows/test-coverage/test-coverage-ralph.sh New helper script that runs iterative test coverage improvements using Claude in Docker sandbox with validation and error handling
workflows/test-coverage/test-coverage-progress.txt New progress tracker template file for documenting test coverage improvements per iteration
tests/test-workflows.sh Added tests to verify the helper script exists, is executable, and contains the "ONLY WRITE ONE TEST" guardrail, plus a test for the progress file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

3. Write ONE meaningful test that validates the feature works correctly for users.
4. Run pnpm coverage again. Coverage should increase as a side effect of testing real behavior.
5. Commit with message: test(<file>): <describe the user behavior being tested>
6. Append super-concise notes to test-coverage-progress.txt: what you tested, coverage %, any learnings.
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent file path reference in the prompt. Earlier in the prompt (lines 31-32), the progress file is referenced with its full path via ${PROGRESS_FILE}, but here on line 48, it's referenced as just "test-coverage-progress.txt" without a path. This inconsistency could confuse Claude about which file to write to, especially if the script is run from a different directory. Consider changing this line to reference the full path consistently, e.g., "Append super-concise notes to ${PROGRESS_FILE}: what you tested, coverage %, any learnings."

Suggested change
6. Append super-concise notes to test-coverage-progress.txt: what you tested, coverage %, any learnings.
6. Append super-concise notes to ${PROGRESS_FILE}: what you tested, coverage %, any learnings.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,68 @@
#!/bin/bash
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing script documentation. Following the pattern used by other scripts in this codebase (like status.sh and stop.sh), this script should include a comment block after the shebang that describes what the script does and how to use it. Consider adding something like:

Test Coverage Ralph Helper

Runs an iterative test coverage improvement loop using Claude in a Docker sandbox

Usage: ./test-coverage-ralph.sh <iterations>

Suggested change
#!/bin/bash
#!/bin/bash
# Test Coverage Ralph Helper
# Runs an iterative test coverage improvement loop using Claude in a Docker sandbox
# Usage: ./test-coverage-ralph.sh <iterations>

Copilot uses AI. Check for mistakes.
fi
exit 0
fi
done
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing user feedback when iterations complete without reaching 100% coverage. If the loop completes all iterations without Claude outputting the COMPLETE promise, the script exits silently with no message indicating whether the target was reached or more iterations are needed. Consider adding an informational message after line 68 to indicate that all iterations completed and suggest checking the progress file or running additional iterations if the coverage target hasn't been met.

Suggested change
done
done
echo "Completed $1 iterations without receiving the <promise>COMPLETE</promise> signal."
echo "Check $PROGRESS_FILE for current coverage status and run additional iterations if needed."

Copilot uses AI. Check for mistakes.
Use the notes from ${PROGRESS_FILE} as context for prior coverage progress.
WHAT MAKES A GREAT TEST:
A great test covers behavior users depend on. It tests a feature that, if broken, would frustrate or block users.
It validates real workflows not implementation details. It catches regressions before users do.
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comma in sentence. The sentence "It validates real workflows not implementation details" should have a comma after "workflows" to improve readability: "It validates real workflows, not implementation details."

Suggested change
It validates real workflows not implementation details. It catches regressions before users do.
It validates real workflows, not implementation details. It catches regressions before users do.

Copilot uses AI. Check for mistakes.
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.

3 participants