From 2be895fea5611a65d5286cf1d7f7a6e3c7001444 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Sat, 9 Aug 2025 23:24:26 -0300 Subject: [PATCH] chore: remove invalid race condition bug risk #11 from PLAN.md Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) --- PLAN.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/PLAN.md b/PLAN.md index 87e10ff..c105508 100644 --- a/PLAN.md +++ b/PLAN.md @@ -78,11 +78,4 @@ - `src/modes/diff.rs: mode_diff()` → `validate_diff_args()`, `setup_diff_pipes()`, `spawn_writer_threads()`, `execute_diff_command()`, `handle_diff_output()` - `src/modes/diff.rs: write_item_to_pipe()` → `open_item_reader()`, `copy_item_data()` -## Specific Bug Risks - -### 11. Race Conditions -**Files affected:** `src/db.rs`, `src/modes/save.rs` -**Functions affected:** `insert_item()`, `mode_save()` -**Problem example:** While SQLite uses file locking, multiple processes could still create items with same auto-increment ID if they begin transactions simultaneously before the lock is acquired, leading to potential file overwrites when using `item_id.to_string()` as filename -**Fix example:** Use database-level unique constraints and handle conflicts gracefully, or use UUIDs for filenames instead of auto-increment IDs