feat(web): add bounded session search endpoint - #362
Conversation
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
tt-a1i
left a comment
There was a problem hiding this comment.
Exact-head review: 96a71f6
[P1] Server-side search cannot find sessions outside the newest 500-entry UI projection. searchSessions() calls listSessionProjection(), which first truncates SessionManager.listAll() to WEB_MAX_SESSIONS at web/adapter/pi-adapter.ts:314-340, and only then applies the query at lines 514-527. With 501 sessions, a unique match in the oldest session is guaranteed to return no result even though the canonical Session metadata exists.
That defeats the central value of moving search to a reusable server boundary and makes missing results look authoritative. Please search the canonical Pi-owned metadata before applying the response cap, while keeping query/result/work bounds explicit; add a regression with more than 500 sessions whose only match is beyond the snapshot projection.
Verification boundary: exact-head static path analysis and boundary construction; current tests cover result bounds but not a match outside the projection cap.
Problem
Implements the bounded metadata-search slice of #349. Web search was limited to browser-side filtering and had no reusable server boundary.
Value
Clients can search Session names, first-message previews, and workspace paths without loading every transcript into the browser.
Approach
Add an adapter search method with a 200-character query bound, optional archived filtering, and a 100-result cap. Expose it through authenticated
GET /api/search; canonical Session files remain the source of truth and transcript-aware indexing remains future work.Validation
npx tsc --noEmitnode --test --experimental-strip-types tests/web/web-host.test.ts tests/web/pi-adapter.test.ts(32 passed)git diff --checkImpact