Test: filename_audit run_audit_skips_disabled_and_offline_libraries fails (FK violation seeding rows) #151

Closed
opened 2026-09-30 00:41:32 +00:00 by cameron · 0 comments
Owner

Problem

filename_audit::tests::run_audit_skips_disabled_and_offline_libraries fails on master (aeeb05b), so the full suite has not been green — it failed identically through #145, #146 and #148:

thread 'filename_audit::tests::run_audit_skips_disabled_and_offline_libraries'
  panicked at src/filename_audit.rs:344:14:
seed row: DatabaseError(ForeignKeyViolation, "FOREIGN KEY constraint failed")

The test's seed helper inserts image_exif rows for library ids that don't exist in the in-memory database, and the insert trips the image_exif.library_id foreign key. It's a test-setup bug; the audit logic is untested rather than wrong. Likely (unverified): foreign keys became enforced after the test was written (it last changed in 89fc24c, 2026-09-25).

Also shows up as one clippy warning in the filename_audit bin ("this creates an owned instance just for comparison") — unrelated but in the same area.

Fix direction

Insert the libraries rows the test's libraries reference (ids + root paths from its library(...) helper) before seeding image_exif, per constitution III (in-memory DB via in_memory_db_connection()).

Acceptance

  • The test passes; cargo test fully green on master
  • It still exercises what its name says (disabled and offline libraries skipped)

🤖 Generated with Claude Code

## Problem `filename_audit::tests::run_audit_skips_disabled_and_offline_libraries` fails on master (`aeeb05b`), so the full suite has not been green — it failed identically through #145, #146 and #148: ``` thread 'filename_audit::tests::run_audit_skips_disabled_and_offline_libraries' panicked at src/filename_audit.rs:344:14: seed row: DatabaseError(ForeignKeyViolation, "FOREIGN KEY constraint failed") ``` The test's `seed` helper inserts `image_exif` rows for library ids that don't exist in the in-memory database, and the insert trips the `image_exif.library_id` foreign key. It's a test-setup bug; the audit logic is untested rather than wrong. Likely (unverified): foreign keys became enforced after the test was written (it last changed in `89fc24c`, 2026-09-25). Also shows up as one clippy warning in the `filename_audit` bin ("this creates an owned instance just for comparison") — unrelated but in the same area. ## Fix direction Insert the `libraries` rows the test's libraries reference (ids + root paths from its `library(...)` helper) before seeding `image_exif`, per constitution III (in-memory DB via `in_memory_db_connection()`). ## Acceptance - [ ] The test passes; `cargo test` fully green on master - [ ] It still exercises what its name says (disabled and offline libraries skipped) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
cameron added the needs-triage label 2026-09-30 00:42:47 +00:00
Sign in to join this conversation.