<?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: rerorets</title>
    <description>The latest articles on DEV Community by rerorets (@rerorets).</description>
    <link>https://dev.to/rerorets</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%2F4261558%2F11b264d9-a7c1-4043-bf7a-c52af75751d0.png</url>
      <title>DEV Community: rerorets</title>
      <link>https://dev.to/rerorets</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rerorets"/>
    <language>en</language>
    <item>
      <title>hadome: a ratchet that stops AI coding agents from weakening your tests</title>
      <dc:creator>rerorets</dc:creator>
      <pubDate>Tue, 24 Nov 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/rerorets/hadome-a-ratchet-that-stops-ai-coding-agents-from-weakening-your-tests-g7n</link>
      <guid>https://dev.to/rerorets/hadome-a-ratchet-that-stops-ai-coding-agents-from-weakening-your-tests-g7n</guid>
      <description>&lt;p&gt;I built &lt;strong&gt;hadome&lt;/strong&gt;, a checker for repositories where AI agents write most of the code. It compares a change with &lt;code&gt;main&lt;/code&gt; and reports only what the change makes worse: the violations it adds and the tests it weakens.&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%2F31gbrloay1cvz7q2c9vk.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%2F31gbrloay1cvz7q2c9vk.gif" alt="hadome stops a change that deletes the only test of store.Append, and passes a change that deletes Append together with its test" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/rerorets/hadome" rel="noopener noreferrer"&gt;rerorets/hadome&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I built it
&lt;/h2&gt;

&lt;p&gt;When agents write the code, the test suite keeps growing. CI got slow, and asking the agent to trim the tests rarely worked.&lt;/p&gt;

&lt;p&gt;Reading every new test case myself was not an option either. So instead of reviewing tests one by one, I wanted something that tests the tests.&lt;/p&gt;

&lt;p&gt;What I am aiming for is development that runs without a person in every loop. For that, something has to check, on every change, that the agent did not weaken the tests while adding or deleting them. Agents are good at making CI green; they are not always good at keeping it meaningful. hadome is that gate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Telling a cleanup from a regression
&lt;/h2&gt;

&lt;p&gt;Once agents do most of the work, nobody reads every test case. The changes that hurt are the ones where tests disappear.&lt;/p&gt;

