DeepSpeed
f15c990d - docs: add test discipline rules to agent guidelines (#8372)

Commit
84 days ago
docs: add test discipline rules to agent guidelines (#8372) ## Motivation AI coding agents increasingly submit tests alongside features, and a recurring failure mode of such contributions is tests coupled to the implementation rather than the contract: - asserting private method return values or exact internal strings, - re-implementing the logic under test as the test's own reference, - mocks that stand in for internals instead of a documented collaborator contract. Such tests pass trivially, break on harmless refactors (or worse, survive bugs they should catch), and give false coverage confidence. ## What this PR adds A `### Test discipline` section to the agent guidelines (`AGENTS.md` + `CLAUDE.md`, kept in sync as the file header requires) with operational rules: 1. A test is well-formed only if a different correct implementation of the same contract passes it. 2. Name the concrete incorrect behavior a test would catch before writing it; if none can be named, do not write it. 3. Assert observable outcomes through public/stable interfaces; white-box pinning only for specific fixed bugs, justified in a comment. 4. Anchor to an external oracle or an independently derived reference instead of re-implementing the logic under test. 5. Mocks must stand in for a collaborator's documented contract (schema, protocol), never for internals of the module under test. The rules are deliberately example-free to keep the guide lean. --------- Signed-off-by: Ma, Guokai <guokai.ma@intel.com>
Author
Parents
Loading