[Chore-1107] Document shared-factory pitfalls in tests/AGENTS.md

Story 1107Epic None1 files · +35/−0

PR #285 · pramaan-io/pramaan-functions · merged 2026-06-09

Why this matters

Tests that pass alone — and die together in CI.

The hidden cost of factories shared across files.

One test rewrote everyone else's ground truth.

The fix — One factory, fresh copy per test — share the code, not the state.

How it flows

sequenceDiagram
  autonumber
  participant test_a as Test A
  participant factory as Factory
  participant test_b as Test B
  test_a->>factory: ask for data
  factory->>test_a: fresh page
  test_a->>test_a: mutate locally
  test_b->>factory: ask for data
  factory->>test_b: another fresh page
  test_b->>test_b: no scribbles inherited

Files changed (1)

File±
tests/AGENTS.md+35