@@ -184,3 +184,24 @@ artifact in a real browser (Chromium at
184184` executablePath: /opt/pw-browsers/chromium ` ; default Playwright download is
185185absent). State clearly in the report that live behavior itself was not
186186observed.
187+
188+ ## Seeding ` Tag ` rows via a data migration breaks tests that assert on the whole table — use a management command instead
189+
190+ Tried seeding six new ` Tag ` rows via a Django data migration (RunPython).
191+ Broke 5 unrelated tests (` test_views.py::TestGetTags::* ` ,
192+ ` test_tag_votes.py::TestPostTagConsensus::test_returns_an_entry_for_every_seeded_tag ` )
193+ because they assert the _ complete_ ` Tag ` table is empty in a fresh DB
194+ (besides the synthetic, never-persisted ` "NSFW" ` pseudo-tag from
195+ ` cardpicker/tags.py ` ) — a migration runs unconditionally at DB-setup time,
196+ including the test database, so any migration-seeded row becomes
197+ permanent baseline state for every test in the suite, not just the ones
198+ that care about it. The repo's existing 13-tag ` DEFAULT_TAGS ` taxonomy
199+ (` cardpicker/default_tags.py ` ) is deliberately _ not_ wired into any
200+ migration for exactly this reason — it's a manual, idempotent
201+ ` seed_default_tags ` management command only. Any future tag/taxonomy
202+ seeding should follow that same pattern (a ` ..._tags.py ` module +
203+ ` get_or_create ` + a thin management-command wrapper), never a migration,
204+ regardless of how the request is phrased ("data migration" in a task spec
205+ should be read as "a repeatable seeding step," not literally
206+ ` migrations.RunPython ` , when the target table has DB-wide list-all
207+ consumers).
0 commit comments