feat(daemon): add GET /status endpoint (bd-148)

- Add OpStatus operation and StatusResponse type to RPC protocol
- Add workspacePath and dbPath fields to Server struct
- Implement handleStatus() handler with daemon metadata
- Track last activity time with atomic.Value
- Add client.Status() method
- Check for exclusive locks via ShouldSkipDatabase()
- Update all test files to use new NewServer signature
- Add comprehensive status endpoint test

Closes bd-148
This commit is contained in:
Steve Yegge
2025-10-26 17:55:39 -07:00
parent 6bf5c9d2b9
commit 75c959e69c
10 changed files with 203 additions and 43 deletions

View File

@@ -44,7 +44,7 @@ func TestConnectionLimits(t *testing.T) {
os.Setenv("BEADS_DAEMON_MAX_CONNS", "5")
defer os.Unsetenv("BEADS_DAEMON_MAX_CONNS")
srv := NewServer(socketPath, store)
srv := NewServer(socketPath, store, tmpDir, dbPath)
if srv.maxConns != 5 {
t.Fatalf("expected maxConns=5, got %d", srv.maxConns)
}
@@ -166,7 +166,7 @@ func TestRequestTimeout(t *testing.T) {
os.Setenv("BEADS_DAEMON_REQUEST_TIMEOUT", "100ms")
defer os.Unsetenv("BEADS_DAEMON_REQUEST_TIMEOUT")
srv := NewServer(socketPath, store)
srv := NewServer(socketPath, store, tmpDir, dbPath)
if srv.requestTimeout != 100*time.Millisecond {
t.Fatalf("expected timeout=100ms, got %v", srv.requestTimeout)
}
@@ -219,7 +219,7 @@ func TestMemoryPressureDetection(t *testing.T) {
socketPath := filepath.Join(tmpDir, "test.sock")
srv := NewServer(socketPath, store)
srv := NewServer(socketPath, store, tmpDir, dbPath)
// Add some entries to cache
srv.cacheMu.Lock()
@@ -272,7 +272,7 @@ func TestHealthResponseIncludesLimits(t *testing.T) {
os.Setenv("BEADS_DAEMON_MAX_CONNS", "50")
defer os.Unsetenv("BEADS_DAEMON_MAX_CONNS")
srv := NewServer(socketPath, store)
srv := NewServer(socketPath, store, tmpDir, dbPath)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()