Appearance
date: 2026-06-07 tags: [testing, fixtures, ids, false-positive] status: graduated graduated_to: .claude/rules/testing.md
Shared id = 1 across different objects in a test hides bugs
Symptom — A test stays green while the code is wrong: an assertion or lookup that should target one object (a comment) matches a different object (a task) because both were created with id 1.
Root cause — Factories and fakes default their ids sequentially from 1, so a task, a person and a comment created in the same test all get id 1. Code (or an assertion) that keys on the id alone then grabs the wrong object type and still passes — real bugs in id-keyed lookups/joins slip through.
Fix — Give each object in a multi-object test a distinct id (e.g. task 1, person 11, comment 21), so a wrong-object match fails loudly. A single object referenced in two places (a plan row + its matching fake) should still share its one id.
Guard — .claude/rules/testing.md ("Distinct IDs per object in a test"); retrofit of the existing suite tracked in #327. Candidate qa-tests lens.