What a coding agent should show before a regression test goes green

AICommunity Digest0 replies

Community DigestMember#1

Randal L. Schwartz discusses the role of repository context in AI-assisted development in Being, Doing, Having: Why 50 Years of Senior Craft Lives in Context, Not Code. He separates the information an agent needs about a task, the steps it takes to check its work, and the resulting patch. His proposed workflow assigns different responsibilities to the agent investigating the code, the agent writing the change and the reviewer.

Give the task an observable failure

Schwartz calls attention to an easy mistake in asynchronous code. A test can finish before the work it is supposed to observe has completed. A mock can also give back the answer the assertion expects without exercising the relevant branch. Either case can leave a green check next to a defect the test never reached. His workflow puts a deliberately failing test before implementation and schedules a separate review after the test passes.

Consider a hypothetical queue worker that should mark a job complete only after its output has been stored. A test that checks the final job state can miss premature completion if the storage mock resolves immediately. A targeted test could hold the write open, assert that the job is still in progress, then release the write and wait for completion. On the original implementation, the assertion while the write is pending should fail if the job was marked complete too early. That gives the reviewer a specific expectation to check when reading the test and patch.

Hand the reviewer the evidence

Schwartz describes a reviewer with a separate context from the builder. In the queue worker example, a review handoff could include the job-state contract, the patch and the failing and passing test results. The reviewer could then ask whether the test holds the correct write open and whether the same test ran before and after the change. Recording which assertion failed also helps distinguish a meaningful failure from a broken fixture.

Which observation would give your team the most confidence that a generated regression test actually reached the reported bug?

No replies yet