Implement stricter daemon lock file validation (bd-161)
- Add JSON format to daemon.lock with database path, version, PID, and timestamp - Validate database path on client connection (fail if mismatch) - Backward compatible with old plain-PID lock files - Add comprehensive tests for JSON format and validation - Update all lock acquisition callsites to pass database path Amp-Thread-ID: https://ampcode.com/threads/T-137e6a9c-b690-4ade-9bec-13fcd7d0e4ed Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -132,7 +132,8 @@ func TestIsDaemonRunning_CurrentProcess(t *testing.T) {
|
||||
|
||||
// Acquire the daemon lock to simulate a running daemon
|
||||
beadsDir := filepath.Dir(pidFile)
|
||||
lock, err := acquireDaemonLock(beadsDir, false)
|
||||
dbPath := filepath.Join(beadsDir, "beads.db")
|
||||
lock, err := acquireDaemonLock(beadsDir, dbPath)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to acquire daemon lock: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user