Skip to content

feat(web): add bounded session search endpoint - #362

Open
seekskyworld wants to merge 2 commits into
openpi-dev:mainfrom
seekskyworld:feat/issue-349-bounded-session-search
Open

feat(web): add bounded session search endpoint#362
seekskyworld wants to merge 2 commits into
openpi-dev:mainfrom
seekskyworld:feat/issue-349-bounded-session-search

Conversation

@seekskyworld

Copy link
Copy Markdown

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 --noEmit
  • node --test --experimental-strip-types tests/web/web-host.test.ts tests/web/pi-adapter.test.ts (32 passed)
  • git diff --check

Impact

  • User-visible behavior: adds a bounded server search endpoint.
  • Model-visible context/tools: none.
  • Runtime/lifecycle: read-only projection.
  • Persisted config/data: none.
  • Compatibility/risk: no existing endpoint changes; full transcript search/indexing is not claimed.

Signed-off-by: seekskyworld <djh1813553759@gmail.com>
Signed-off-by: seekskyworld <djh1813553759@gmail.com>

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#376 选一个;这不是 #387

内存里搜 name/preview/cwd,200 字符 / 100 命中,不加载 transcript,归档默认不搜 — 切片干净。但没有分页、没有测试、truncated 写死。#376 改了同一套函数的参数形状。

请和 #376 合成一份带测试的元数据搜索。transcript 正文搜索留给 #387

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants