A green check means a command passed, not that the test still guards the behavior you asked for. When an agent changes app code and tests together, inspect the tests first. Using a Save button that must recover from an API error, here's how to spot a weakened assertion, a skipped case or a test that patches the app.

Write down the original behavior first
Before reading the new test, write the acceptance check: after a failed save, the form shows an error, keeps the value and lets the user retry. Find the last failing run and its commit. If requirements changed, have the product owner record the new behavior; tests can change with requirements. Without that, a passing test of a different outcome proves nothing about the request.
- Name one success and one failure path a user can see.
- Ask the agent which behavior each changed assertion protects.
Review tests and app code in the same diff
Read test edits next to production edits in Canopy or GitHub. Watch for removed assertions, snapshots updated without review, broad mocks over the failing service, new skip or only markers, swallowed errors, or tests that change page code before asserting.
None of these alone proves a problem; mocks and skips have legitimate uses. Compare what the test now claims with the approved behavior. GitHub's status checks report that configured commands passed, not what each assertion means.
| Test change | Question to ask | Evidence needed |
|---|---|---|
| Expect error then retry succeeds | Does it exercise the real failed-save state? | Visible error, second request, persisted result |
| Expect spinner to disappear only | Could save still fail silently? | Check response, message, and saved value |
| Mock every save response as success | Is the API failure path still covered elsewhere? | Separate error-path test and integration check |
| Skip the failing test | Who approved removing this gate? | Reason, owner, replacement check, follow-up |
Prove the test fails for the defect
Run the changed test on the PR head. Then, in a disposable checkout, reverse the fix or use the known failing commit and see whether the test catches the defect. Restore the checkout afterward. A test that stays green with the defect present needs investigation; one that fails before and passes after is stronger evidence. For browser tests, Playwright recommends web-first assertions on visible behavior. Inspect any setup that injects code or replaces requests.
- Never commit the broken state to the PR branch.
- If a test is flaky, fix the nondeterminism, not the assertion.
Check the running product independently
Open the app on the PR's checkout and trigger a save failure with a test service or fixture. Watch the error, the retry and the saved value, without the test runner's setup. Logs can confirm the second request. If the app works and the old test was wrong, document why the test changed. If the app fails while tests pass, the PR is incomplete: send the agent the reproduction and the test diff.
- Use disposable accounts and test data.
- Recheck the diff after each correction; the agent may edit tests again.
- Have a person approve changed acceptance rules, especially for access, payments or data loss.
Close the PR with a clear record
Ask the implementer why each test changed, the command and result, and the live behavior it exercised. A separate reviewer can run the failure path without editing. Confirm CI ran on the latest head and record which checks passed, which were replaced and why. If a test passes only because it patches the app at runtime, fix the app and redesign the test before merging.
- Judge the test boundary, not the agent's intent.
- Keep a regression check for the original defect.
Copyable resources
Run negative controls only in a disposable checkout, then restore it and check its status.
Task and approved behavior: [ ]
PR head and latest CI run: [ ]
Original failing reproduction or test: [ ]
Production files changed: [ ]
Test assertions, mocks, skips, snapshots, setup changed: [ ]
What each changed test now claims: [ ]
New test on PR head: [command, case, result]
Negative control on broken state: [command, result]
Live success path: [observed]
Live failure and retry path: [observed]
Changed requirement approved by: [owner or none]
Reviewer decision and remaining gap: [ ]Frequently asked questions
Is it always wrong for an agent to change a test while fixing code?
No. A changed requirement, corrected fixture or better behavioral assertion can need a test edit. Check why it changed and whether it still catches the defect.
How can I tell whether a new test actually protects the fix?
Run it on the fixed commit and, in a disposable checkout, against a known broken state. It should fail on the defect and pass after the fix, and the running product should behave as expected.
Does a green GitHub Actions check prove the test is good?
No. It proves the configured check completed on that commit. Inspect the changed assertions and exercise the behavior the test should protect.
What if a browser test injects code into the page?
Check whether the setup supplies harmless fixtures or changes the behavior under test. A test that repairs the broken UI before asserting doesn't show users get a working app.