What the agent does
The agent checks out wallabag pull request #9119, reads its change to EntryRestController.php and the existing EntryRestControllerTest.php, and installs PHP 8.2 with the extensions CI lists. It prepares the test database with make prepare DB=sqlite and make fixtures, then runs the test class on the untouched head: OK (69 tests, 466 assertions).
The PR already tests five invalid inputs through dataForInvalidEntriesList. Missing were an omitted urls parameter, a whitespace-only string, a top-level JSON object and a top-level JSON string. The agent adds three rows to that provider and one test, testPostEntriesListActionWithoutUrlsParameter, beside it.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "This pull request changes a Symfony controller. Read the diff and the existing PHPUnit tests for that controller, and add only the tests the change is missing, beside the existing ones, extending an existing data provider where one fits. Run the test class with the repository's own PHPUnit setup and its SQLite test configuration on the PR head, then run the new tests against the base commit's version of the controller and show which fail. Do not change application code. Push the tests to this pull request's branch and comment with the cases covered and the exact results. If no pull request follows this prompt, stop and say so.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}The trial ran this request with its push and comment steps turned off: the tests were not pushed and the comment was reported back, not posted.
- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
Tried on wallabag/wallabag at 35eb0066c: the head of pull request #9119, 1 file changed, 11 insertions(+) in tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php. On the PR head the class ended OK (73 tests, 477 assertions). Against the base controller the filtered run ended Tests: 11, Assertions: 9, Errors: 7, Failures: 2., and the missing-urls test threw TypeError: json_decode(): Argument #1 ($json) must be of type string, array given.
For the reviewer: decide whether these cases join #9119 or a follow-up; they need no source change. The run found the sibling DELETE /api/entries/list has the same json_decode of an array default, which the PR does not fix. Only this class ran, on SQLite and PHP 8.2, not CI's MySQL, PostgreSQL and PHP 7.4 to 8.4 matrix.
Run it on every pull request opened against master or 2.6
An automation with a github trigger on pull_request.opened and pull_request.synchronize and branch_patterns master (wallabag's default) and 2.6 (which #9119 targets) saves this request with its push and comment steps replaced by the recipe's: do not push commits, and post one review listing each test, its result and the tests as a patch. Only an owner, member or collaborator fires it; a fork's pull request never does. The event carries no SHAs, so the saved prompt must take the head and base from the URL.
The use case this job follows, with its automation and trigger: Review every pull request.
Why run it on Rush?
The PR's own tests looked complete, but none sent the request with no urls at all, the exact case its '[]' default fixed. The run proved that by putting the old controller back and watching the new test crash.
Frequently asked questions
Why run the tests against the base commit?
A test that passes before and after a fix proves nothing about the fix. Swapping in HEAD~1's controller made 9 of the 11 bulk-entry tests fail, so each new case is shown guarding real behaviour.
Did the setup change any tracked files?
make prepare DB=sqlite rewrites app/config/parameters_test.yml. The agent restored it, and the final diff touches only the test file.