Implement database handshake protocol in RPC layer

- Add ExpectedDB field to RPC Request
- Server validates client's expected DB matches daemon's DB
- Return clear error on mismatch with both paths
- Old clients (no ExpectedDB) still work with warning
- Add Path() method to storage.Storage interface
- Tests verify cross-database connections rejected

Prevents database pollution when client connects to wrong daemon.

Amp-Thread-ID: https://ampcode.com/threads/T-c4454192-39c6-4c67-96a9-675cbfc4db92
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-21 20:35:44 -07:00
parent e1a445afd2
commit 645d268e43
6 changed files with 158 additions and 3 deletions

View File

@@ -69,6 +69,9 @@ type Storage interface {
// Lifecycle
Close() error
// Database path (for daemon validation)
Path() string
}
// Config holds database configuration