fix: critical data integrity — timeline dedup, discussion atomicity, index collision
Three correctness bugs found via peer code review: 1. TimelineEvent PartialEq/Ord omitted entity_type — issue #42 and MR #42 with the same timestamp and event_type were treated as equal. In a BTreeSet or dedup, one would silently be dropped. Added entity_type to both PartialEq and Ord comparisons. 2. discussions.rs: store_payload() was called outside the transaction (on bare conn) while upsert_discussion/notes were inside. A crash between them left orphaned payload rows. Moved store_payload inside the unchecked_transaction block, matching mr_discussions.rs pattern. 3. Migration 017 created idx_issue_assignees_username(username, issue_id) but migration 005 already created the same index name with just (username). SQLite's IF NOT EXISTS silently skipped the composite version on every existing database. New migration 018 drops and recreates the index with correct composite columns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,10 @@ const MIGRATIONS: &[(&str, &str)] = &[
|
||||
include_str!("../../migrations/016_mr_file_changes.sql"),
|
||||
),
|
||||
("017", include_str!("../../migrations/017_who_indexes.sql")),
|
||||
(
|
||||
"018",
|
||||
include_str!("../../migrations/018_fix_assignees_composite_index.sql"),
|
||||
),
|
||||
];
|
||||
|
||||
pub fn create_connection(db_path: &Path) -> Result<Connection> {
|
||||
|
||||
Reference in New Issue
Block a user