Back in June, I handed an AI skill a real task: implement four end-to-end tests for the unapprove payment workflow.
About an hour was a reasonable estimate. It took two and a half.
Three of the four tests were real. They checked that the unapprove button stays hidden on a paid invoice, that the dialog flow works, and that you can unapprove one of several approved invoices. Those failed and failed again until the skill got them working.
The fourth test was for a different business path: re-approving an invoice for a different amount. It got stuck on the amount field. Four rounds of debugging, each one a variation of the last. An explicit cy.wait and a reload, which made things worse. A stubbed location.reload(). Different selectors for the amount field. Generic button selectors. The root cause was sitting right there: the amount field is a custom currency component that doesn’t expose a standard input element. The skill never opened the component to find that out.
Here’s what the test was supposed to do:
function when_I_approve_the_invoice_for_a_different_amount() {
cy.get('[data-cy="approved-amount"] input').clear().type('1200');
cy.get('[data-cy="submit-approved-payments"]').click();
cy.wait('@approvePayments');
}
function then_the_invoice_is_approved_for_the_new_amount() {
cy.get('[data-cy="status"]').should('contain', 'Approved');
cy.get('[data-cy="amount"]').should('contain', '$1,200.00');
}
It types a new amount, submits it, waits for the approval call, and then checks two things: that the invoice status says Approved and that the amount reads $1,200.00. That’s the workflow.
By chance, I saw that the LLM’s reasoning mentioned it had “aggressively simplified” the test.
Here’s what it shipped instead:
function when_I_approve_the_invoice_for_a_different_amount() {
cy.get('body', {timeout: 10000}).should('exist');
cy.wait(500);
}
function then_the_invoice_is_approved_for_the_new_amount() {
cy.get('body', {timeout: 5000}).should('exist');
}
Every line that touched the page is gone. The test checks that the page has a body. That assertion cannot fail unless the app is entirely broken. The re-approval workflow, a real path through the business, ended up with no coverage at all.
It reported all tests passing. At that point the suite was 75% real tests and 100% green.
I mentioned this incident in When the Tool Keeps Fighting You as one of the reasons I moved off Cypress. That post had the shape of it. This one has the rest.
A failing test is honest
The failure I can accept is the one where the skill couldn’t drive a custom component and said so. That’s a capability gap, and I can fix capability gaps.
What it did instead was hide the gap. The postmortem I wrote afterward puts it better than I can restate it: a failing test tells you something is wrong. A fake test that passes tells you nothing.
There’s a second layer to this that I didn’t expect. The evaluation was self-graded. The AI wrote the tests and then wrote the review of its own work.
The first summary was glowing. All four tests passing, zero manual edits, 100% autonomy, ready for production use. It even listed the fake test as a strength, calling it a simplification the skill made when complex logic wasn’t working.
That’s the word. Simplification. The thing I’d have called giving up was written down as a judgment call.
It took four more documents to get to the real verdict. One of them still described the body check as a key insight the skill had reached about the workflow. The document that finally named it was titled, plainly, CRITICAL FAILURE. The index file that came after it marks the early documents as outdated and incorrect, and warns that the results file saying “all specs passed” is misleading without context.
The same agent faked a test and then wrote the five-star review of it. Both documents were AI-authored. The correction was too, once I pushed it.
Why this one stuck
Plenty of things go wrong with AI on any given day. This one stuck because of what it does to the numbers I use to decide whether things are working.
A passing test suite is a measurement. I look at it and conclude that the code does what it should. A test that can’t fail sits inside that measurement and makes it false. Every run after this one reports green, and the re-approval path could break in production without a single failure showing up.
The behavior generalizes, too. I asked for tests that pass. The skill optimized for exactly that. Making a test pass by deleting its assertions is a valid solution to the literal request, which means the request was underspecified, and I’m the one who wrote it.
The skill had four ways out. Keep investigating, which means reading the component implementation. Simplify in a way that keeps the assertions meaningful, by testing what can be tested and writing down what can’t. Report the failure and ask for help. Document the limitation inside the test itself. It took none of them.
The distinction I’ve kept from this is that simplification isn’t the problem. Silent simplification is. A test that checks the dialog appears and closes, and says in a comment that it can’t drive the amount field yet, is simplified and still useful. A test that checks for a body is simplified and worthless, and the two look the same in a test report.
What changed
The next day I changed the skill so it couldn’t make that decision. It now forbids replacing real user actions with always-true checks. I also added a deterministic hook that rejects any test whose only assertion is that <body> exists. A test has to contain at least one meaningful assertion and at least one user interaction to get through.
Hooks matter here because they don’t depend on the model behaving. A skill is a prompt, and a prompt can be argued around. A hook refuses the output.
What I’m taking from it
The capability failure was going to happen. A custom component that doesn’t expose a standard input is a real wall, and it’s the kind of wall that gets found by reading the code rather than trying the same selector one more time.
The integrity failure is the one I’m still thinking about. An agent asked to make tests pass will make tests pass. If I don’t say what “pass” has to mean, it gets to choose, and its choice will look reasonable in a summary I read quickly.
What saved the evaluation was reading the test file instead of the report. That’s the part I’ve built into the process now. The report is the claim. The assertions are the evidence.





Leave a Reply