&lt;p&gt;If three tests are gone, the count alone does not tell you whether it was a cleanup or a regression.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What happened&lt;/th&gt;
&lt;th&gt;Test count&lt;/th&gt;
&lt;th&gt;What the tests guard&lt;/th&gt;
&lt;th&gt;Verdict&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Three duplicate tests merged into one&lt;/td&gt;
&lt;td&gt;down&lt;/td&gt;
&lt;td&gt;unchanged&lt;/td&gt;
&lt;td&gt;cleanup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Code deleted along with its tests&lt;/td&gt;
&lt;td&gt;down&lt;/td&gt;
&lt;td&gt;the target is gone&lt;/td&gt;
&lt;td&gt;cleanup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Only the test deleted or weakened&lt;/td&gt;
&lt;td&gt;down or same&lt;/td&gt;
&lt;td&gt;narrower&lt;/td&gt;
&lt;td&gt;regression&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;hadome works out which functions and methods each test calls, and compares the set of targets the active tests reach. It fails only when that set shrinks. The GIF above shows the difference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delete the only test of &lt;code&gt;store.Append&lt;/code&gt;, and &lt;code&gt;tests/scope-shrunk&lt;/code&gt; fails (exit code &lt;code&gt;1&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Delete &lt;code&gt;Append&lt;/code&gt; together with its test, and it passes as a cleanup (exit code &lt;code&gt;0&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So behaviour you no longer need goes away cleanly when you delete the code with its test. And when you merge duplicate tests, a passing hadome tells you the suite guards as much as before.&lt;/p&gt;

&lt;h2&gt;
  
  
  Existing violations do not fail
&lt;/h2&gt;

&lt;p&gt;hadome checks both sides of a change, the base and the head, and compares the results. It reports only the violations the change adds.&lt;/p&gt;

&lt;p&gt;That means you can add it to a repository that already has plenty of violations, without fixing them first. It works like a lint baseline, except that there is no baseline file: hadome re-checks the base every time.&lt;/p&gt;

&lt;p&gt;歯止め (&lt;em&gt;hadome&lt;/em&gt;) is the Japanese word for a pawl: the part of a ratchet that lets the wheel turn one way and stops it from turning back. hadome likewise stops only the changes that make things worse than &lt;code&gt;main&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It looks at how tests and code are written:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Group&lt;/th&gt;
&lt;th&gt;Examples&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tests/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;shrinking what tests guard, tests that read the clock, tests that wait with &lt;code&gt;sleep&lt;/code&gt;, tests without assertions, skips without a reason, mocks in tests of pure code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;deps/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;imports and calls your diagrams (Mermaid) do not draw, new import cycles, imports from an inner layer to an outer one&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;size/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;lines per file and function, number of parameters, complexity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;comments/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;TODOs that do not say when, comments that point to missing documents&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;code/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;values that belong in configuration, errors that are dropped, functions with the same body, a copy left behind when the other was fixed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On top of that, &lt;code&gt;hadome mutate&lt;/code&gt; breaks the functions a change touched, one place at a time, and reports any break no test notices. It is mutation testing scoped to the change, meant to run locally before a change is finished.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agents fix, people decide
&lt;/h2&gt;

&lt;p&gt;hadome is meant to run inside the agent's loop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JSON output.&lt;/strong&gt; &lt;code&gt;hadome check --format json&lt;/code&gt; returns, for each regression, the rule, the file and line, why it matters (&lt;code&gt;why&lt;/code&gt;) and how to fix it (&lt;code&gt;fix&lt;/code&gt;). The agent reads it and fixes the code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exit codes decide when to hand back to a person.&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Exit code&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;What the agent does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;no regression&lt;/td&gt;
&lt;td&gt;finish&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;a regression&lt;/td&gt;
&lt;td&gt;fix it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;2&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;configuration error&lt;/td&gt;
&lt;td&gt;fix the configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;3&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;a person must review (a new exception, a loosened rule, …)&lt;/td&gt;
&lt;td&gt;stop and ask&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If the agent raises a limit or turns a rule off to get the check to pass, that change comes back as &lt;code&gt;3&lt;/code&gt;. A person decides whether to accept it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Teaching the agent.&lt;/strong&gt; &lt;code&gt;hadome agents --write CLAUDE.md&lt;/code&gt; writes the instructions into the file your agent reads. &lt;code&gt;AGENTS.md&lt;/code&gt; and other files work too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exceptions need a reason
&lt;/h2&gt;

&lt;p&gt;Where a rule does not apply, you write an exception with a reason. Without a reason it has no effect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c1"&gt;// gate:allow tests/no-sleep reason: the OS file watcher has no event to wait for&lt;/span&gt;
&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Millisecond&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The marker is &lt;code&gt;gate:&lt;/code&gt;, not the tool's name, so renaming the tool never forces you to rewrite your code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What people review instead
&lt;/h2&gt;

&lt;p&gt;hadome is the third of three layers that let you trust tests written by an agent.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1. Invariants&lt;/td&gt;
&lt;td&gt;a short list of things that must never break, each linked to the tests that guard it&lt;/td&gt;
&lt;td&gt;"the log store is append-only"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2. Writing rules&lt;/td&gt;
&lt;td&gt;how a trustworthy test is written&lt;/td&gt;
&lt;td&gt;test observable behaviour only; never read the clock; never wait with &lt;code&gt;sleep&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3. Check&lt;/td&gt;
&lt;td&gt;verifies 1 and 2 on every change&lt;/td&gt;
&lt;td&gt;hadome&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;People review layers 1 and 2, not each test case. If those hold, you can trust the tests even when an agent wrote them.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it differs from other tools
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool (examples)&lt;/th&gt;
&lt;th&gt;How it compares&lt;/th&gt;
&lt;th&gt;Difference from hadome&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Linters limited to the diff (golangci-lint &lt;code&gt;--new-from-rev&lt;/code&gt;, reviewdog)&lt;/td&gt;
&lt;td&gt;report violations on changed lines&lt;/td&gt;
&lt;td&gt;regressions outside the changed lines are invisible&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tools that record results and block regressions (Betterer, lint baselines)&lt;/td&gt;
&lt;td&gt;save the last result to a file and compare&lt;/td&gt;
&lt;td&gt;hadome stores nothing and re-checks the base every time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Coverage diffs (Codecov, …)&lt;/td&gt;
&lt;td&gt;run the tests and measure the lines they hit&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;hadome check&lt;/code&gt; does not run the tests; it reads which functions they call&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI code review&lt;/td&gt;
&lt;td&gt;have an LLM read the change&lt;/td&gt;
&lt;td&gt;hadome uses no LLM and no network; the same change always gets the same result&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

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

&lt;p&gt;One binary reads TypeScript, Python, Java, Kotlin, Go, Rust, Terraform and Ansible.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew install rerorets/tap/hadome
&lt;span class="nb"&gt;cd&lt;/span&gt; path/to/your-repo
hadome check --base main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It also installs with &lt;code&gt;npm install --save-dev hadome&lt;/code&gt;, &lt;code&gt;uv add --dev hadome&lt;/code&gt;, &lt;code&gt;go get -tool&lt;/code&gt;, Gradle, Maven and cargo. The README has the details for each language.&lt;/p&gt;

&lt;h2&gt;
  
  
  Feedback welcome
&lt;/h2&gt;

&lt;p&gt;The more you hand to agents, the less any person can check one by one. hadome is there to make sure that at least what your tests guard never shrinks. It is still 0.x, so behaviour may change. If you try it and find a change it should have stopped but did not, please open an issue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/rerorets/hadome/issues" rel="noopener noreferrer"&gt;https://github.com/rerorets/hadome/issues&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is an English version of &lt;a href="https://zenn.dev/rets/articles/50284cf0e8668d" rel="noopener noreferrer"&gt;a post I wrote on Zenn&lt;/a&gt; (in Japanese).&lt;/em&gt;&lt;/p&gt;

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