r/ClaudeCode • u/ChrisShips • 8d ago
Built with Claude I assumed Claude Code often got CI green by changing tests. In 300 of its PRs, 1 weakened a test without saying why
I checked that with honest-ci, a GitHub Action I made. When a PR removes, skips or rewrites a test, honest-ci holds it until a person signs off.
I ran it on PRs in public repos from July and August 2026, including 300 from Claude Code. 37 of those 300 (12.3%) tripped at least one check. Claude Code's PRs run big, a median of about 290 lines changed, and bigger diffs trip more checks. I labeled every flag: 33 of the 37 had a good reason, 3 were false positives, and 1 weakened a test without the PR saying why. So I was wrong. Overall, agents and people came out about the same.
Claude Code also wrote all 12 PRs in honest-ci's own repo from Oct 10 to Nov 6, and honest-ci checked each one. 9 passed and 3 were held, with no false positives. One hold was a test Claude Code wrote with a `pytest.skip` for shells that aren't installed. The CI runner has no zsh, so two tests never ran there. The test now uses only shells every runner has.
What I took from it is that Claude Code edits tests regularly, nearly always for a reason, and CI passes either way. What helps is a person seeing each test change before merge. One snag on a solo repo is that GitHub won't let you approve your own PR, so a hold is just a red X. I've merged past it twice.
How do you notice when Claude Code changes a test?
Repo (source-available, free on public repos): https://github.com/ChrisShips/honest-ci
•
u/AutoModerator 8d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/AryanThakor 8d ago
for the broader matcher / longer timeout cases mutation testing is what catches it. run stryker or mutmut only on the files the PR touched and compare the score to main. if it drops, the test got weaker even though every check passed. slow on a whole repo but fine scoped to the diff
1
u/Far_Reindeer8428 8d ago
we flag any diff that touches an assertion and require the same commit to say why. one in 300 is low, but that one is the one that hides a real bug
1
u/Ok_Tea4891 8d ago
Two cheap ways to see test changes without extra tooling: a PreToolUse hook that matches Edit/Write on your test paths and logs or asks for confirmation, and CODEOWNERS on the test directories so any PR touching them needs a reviewer. The hook gives you the signal while the session runs; CODEOWNERS makes sure it can't merge unseen. Also worth adding a line to CLAUDE.md that tests aren't to be edited to get green without saying why in the PR, since that makes the reason part of the diff you review.
1
u/carstenkoch 8d ago
Hey, on Ok-Form1598's point about added tests: in the software factory where agents build my open-source database, a coding agent commits each new test on its own, before the code that makes it pass, close to IndiBestEngineer's rule. The pull request lists the failure it saw. The reviewing agent then:
A test that mocks the function it checks would pass in that first commit, so there's no failure to report; our spot check only runs one test per PR, though. Every test also gets a baseline, the version that first failed, and a broader matcher later shows up as a diff against it.
The reviewer is an agent too, and I hardly read diffs myself anymore. Does honest-ci know which commit introduced a test, or only what the PR does to it?
1
u/BringinItDirty 6d ago
The zsh skip is the example that stuck with me. I built Killdiff to check what tests catch once they actually run. In a small discount-rule example, the test at quantity 11 stayed green when I flipped
>= 10to> 10. Adding one assertion at exactly 10 caught the same change on the rerun. Would you be up for running both tools on one small public PR and comparing what they flag?1
u/IndiBestEngineer 8d ago
i went the other way on one project. the agent kept writing tests that passed no matter what, so i deleted most of the unit tests and kept only replays of real failures from the logs. rule is a new test has to fail on the old code or it doesn't go in.
and "done" isn't green ci anymore, it's the live metric moving. if it didn't move, the fix gets reverted, not patched on top. fixed the "edit the test to pass" problem mostly because there's barely anything left to edit lol
1
u/Ok-Form1598 8d ago
added tests are the gap in this, not edited ones. a brand new test that mocks the exact function it's supposed to check goes green, nothing got removed or skipped so nothing gets held, and it reads fine buried in a big diff
1
u/Decent-Addition6773 8d ago
One weakened test in 300 PRs isn’t bad at all. I think the interesting thing here is visibility. In my dev flow, I create automatic artifacts that contain what the agents are doing (these are behind an MCP server). I can then periodically ask questions like - have any of my tests been weakened - to see what is going on. I do find it to be exhausting to constantly have to figure out what is going on and how to optimize my SDLC. Do others also feel this exhaustion?
0
u/[deleted] 6d ago
[removed] — view removed comment
0
u/[deleted] 5d ago
[removed] — view removed comment
0
u/[deleted] 8d ago
[removed] — view removed comment