---
title: "Comment by Iliya Oblakov on \"Why We Distrust Tests Written After the Code\" | Hashnode"
description: "A test written after the code can still earn trust if it fails on the old code. In my setup the writer runs each new test once against the base commit and paste"
url: "https://hashnode.com/posts/why-we-distrust-tests-written-after-the-code/6af7146acf3166aae7c9b859/comment/6afcd134d0ea72fbecc09bc3"
---

[Discussion](https://hashnode.com/posts/why-we-distrust-tests-written-after-the-code/6af7146acf3166aae7c9b859)

Comment [Why We Distrust Tests Written After the Code](https://hashnode.com/posts/why-we-distrust-tests-written-after-the-code/6af7146acf3166aae7c9b859)

[Iliya Oblakov](https://hashnode.com/@iliyaoblakov)

[Nov 17](https://hashnode.com/posts/why-we-distrust-tests-written-after-the-code/6af7146acf3166aae7c9b859/comment/6afcd134d0ea72fbecc09bc3)

A test written after the code can still earn trust if it fails on the old code. In my setup the writer runs each new test once against the base commit and pastes the failing output into the commit body, so a test that already passes there is visible before review. That does nothing for your draft route case, where an existing test got weaker under the same name. For that my review prompt says nothing gets weakened without a stated reason, and a loosened assertion with no reason comes back as CHANGES REQUIRED. When a pre-written assertion has to change because the plan did, what clears that finding in your process?

[Paul Pham](https://hashnode.com/@paulpham157)

[Nov 21](https://hashnode.com/posts/why-we-distrust-tests-written-after-the-code/6af7146acf3166aae7c9b859/comment/6afcd134d0ea72fbecc09bc3#reply-6b01f40a9751be6c70534ddd)

Here any PR that modifies a test gets rejected. A changed assertion goes back to the plan, and the agent that writes the tests redoes it, never the coding agent. Does your base-commit failing output survive a squash merge?

[Nov 23](https://hashnode.com/posts/why-we-distrust-tests-written-after-the-code/6af7146acf3166aae7c9b859/comment/6afcd134d0ea72fbecc09bc3#reply-6b041f4ff69e5c93d8735cd1)

By default, yes. My merge script uses a merge commit, so the branch commits land on main with their bodies intact. Squash is a setting, and there the script sends GitHub only the method and the pinned head sha, so what survives depends on the repo's squash message setting, which I haven't tested. What survives either way is a tree check: after the merge, the script compares the merged tree with the one that passed the gate. Rejecting every PR that modifies a test is stricter than mine. Who tells the test-writing agent that the plan changed?
