From d059da264c5ca558bbb81648187f125535021246 Mon Sep 17 00:00:00 2001 From: "prath.shenoy" Date: Mon, 30 Nov 2026 16:12:35 +0000 Subject: [PATCH] chore(testing): Require generated mocks ## Summary **What**: - Require generated mocks for dependency interfaces while retaining stateful backends and fixture helpers. **Why**: - Stop agents from bypassing the existing mock-generation workflow with hand-written substitutes that repeatedly require reviewer corrections. ## Test Plan - [x] Review the testing guidance against the existing generation workflow. ## Revert Plan - Revert this PR. No runtime behavior changes. ## Issue Links - [CODEM-449](https://linear.app/uber/issue/CODEM-449/ktlo-task) --- AGENTS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 8696debfe..b28e306fc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -343,6 +343,8 @@ deps = [ ### Testing +- **Generated dependency mocks** — Use generated mocks for dependency interfaces; reuse existing mocks or generate missing ones. Do not hand-write interface stubs or function adapters. Stateful in-memory backends may be used or implemented when a test needs their behavior. + - **Unit test package naming** — unit tests must use the same package name as the code under test (not a `*_test` package) so tests can access implementation details when needed. - **Table-driven tests** — prefer table-driven tests with `t.Run` subtests over individual test functions. - **Avoid asserting on error messages** — assert on error type or check the error with `require.Error`, do not `assert.Contains(t, err.Error(), message)`