byterover-cli icon indicating copy to clipboard operation
byterover-cli copied to clipboard

feat: [ENG-3022] Render query results as a list in LocalWebUI

Open ncnthien opened this issue 6 months ago • 1 comments

Summary

Renders LocalWebUI query-tool-mode task results as a scannable list instead of a raw JSON blob, and polishes the surrounding task-detail view.

  • Result list (ENG-3022): each matched doc as a row — title, a match-score badge with a "Match score" tooltip, the path, and an expandable content preview. Legacy / non-JSON results fall through to the existing markdown/HTML rendering.
  • Readable input & title (ENG-3022): decodes the encoded {limit,query} content so the INPUT box, panel title, and list-row title show the query instead of raw JSON.
  • Clickable paths (ENG-3022): each result path opens the file in the Context tab if it still exists, otherwise toasts — reusing the existing findNodeByPath + stale-path convention.
  • EVENT LOG removal (ENG-3023): removes the EVENT LOG section from the task detail and deletes the now-orphaned event-log helpers.

Testing

npm run lint && npm run typecheck && npm test — green (8920 passing, 0 failing).

ncnthien avatar Jun 02 '26 04:06 ncnthien

Claude finished @ncnthien's task in 5m 16s —— View job


Code Review

Overall score: 4 / 5 — solid, well-scoped refactor. Net –370 lines from removing the EVENT LOG + tool-call view, plus a clean structured-result panel for query-tool-mode results. Parsing logic is properly type-narrowed (no as/any cheats), test coverage on the parser is thorough, and the consumer-first wiring (component → parser util) matches the project's outside-in approach in CLAUDE.md.

What works well

  • parseQueryToolModeResult / queryToolModeRowTitle (src/webui/features/tasks/utils/query-tool-mode-results.ts): defensive parsing with safeJsonParse + isMatchedDoc type-guard, no assertions. Test file covers happy path, ordering, empty matches, missing/wrong-shape fields, malformed JSON, and non-object payloads — exactly the surface area that matters for untrusted JSON.
  • Clean deletion of task-detail-event-log.tsx (-261) and task-detail-tool-call.tsx (-345): grep shows zero remaining references to EventLogSection, EventDot, EventTone, RAIL_BG, buildEventTimeline, etc. The task-detail-shared.tsx cleanup correctly drops only the now-orphan exports (SectionLabel, TerminalDot, Separator, elapsedMs are still used by the four remaining consumers).
  • stalePathMessage extraction (src/webui/features/context/utils/topic-viewer-navigation.ts): nice small DRY — both the legacy topic-viewer hook and the new task-result hook now share one message.
  • taskDisplayTitle unifies row-title decoding for curate-tool-mode and query-tool-mode, with sensible fall-through for plain task types.
  • syntax-highlighter.ts comment update correctly reflects the new call-site count (2 instead of 3).

Issues / suggestions

suggestion — use-navigate-to-context-path.ts is not branch-aware: it queries default-branch nodes and navigates to /contexts?path=… without preserving branch. On non-default branches this can both (a) falsely toast "stale path" and (b) drop the user back to the default branch when navigating. See inline.

suggestion — QueryResultRow.useLayoutEffect only re-checks overflow when doc.rendered_md changes; resizing the Tasks panel won't update the Show more/less toggle. A ResizeObserver would harden this. See inline.

nitpick — QueryResultsList builds the label string manually instead of using SectionLabel's existing count prop. See inline.

note — The local QueryToolModeMatchedDoc type duplicates the canonical server-side i-query-executor.ts shape (intentional, due to the webui → server import boundary). Worth tracking for future de-duplication via src/shared/. See inline.

Correctness & safety

  • No as/any/! assertions in the new code — parseQueryToolModeResult properly narrows via runtime type guards.
  • ES module + .js test imports follow project conventions.
  • snake_case rendered_md correctly preserved (matches the JSON wire envelope; mirrors the server's eslint-disable camelcase pattern).
  • No dangerouslySetInnerHTML; HTML rendering goes through MarkdownInline which uses react-markdown (XSS-safe by default).
  • Component handles 0-match, malformed-JSON, and missing-rendered_md cases gracefully.

Tests

PR description: npm test reported 8920 passing, 0 failing. Could not re-run locally (no node_modules in this checkout). Parser tests look thorough; the QueryResultsList component itself is presentational and exercised through visual checks — fine for unit-test scope.


  • [x] Read CLAUDE.md and gather PR diff
  • [x] Review new utility files (query-tool-mode-results, safe-json-parse, task-display-title)
  • [x] Review new component (query-results-list.tsx)
  • [x] Review modified components (task-detail-sections, task-detail-header, task-list-table)
  • [x] Review navigation hook (use-navigate-to-context-path.ts)
  • [x] Verify deletions are properly orphaned (event-log, tool-call)
  • [x] Check tests for completeness
  • [x] Post inline comments + summary with score · Branch: feat/ENG-3022

github-actions[bot] avatar Jun 02 '26 04:06 github-actions[bot]