Skip to content

Conversation

@mchenani
Copy link
Contributor

@mchenani mchenani commented Dec 16, 2025

Fix migration tests by renaming migration directories to remove the -0000 suffix across xmtp_db migration pairs

Rename multiple migration up.sql and down.sql files to drop the -0000 segment in their directory names, keeping contents unchanged to align test expectations.

📍Where to Start

Start by reviewing the directory rename for xmtp_db/migrations/2025-10-28-175920_update_conversation_list_for_unknown_content_types/up.sql and its paired down.sql to confirm naming consistency across migrations.


Macroscope summarized 823ba24.

@mchenani mchenani marked this pull request as ready for review December 16, 2025 17:30
@mchenani mchenani requested a review from a team as a code owner December 16, 2025 17:30
@claude
Copy link

claude bot commented Dec 16, 2025

Claude finished @mchenani's task —— View job


Code Review Complete ✅

Review Date: December 16, 2025, 19:22 UTC


Summary

This PR fixes migration directory naming by removing the -0000 suffix from four migration pairs. The changes are pure directory renames with no content modifications (R100 = 100% identical content).

Analysis

What Changed:

  • 2025-10-28-175920-0000_update_conversation_list_for_unknown_content_types/2025-10-28-175920_update_conversation_list_for_unknown_content_types/
  • 2025-11-14-185054-0000_add_dm_id_index/2025-11-14-185054_add_dm_id_index/
  • 2025-11-25-213223-0000_make_icebox_depending_fields_non_null/2025-11-25-213223_make_icebox_depending_fields_non_null/
  • 2025-12-08-160215-0000_drop_events_table/2025-12-08-160215_drop_events_table/

Why This Fix Works:

  1. Diesel migrations use directory names as version identifiers
  2. The -0000 suffix was likely added accidentally (possibly by a migration generation tool)
  3. The standard Diesel naming convention is YYYY-MM-DD-HHMMSS_description without any suffix
  4. All other migrations in the directory follow this standard format (see: 2025-11-15-232503_add_inserted_at_ns_to_group_messages/)

Migration Test Framework:
The codebase has comprehensive migration tests in db_tools/src/tasks/migrations.rs that:

  • Test rollback/rerun cycles (lines 73-98)
  • Verify migration ordering (lines 101-116)
  • Test specific migration application (lines 119-169)
  • Validate migration status tracking (lines 172-249)

These tests rely on matching migration names with applied versions by filtering numeric characters only (line 60-68), so the -0000 suffix would have caused mismatches.

✅ Approval Factors

  1. Correct Fix: Aligns with Diesel's standard naming convention
  2. No Code Changes: Pure renames with identical content (0 additions, 0 deletions)
  3. Consistent Pattern: All four renames follow the same pattern
  4. Low Risk: Cannot introduce bugs since SQL content is unchanged
  5. Test Alignment: Migration tests use numeric matching that works correctly with standard naming

No Issues Found

  • No security concerns (no code changes)
  • No performance impact (directory names only)
  • No test coverage gaps (existing migration tests cover this)
  • No best practice violations (fixes a naming convention issue)

Recommendation: ✅ Approve and merge


@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.93%. Comparing base (ff5b9a5) to head (ef8261d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2958   +/-   ##
=======================================
  Coverage   73.92%   73.93%           
=======================================
  Files         407      407           
  Lines       52086    52086           
=======================================
+ Hits        38506    38508    +2     
+ Misses      13580    13578    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mchenani mchenani enabled auto-merge (squash) December 16, 2025 17:46
@mchenani mchenani disabled auto-merge December 16, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants