Skip to content

webui: wire up topbar search and fetch foreign ID matches server-side#197

Merged
andrewwormald merged 2 commits into
mainfrom
webui-foreign-id-search
Jul 19, 2026
Merged

webui: wire up topbar search and fetch foreign ID matches server-side#197
andrewwormald merged 2 commits into
mainfrom
webui-foreign-id-search

Conversation

@ScaleneZA

@ScaleneZA ScaleneZA commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bind the topbar search input to the foreign ID filter: it previously had no value or onChange handlers, so typing into it never sent a request
  • Fetch exact foreign ID matches server-side via filter_by_foreign_id and merge them into the base list by run_id, so runs older than the newest 500 are findable by full foreign ID
  • Debounce the refetch by 300ms so typing does not fire a request per keystroke
  • Correct the misleading hints: placeholder now says the input searches foreign IDs, and the shortcut badge shows / (the implemented focus shortcut) instead of Cmd+K

What changed

  • adapters/webui/internal/frontend/home.html: split apiFetchRuns into apiFetchList plus a merging wrapper, add debounced filters.foreignId state feeding doFetch, wire Topbar search to the shared filter state

Verification

  • Headless Chrome against _examples/webui: typing Customer 2 into the topbar search sends {"filter_by_foreign_id":"Customer 2"} to the list endpoint and the table narrows to that run; the same interaction on the previous code sent no request at all
  • go build ./... and go test ./... pass in adapters/webui; all embedded JSX blocks compile under Babel

Limitations

  • Server-side foreign ID filtering is exact match, so a partial foreign ID still only narrows the newest 500 runs client-side; the full ID always finds the run regardless of age

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a controlled foreign-ID search field to the top navigation bar.
    • Updated the top bar UX with “/” keyboard indicator for faster search access.
    • Search results now include older exact matches in addition to the newest entries.
  • Performance

    • Debounced foreign-ID search input to reduce unnecessary server requests.
    • Prevented out-of-order results from overwriting newer state by guarding async updates.

The topbar search input had no handlers, so typing into it never
triggered a request. It is now bound to the same foreign ID filter as
the filter bar.

The runs list only fetched the newest 500 records and filtered
client-side, so any older run was unfindable by foreign ID. When a
foreign ID is set, the frontend now also requests exact matches via
filter_by_foreign_id and merges them into the result set. The refetch
is debounced by 300ms to avoid a request per keystroke.

Also corrects the search placeholder and shortcut hint: the input
searches foreign IDs and the implemented focus shortcut is '/', not
Cmd+K.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ad78172a-d6a1-447d-ae12-e098270fd7bc

📥 Commits

Reviewing files that changed from the base of the PR and between b6c0daa and 322c50b.

📒 Files selected for processing (1)
  • adapters/webui/internal/frontend/home.html

📝 Walkthrough

Walkthrough

The Runs UI adds a controlled foreign-ID search input to the top bar. App debounces filter changes by 300 milliseconds before fetching and ignores stale asynchronous responses. Run-list fetching requests both the newest base list and a server-filtered list, then merges results by run_id. App wiring passes the current filter to Topbar and updates it from input changes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Poem

I twitch my nose at IDs in flight,
A search box glows with / delight.
Three hundred ticks, then runs appear,
Merged by their IDs, both far and near.
Hop, hop—clean results take flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: wiring topbar search to server-side foreign ID matching.
Description check ✅ Passed The description is directly related to the code changes and verification described in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch webui-foreign-id-search

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested a review from andrewwormald July 17, 2026 09:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@adapters/webui/internal/frontend/home.html`:
- Around line 1906-1912: Update the doFetch callback to track the active request
with a useRef and assign each invocation a unique request identifier. Only apply
apiFetchRuns results or errors when the response belongs to the latest request,
while preserving loading cleanup for the active request; import useRef from
React if needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6eb9714c-cba2-4317-93f8-7e46bc1a08cc

📥 Commits

Reviewing files that changed from the base of the PR and between 0a9e052 and b6c0daa.

📒 Files selected for processing (1)
  • adapters/webui/internal/frontend/home.html

Comment thread adapters/webui/internal/frontend/home.html
Debounced search fetches can overlap with polling fetches, and a stale
response resolving late would overwrite fresher results. Track the
active request with a monotonic ID so only the latest response writes
state.

Addresses CodeRabbit review feedback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@andrewwormald
andrewwormald merged commit 654166e into main Jul 19, 2026
8 checks passed
@andrewwormald
andrewwormald deleted the webui-foreign-id-search branch July 19, 2026 11:56
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.

3 participants