diff --git a/internal/sessions/handler.go b/internal/sessions/handler.go index e1e8be5..b51d346 100644 --- a/internal/sessions/handler.go +++ b/internal/sessions/handler.go @@ -180,9 +180,12 @@ func (h *Handler) handleList(w http.ResponseWriter, r *http.Request) { searchQuery = fmt.Sprintf("%s cwd:%s", searchQuery, cwd) } + // entities query (not hybridSearch) — project arg is optional, so it queries + // across ALL projects. Required because each session lives in its own + // session- project; there is no single project to hybridSearch against. gqlQuery := `query($q:String!,$limit:Int!){ - hybridSearch(query:$q,limit:$limit,entityType:SESSION){ - entities{id name summary tCreated} + entities(query:$q,limit:$limit,entityType:SESSION){ + entities{id name summary projectId tCreated} searchMode } }` diff --git a/internal/sessions/handler_test.go b/internal/sessions/handler_test.go index eab1b5c..437bb4a 100644 --- a/internal/sessions/handler_test.go +++ b/internal/sessions/handler_test.go @@ -18,7 +18,8 @@ import ( // "query" field and records captured request bodies. // // - "upsertEntity" → mutation response -// - "hybridSearch" → search response +// - "hybridSearch" → search response (get, patch, episodes handlers) +// - "entities" → list response (sessions list handler) // - "entity" → single entity response func newGQLServer(t *testing.T, captured *[]byte) *httptest.Server { t.Helper() @@ -33,7 +34,11 @@ func newGQLServer(t *testing.T, captured *[]byte) *httptest.Server { case strings.Contains(bs, "upsertEntity"): fmt.Fprint(w, `{"data":{"upsertEntity":{"id":"test-entity-id","created":true}}}`) case strings.Contains(bs, "hybridSearch"): + // get, patch, episodes handlers still use hybridSearch fmt.Fprint(w, `{"data":{"hybridSearch":{"entities":[]}}}`) + case strings.Contains(bs, "entities"): + // sessions list handler uses entities query + fmt.Fprint(w, `{"data":{"entities":{"entities":[]}}}`) case strings.Contains(bs, "entity"): fmt.Fprint(w, `{"data":{"entity":null}}`) default: