Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/authorship/internal_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,14 @@ impl InternalDatabase {
&e,
Some(serde_json::json!({"function": "InternalDatabase::global"})),
);
// Create a dummy connection that will fail on any operation
// This allows the program to continue even if DB init fails
let temp_path = std::env::temp_dir().join("git-ai-db-failed");
let conn = Connection::open(&temp_path).expect("Failed to create temp DB");
// Create a dummy in-memory connection that will fail on any operation
// (no schema). This allows the program to continue even if DB init
// fails, without touching the filesystem (avoids PermissionDenied panic).
let conn = Connection::open_in_memory()
.expect("Failed to create in-memory fallback DB");
Mutex::new(InternalDatabase {
conn,
_db_path: temp_path,
_db_path: PathBuf::new(),
})
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/metrics/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ impl MetricsDatabase {
Ok(db) => Mutex::new(db),
Err(e) => {
eprintln!("[Error] Failed to initialize metrics database: {}", e);
// Create a dummy connection that will fail on any operation
let temp_path = std::env::temp_dir().join("git-ai-metrics-db-failed");
let conn = Connection::open(&temp_path).expect("Failed to create temp DB");
// Create a dummy in-memory connection that will fail on any operation
// (no schema). Avoids PermissionDenied panic on restricted /tmp.
let conn = Connection::open_in_memory()
.expect("Failed to create in-memory fallback DB");
Mutex::new(MetricsDatabase { conn })
}
}
Expand Down
Loading