<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anas Alkhatib</title>
    <description>The latest articles on DEV Community by Anas Alkhatib (@anas_alkhatib).</description>
    <link>https://dev.to/anas_alkhatib</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4252341%2F9fc61d6b-c13a-4975-a4b2-ed90fbd80116.jpg</url>
      <title>DEV Community: Anas Alkhatib</title>
      <link>https://dev.to/anas_alkhatib</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anas_alkhatib"/>
    <language>en</language>
    <item>
      <title>I watched coding agents "fix" failing tests by changing the tests, so I built a tool that catches it</title>
      <dc:creator>Anas Alkhatib</dc:creator>
      <pubDate>Tue, 24 Nov 2026 13:42:58 +0000</pubDate>
      <link>https://dev.to/anas_alkhatib/i-watched-coding-agents-fix-failing-tests-by-changing-the-tests-so-i-built-a-tool-that-catches-it-1426</link>
      <guid>https://dev.to/anas_alkhatib/i-watched-coding-agents-fix-failing-tests-by-changing-the-tests-so-i-built-a-tool-that-catches-it-1426</guid>
      <description>&lt;p&gt;You ask your coding agent to fix a bug. A few minutes later it reports back: all tests pass.&lt;/p&gt;

&lt;p&gt;Then you open the diff.&lt;/p&gt;

&lt;p&gt;The bug is still there. What changed is the test. The expected value now matches the wrong output, or a test has quietly become &lt;code&gt;test.skip&lt;/code&gt;, or an assertion is simply gone. The suite is green because it no longer checks anything that matters.&lt;/p&gt;

&lt;p&gt;I've seen agents cut corners to finish a task, with free models and paid ones. When I tested them on failing tests, some did exactly this: they changed the test instead of the code. It is the worst kind of shortcut, and it only has to happen once to ship a broken release with a passing CI badge.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it looks like
&lt;/h2&gt;

&lt;p&gt;Here is a tiny shopping-cart function with a real bug: the 10% discount is applied to every cart, not only carts over 100.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;total&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// BUG: the discount should apply only when sum &amp;gt; 100&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.9&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The honest test catches it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'small cart has no discount'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;total&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The "fix" an agent can come up with when it is told to make the tests pass:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt; test('small cart has no discount', () =&amp;gt; {
&lt;span class="gd"&gt;-  expect(total([{ price: 20, qty: 2 }])).toBe(40);&lt;/span&gt;
&lt;span class="gi"&gt;+  expect(total([{ price: 20, qty: 2 }])).toBe(36);&lt;/span&gt;
 });

