fix(test): add 0057 migration to 18 hand-rolled test pools (LC-217 follow-up) #261

Merged
nrupard merged 1 commit from fix/lc-217-migration-drift-test-pools into main 2026-05-29 18:33:54 +02:00
Owner

Summary

LC-217 (PR #259) added chat/0057_enclave_msg_rate_limit.sql and threaded the new enclaves.msg_rate_limit_burst column through every SELECT in db::enclave. Production picks the migration up via the embedded sqlx::migrate! macro; 18 test files that hand-roll their migration list via include_str!(...) did not.

Surfaced post-merge: cargo test --test db_custom_emojis panicked with no such column: msg_rate_limit_burst. CLAUDE.md Phase 24 category 2 documented this exact failure mode (LC-204 standing ticket).

What ships

  • Array form, 11 files at 8-space indent: db_custom_emojis, db_scheduled, db_bookmarks, migration_enclaves, uploads_sweep, scale_mentions, db_enclave, db_dm_mute, db_pinned, db_notifications, db_uploads. One-line addition after 0056_bridge_avatar_proxies.sql.
  • Array form, 6 files at 12-space indent: push_dispatch, scheduled_dispatcher, routes_reconnect, routes_analytics, routes_uploads, admin_uploads. Same one-line addition with matching indent.
  • Verbose form, 1 file: db_private_rooms. Matching 5-line sqlx::raw_sql(...).expect("migration 56") block, continuing the file's off-by-one numbering convention.

Test plan

  • cargo test --test db_custom_emojis --test db_private_rooms clean (the two files smoke-tested before the wider run).
  • cargo test --tests workspace-wide: 30+ binaries all green, no no such column failures.

Provenance

This was an LC-217 AC gap. New test files should use common::*_pool() (the sqlx::migrate!-backed helper) so migration drift never applies again; this PR only catches the existing hand-rolled set up to date.

## Summary LC-217 (PR #259) added `chat/0057_enclave_msg_rate_limit.sql` and threaded the new `enclaves.msg_rate_limit_burst` column through every `SELECT` in `db::enclave`. Production picks the migration up via the embedded `sqlx::migrate!` macro; 18 test files that hand-roll their migration list via `include_str!(...)` did not. Surfaced post-merge: `cargo test --test db_custom_emojis` panicked with `no such column: msg_rate_limit_burst`. CLAUDE.md Phase 24 category 2 documented this exact failure mode (LC-204 standing ticket). ## What ships - **Array form, 11 files at 8-space indent:** `db_custom_emojis`, `db_scheduled`, `db_bookmarks`, `migration_enclaves`, `uploads_sweep`, `scale_mentions`, `db_enclave`, `db_dm_mute`, `db_pinned`, `db_notifications`, `db_uploads`. One-line addition after `0056_bridge_avatar_proxies.sql`. - **Array form, 6 files at 12-space indent:** `push_dispatch`, `scheduled_dispatcher`, `routes_reconnect`, `routes_analytics`, `routes_uploads`, `admin_uploads`. Same one-line addition with matching indent. - **Verbose form, 1 file:** `db_private_rooms`. Matching 5-line `sqlx::raw_sql(...).expect("migration 56")` block, continuing the file's off-by-one numbering convention. ## Test plan - [x] `cargo test --test db_custom_emojis --test db_private_rooms` clean (the two files smoke-tested before the wider run). - [x] `cargo test --tests` workspace-wide: 30+ binaries all green, no `no such column` failures. ## Provenance This was an LC-217 AC gap. New test files should use `common::*_pool()` (the `sqlx::migrate!`-backed helper) so migration drift never applies again; this PR only catches the existing hand-rolled set up to date.
fix(test): add 0057 migration to 18 hand-rolled test pools (LC-217 follow-up)
All checks were successful
check-secrets / Nosey parker (pull_request) Successful in 3s
Create release / Create release from merged PR (pull_request) Has been skipped
check-secrets / Kingfisher (push) Successful in 4s
check-secrets / Nosey parker (push) Successful in 4s
check-secrets / TruffleHog (push) Successful in 4s
check-secrets / TruffleHog (pull_request) Successful in 5s
check-secrets / Kingfisher (pull_request) Successful in 6s
Check / clippy + fmt + tests (pull_request) Successful in 2m6s
7208b0b69d
LC-217 (PR #259) added `server/migrations/chat/0057_enclave_msg_rate_limit.sql` and threaded the new `enclaves.msg_rate_limit_burst` column through all five `SELECT` sites in `db::enclave`. Production picks the migration up automatically; tests that hand-list migrations via `include_str!(...)` did not.

Surfaced when `cargo test --test db_custom_emojis` was run on the post-merge main: `set_share_emojis_globally_round_trips` panicked at the SELECT with "no such column: msg_rate_limit_burst" because its pool's migration set stopped at 0056. 18 test files carry the same drift (CLAUDE.md Phase 24 category 2 documented this exact failure mode).

Two patterns coexist in the test directory:

- **Array form** (17 files): `for sql in [include_str!("../migrations/chat/0050_..."), ..., include_str!("../migrations/chat/0056_bridge_avatar_proxies.sql")] { ... }`. Add `include_str!("../migrations/chat/0057_enclave_msg_rate_limit.sql"),` after 0056. Six files use 12-space indent; eleven use 8-space. Per-file `sed` keeps each file's existing indent.
- **Verbose form** (1 file, `db_private_rooms.rs`): each migration is its own 5-line `sqlx::raw_sql(include_str!(...)).execute(&pool).await.expect("migration N")` block. Add a matching block for 0057 with `.expect("migration 56")` to continue the file's off-by-one numbering convention.

Files swept:

- Array (8-space): `db_custom_emojis`, `db_scheduled`, `db_bookmarks`, `migration_enclaves`, `uploads_sweep`, `scale_mentions`, `db_enclave`, `db_dm_mute`, `db_pinned`, `db_notifications`, `db_uploads`.
- Array (12-space): `push_dispatch`, `scheduled_dispatcher`, `routes_reconnect`, `routes_analytics`, `routes_uploads`, `admin_uploads`.
- Verbose: `db_private_rooms`.

Verified: `cargo test --tests` workspace-wide green (all 30+ test binaries pass; no `no such column` failures remain). `cargo test --test db_custom_emojis --test db_private_rooms` smoke-pass.

This was an LC-217 AC gap. New test files should prefer `common::*_pool()` (the `sqlx::migrate!`-backed helper) so migration drift never applies again; this commit only catches the existing hand-rolled set up to date.

#LC-217
nrupard deleted branch fix/lc-217-migration-drift-test-pools 2026-05-29 18:33:54 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/lets-chat!261
No description provided.