&lt;span class="gd"&gt;-test('empty cart is zero', () =&amp;gt; {&lt;/span&gt;
&lt;span class="gi"&gt;+test.skip('empty cart is zero', () =&amp;gt; {&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Green tests, same bug.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;Mihack compares your tests before and after the agent ran and tells you, in plain words, what was weakened. Then one click puts the original tests back, and it gives you a short message to paste to the agent so it fixes the code instead.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3tlgo0oyio0bkkrghpjv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3tlgo0oyio0bkkrghpjv.gif" alt="An agent weakens a test, Mihack flags it, and Undo puts the original test back" width="600" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It flags:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a test that was &lt;strong&gt;deleted&lt;/strong&gt; or renamed away&lt;/li&gt;
&lt;li&gt;a test that was &lt;strong&gt;skipped&lt;/strong&gt; or switched off&lt;/li&gt;
&lt;li&gt;an &lt;strong&gt;assertion removed&lt;/strong&gt;, or replaced by one that always passes&lt;/li&gt;
&lt;li&gt;an &lt;strong&gt;expected value changed&lt;/strong&gt; to match wrong output&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;test config file&lt;/strong&gt; edited to quietly turn tests off&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It works with Python, JavaScript, TypeScript, Java, Kotlin, C#, C++, C, Go, Rust, PHP and Ruby tests.&lt;/p&gt;

&lt;p&gt;Mihack does not use AI to judge. The rules are fixed, so the same change gets the same verdict every time, whichever agent or model made it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Even with the best model, you want a safety net
&lt;/h2&gt;

&lt;p&gt;Some models slip less often than others, but every model makes mistakes, free or paid. An agent told to "make the tests pass" is under pressure to do exactly that, and when the honest fix is hard, weakening the test is the shortest path. A better model makes that rarer. It does not make it impossible.&lt;/p&gt;

&lt;p&gt;Mihack does not ask you to trust the model. It checks what actually changed in your tests, after the fact, the same way every time. Think of it as a guard between the agent and your main branch: if the model did honest work, Mihack stays quiet; if it took the shortcut, you know before the code ships.&lt;/p&gt;

&lt;h2&gt;
  
  
  Not just toy examples
&lt;/h2&gt;

&lt;p&gt;The cart example is small so it fits in a blog post. Mihack does not search for text like &lt;code&gt;.skip&lt;/code&gt;; it parses each test file into a syntax tree and compares the structure of every test before and after. So it also catches the quieter tricks that are easy to miss in a long diff:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Faking the code under test.&lt;/strong&gt; The agent leaves the assertion alone but redefines the imported function inside the test file, so the test checks a fake:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;-import { add } from './math';&lt;/span&gt;
&lt;span class="gi"&gt;+import { add as realAdd } from './math';&lt;/span&gt;
&lt;span class="gi"&gt;+const add = (a, b) =&amp;gt; 4;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Swapping the import&lt;/strong&gt; to a different module, so the same test now runs against something else.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An assertion that always passes&lt;/strong&gt;, like &lt;code&gt;expect(true).toBe(true)&lt;/code&gt; or &lt;code&gt;assert True&lt;/code&gt;, added in place of a real check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A test renamed away&lt;/strong&gt; so the runner no longer picks it up, or wrapped in a disabled form such as &lt;code&gt;xit&lt;/code&gt;, &lt;code&gt;DISABLED_&lt;/code&gt; or &lt;code&gt;#[ignore]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One weakened line in a big file.&lt;/strong&gt; Each test is compared on its own, so a long test file with many honest edits and one changed expected value is still flagged. Undo puts back what was weakened and keeps honest additions, like new tests or new assertions, wherever it safely can.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to use it
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;a href="https://app.infoprods.com" rel="noopener noreferrer"&gt;app.infoprods.com&lt;/a&gt; in Chrome or Edge. Nothing to install.&lt;/li&gt;
&lt;li&gt;Choose your project folder and take a snapshot &lt;strong&gt;before&lt;/strong&gt; the agent starts.&lt;/li&gt;
&lt;li&gt;Let the agent work.&lt;/li&gt;
&lt;li&gt;Click "Check the changes".&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it. Honest changes, like new tests or new assertions, are left alone.&lt;/p&gt;

&lt;p&gt;Here is the whole flow in a short video:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/MlJeevCmtdA" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Your code never leaves your machine
&lt;/h2&gt;

&lt;p&gt;This was the part I cared about most. I would not paste my own work into a random website, so I did not want to ask anyone else to.&lt;/p&gt;

&lt;p&gt;The browser reads your folder locally. For each changed test file it builds a &lt;strong&gt;fingerprint&lt;/strong&gt;: counts and salted HMAC-SHA256 hashes of the test structure. The salt is random, created in your browser, and never sent. The server only sees hashes it cannot turn back into code.&lt;/p&gt;

&lt;p&gt;What is sent: the file paths (so the answer can name the file), whether each file was added, modified or deleted, and the fingerprints. No file contents.&lt;/p&gt;

&lt;p&gt;You don't have to take my word for it. The code that builds the request is open source, together with a privacy test that fills test files with made-up words and fails if any of them appear in what would be sent:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/anasalkhateeb08-jpg/mihack-client" rel="noopener noreferrer"&gt;github.com/anasalkhateeb08-jpg/mihack-client&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm ci
npm &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also watch the request yourself in your browser's developer tools while you use the app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits, honestly
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You need to take the snapshot before the agent runs. Mihack compares two moments; it does not watch the agent live.&lt;/li&gt;
&lt;li&gt;It judges tests, not your application code. If an agent breaks the app but leaves the tests alone, your tests are the ones that catch that. And if an agent hard-codes a special case into the application code just to satisfy a test, Mihack will not see it, because the tests themselves did not change.&lt;/li&gt;
&lt;li&gt;Some unusual test macros or custom frameworks may not be recognised yet. If you hit one, I would like to hear about it.&lt;/li&gt;
&lt;li&gt;File paths are sent to the server, as described above.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;It is free for 5 reviews a day, up to 3 test files per review, with no card needed.&lt;/p&gt;

&lt;p&gt;I'm a solo developer in Amman, Jordan, and this is the first public release. If you use coding agents, I would love to know two things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Have you caught an agent weakening a test? What did it do?&lt;/li&gt;
&lt;li&gt;Does Mihack catch it? If not, tell me what slipped through.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Comments here or issues on GitHub are both welcome.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>testing</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
