Skip to content

Redesign Search Dev Tools - #7386

Merged
rebeccahum merged 20 commits into
developfrom
feat/search-dev-tools-redesign
Oct 7, 2026
Merged

rebeccahum merged 20 commits into
developfrom
feat/search-dev-tools-redesign

Conversation

@rebeccahum

@rebeccahum rebeccahum commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Description

Redesigns Search Dev Tools around a sidebar + detail layout, replacing the stacked overlay where every query expanded in place.

  • Sidebar: every query on the page with its timing, matched hits, failure state and calling file. Paths truncate from the left so the file name and line number stay visible. Cross-site queries add how many sites they searched (4 hits · 2 sites).
  • Detail view: status chip, hits, timing and the index the query hit; an editable request with an inline Run button (or ⌘/Ctrl+Enter) once edited, Reset, and WP_Query / Trace tabs; a collapsible response tree with Expand all, Collapse all and Copy. A failed re-run says so in the chip (Edited · failed).
  • Header strip: Elasticsearch version, rate limiting and concurrency, then the current site's post types, statuses and meta allow list.
  • Multisite cross-site queries ('sites' => [ 2, 3 ] or 'all') show which indexes they reached, including the real indexes behind the network alias, with returned hits per index.
  • Hit counts: a capped total (relation: gte) reads as a lower bound (10,000+ hits), and a non-2xx Elasticsearch status marks a re-run as failed.
  • Edits and runs survive closing the panel: drafts, in-flight runs and their results or errors carry over when the panel is closed and reopened or another query is selected.
  • Light and dark themes, following the system preference by default.
  • Large payloads stay responsive: responses above 1 MB / 50,000 lines show as plain text on Expand all (or straight away if huge even when folded), and requests above 200 KB are edited without syntax highlighting.
  • Accessibility: single-tab-stop keyboard navigation in the response tree, ARIA tabs, a focus trap, screen-reader announcements for runs and copy, and WCAG AA contrast in both themes.
  • Smaller pages: the page data is printed compactly instead of pretty-printed (about 3x smaller).

Also removes the clipboard and pluralize dependencies and unused assets/styles, adds Node unit tests for the view-model logic, adds lint + unit test steps to the Search Dev Tools workflow, and rewrites the e2e spec and page object for the new UI.

Light:

Screenshot 2026-10-06 at 3 42 46 PM

Dark:
Screenshot 2026-10-06 at 3 42 34 PM

Changelog Description

Changed

  • Search Dev Tools: Redesigned the panel with a query sidebar, a detail view with editable requests and a collapsible response viewer, light and dark themes, and improved keyboard and screen reader support.

Pre-review checklist

  • This change works and has been tested locally or in Codespaces (or has an appropriate fallback).
  • This change works and has been tested on a sandbox.
  • This change has relevant unit tests (if applicable).
  • This change uses a rollout method to ease with deployment (if applicable - especially for large scale actions that require writes).
  • This change has relevant documentation additions / updates (if applicable).
  • I've created a changelog description that aligns with the provided examples.

Pre-deploy checklist

  • VIP staff: Ensure any alerts added/updated conform to internal standards (see internal documentation).

Steps to Test

  1. Check out this PR (with git submodule update for ElasticPress) and start a VIP local dev environment with Enterprise Search enabled and this checkout as mu-plugins (vip dev-env create --elasticsearch --mu-plugins=/path/to/vip-go-mu-plugins), then index content with wp vip-search index --setup.
  2. Visit a search page (e.g. /?s=hello) as an administrator and click Search in the Admin Bar.
  3. Select queries in the sidebar; check the WP_Query and Trace tabs and fold/unfold the response.
  4. Edit the request, run it with Run or ⌘/Ctrl+Enter, and confirm the response updates and the chip reads Edited; Reset restores the original. Close and reopen the panel: the edit and result are still there.
  5. Toggle Light / Dark.
  6. Optional (multisite): define EP_IS_NETWORK, run wp vip-search recreate-network-alias, and run a WP_Query with 'sites' => 'all' to see the site count in the sidebar (e.g. 11 hits · 3 sites), the indexes in the header and per-index hits.

Automated: npm run lint && npm test && npm run build in search/search-dev-tools, CI=1 ./bin/test.sh --filter Search_Dev_Tools_Test, and npm --prefix __tests__/e2e test -- specs/searchdevtools.spec.ts.

🤖 Generated with Claude Code

@rebeccahum
rebeccahum requested a review from a team as a code owner October 6, 2026 19:27
Copilot AI balanced review requested due to automatic review settings October 6, 2026 19:27
@rebeccahum
rebeccahum force-pushed the feat/search-dev-tools-redesign branch from ae2a043 to d19041d Compare October 6, 2026 19:28
Comment thread search/search-dev-tools/src/components/code-editor.js Fixed
Comment thread search/search-dev-tools/src/components/info-strip.js Fixed
Comment thread search/search-dev-tools/src/components/json-tree.js Fixed
Comment thread search/search-dev-tools/src/components/query-detail.js Fixed
Comment thread search/search-dev-tools/src/components/query-list.js Fixed
Comment thread search/search-dev-tools/tests/utils.test.mjs Fixed
Comment thread search/search-dev-tools/tests/utils.test.mjs Fixed
Comment thread search/search-dev-tools/tests/utils.test.mjs Fixed
Comment thread search/search-dev-tools/tests/utils.test.mjs Fixed
Comment thread search/search-dev-tools/tests/utils.test.mjs Fixed
Comment thread search/search-dev-tools/tests/utils.test.mjs Fixed
Comment thread search/search-dev-tools/tests/utils.test.mjs Fixed
Comment thread search/search-dev-tools/tests/utils.test.mjs Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Cross-site detection, concurrent reruns, tree path collisions, and large-payload rendering have unresolved correctness and performance issues.

Review effort: Balanced
Findings: 1 High severity · 5 Medium severity

Open (6)
What changed in this PR

Redesigns Search Dev Tools into an accessible sidebar/detail interface with improved diagnostics, editing, theming, and large-payload handling.

Changes:

  • Rebuilds the Preact UI around query navigation, request editing, and a collapsible response tree.
  • Adds multisite index diagnostics and compact backend data.
  • Expands PHP, Node, and end-to-end tests while removing obsolete dependencies and assets.
File Description
tests/​search/​test-search-dev-tools.php Tests backend metadata and alias resolution.
search/​search-dev-tools/​webpack.config.js Removes legacy Sass mixin injection.
search/​search-dev-tools/​tests/​utils.test.mjs Tests view-model and tree helpers.
search/​search-dev-tools/​src/​webpack-public-path.js Removes obsolete runtime asset path.
search/​search-dev-tools/​src/​utils.js Adds query and payload helpers.
search/​search-dev-tools/​src/​tree-lines.js Builds collapsible JSON tree lines.
search/​search-dev-tools/​src/​template.html Updates mock application data.
search/​search-dev-tools/​src/​style/​vars.scss Removes legacy design tokens.
search/​search-dev-tools/​src/​style/​style.scss Implements the redesigned themes and layout.
search/​search-dev-tools/​src/​style/​prism.scss Removes obsolete Prism theme.
search/​search-dev-tools/​src/​style/​mixins.scss Removes legacy typography mixins.
search/​search-dev-tools/​src/​manifest.json Removes unused web manifest.
search/​search-dev-tools/​src/​index.js Removes public-path bootstrap.
search/​search-dev-tools/​src/​context.js Adds screen-reader announcements.
search/​search-dev-tools/​src/​components/​style.scss Removes legacy component styles.
search/​search-dev-tools/​src/​components/​query/​style.scss Removes old query layout styles.
search/​search-dev-tools/​src/​components/​query/​index.js Removes stacked query component.
search/​search-dev-tools/​src/​components/​query-list.js Adds the query sidebar.
search/​search-dev-tools/​src/​components/​query-detail.js Adds query editing and response details.
search/​search-dev-tools/​src/​components/​overlay/​style.scss Removes legacy overlay styles.
search/​search-dev-tools/​src/​components/​overlay/​index.js Removes legacy overlay component.
search/​search-dev-tools/​src/​components/​json-tree.js Adds the accessible JSON viewer.
search/​search-dev-tools/​src/​components/​information-pane/​style.scss Removes old information styles.
search/​search-dev-tools/​src/​components/​information-pane/​index.js Removes old information pane.
search/​search-dev-tools/​src/​components/​info-strip.js Adds the diagnostic header strip.
search/​search-dev-tools/​src/​components/​collapsible-list/​style.scss Removes obsolete list styles.
search/​search-dev-tools/​src/​components/​collapsible-list/​index.js Removes obsolete list component.
search/​search-dev-tools/​src/​components/​code-editor.js Adds the request editor.
search/​search-dev-tools/​src/​components/​app.js Orchestrates panel state and accessibility.
search/​search-dev-tools/​src/​assets/​plus.svg Removes unused icon.
search/​search-dev-tools/​src/​assets/​minus.svg Removes unused icon.
search/​search-dev-tools/​src/​assets/​lg.svg Removes unused icon.
search/​search-dev-tools/​src/​assets/​close.svg Removes unused icon.
search/​search-dev-tools/​search-dev-tools.php Adds metadata and alias diagnostics.
search/​search-dev-tools/​README.md Documents the redesigned tool.
search/​search-dev-tools/​package.json Adds tests and removes dependencies.
search/​search-dev-tools/​package-lock.json Updates locked dependencies.
search/​search-dev-tools/​build/​bundle.css Rebuilds production styles.
.github/​workflows/​search-dev-tools.yml Adds lint and unit-test jobs.
__tests__/​e2e/​specs/​searchdevtools.spec.ts Expands redesigned UI coverage.
__tests__/​e2e/​lib/​pages/​search-page.ts Updates the Playwright page object.
Files not reviewed (2)
  • search/search-dev-tools/build/bundle.css: Generated file
  • search/search-dev-tools/package-lock.json: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread search/search-dev-tools/src/components/query-detail.js
Comment thread search/search-dev-tools/src/components/code-editor.js Outdated
Comment thread search/search-dev-tools/src/components/json-tree.js Outdated
Comment thread search/search-dev-tools/src/components/query-detail.js Outdated
Comment thread search/search-dev-tools/src/tree-lines.js Outdated
Comment thread search/search-dev-tools/src/utils.js Outdated
@rebeccahum
rebeccahum force-pushed the feat/search-dev-tools-redesign branch from d19041d to fd67bc2 Compare October 6, 2026 19:39
@rebeccahum
rebeccahum requested a balanced review from Copilot October 6, 2026 19:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

In-flight request protection is lost across remounts, and modal focus can escape through the Admin Bar.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)
Resolved since last review (6)
Files not reviewed (2)
  • search/search-dev-tools/build/bundle.css: Generated file
  • search/search-dev-tools/package-lock.json: Generated file

Comment thread search/search-dev-tools/src/components/query-detail.js Outdated
Comment thread search/search-dev-tools/src/components/app.js Outdated
Comment thread tests/search/test-search-dev-tools.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The clipboard fallback can falsely report success, mock scoping is inconsistent, and positive multisite detection lacks coverage.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
Resolved since last review (3)
Files not reviewed (2)
  • search/search-dev-tools/build/bundle.css: Generated file
  • search/search-dev-tools/package-lock.json: Generated file

Comment thread search/search-dev-tools/src/components/query-detail.js Outdated
Comment thread search/search-dev-tools/src/template.html
Comment thread search/search-dev-tools/src/template.html Fixed
Comment thread search/search-dev-tools/src/template.html Fixed
@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.53608% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.76%. Comparing base (d7026ce) to head (20b35ef).

Files with missing lines Patch % Lines
search/search-dev-tools/search-dev-tools.php 84.53% 15 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #7386      +/-   ##
=============================================
+ Coverage      40.29%   40.76%   +0.47%     
  Complexity      5591     5591              
=============================================
  Files            305      305              
  Lines          22192    22245      +53     
=============================================
+ Hits            8942     9068     +126     
+ Misses         13250    13177      -73     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rebeccahum
rebeccahum force-pushed the feat/search-dev-tools-redesign branch from e8cb5a9 to 0562bea Compare October 6, 2026 21:21
Replace the stacked overlay with a sidebar + detail layout:

- Sidebar lists every query with timing, matched hits, failures and the
  calling file (truncated from the left so the file name stays visible).
  Cross-site queries add the number of sites they searched ("4 hits · 2 sites").
- Detail view: status chip, hits, timing and index; editable request with
  inline Run / Cmd+Enter, Reset, WP_Query and Trace tabs; collapsible
  response tree with Expand all / Collapse all and Copy.
- Header strip with Elasticsearch, rate limiting and concurrency, plus the
  current site's post types, statuses and meta allow list.
- Multisite cross-site queries show the indexes they reached, including
  the real indexes behind the network alias, with hits per index.
- Light and dark themes.
- Large payloads stay responsive: plain-text fallback for very large
  responses, no highlighting for very large requests.
- Accessibility: native dialog, fieldset and output elements, keyboard
  navigation for the list, tree and tabs, focus containment, live
  announcements, AA contrast.
- Page data is printed compactly (about 3x smaller).

Drops the clipboard and pluralize dependencies and unused assets. Adds
Node unit tests, lint and unit test steps in CI, and rewrites the e2e
spec for the new UI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rebeccahum
rebeccahum force-pushed the feat/search-dev-tools-redesign branch from 0562bea to 5c9a5f2 Compare October 6, 2026 21:28
@rebeccahum
rebeccahum requested a balanced review from Copilot October 6, 2026 21:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Index extraction fails for supported Elasticsearch endpoints with path prefixes, and unresolved aliases can produce incorrect site information.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
Resolved since last review (2)
Files not reviewed (2)
  • search/search-dev-tools/build/bundle.css: Generated file
  • search/search-dev-tools/package-lock.json: Generated file

Comment thread search/search-dev-tools/search-dev-tools.php Outdated
Comment thread search/search-dev-tools/src/utils.js
rebeccahum and others added 2 commits October 6, 2026 15:35
Unit:
- Drop the multi-index half of the alias compaction test, which no longer
  tests compaction, and a cross-site assertion the URL fallback also passes.
- Drop a line-count check that used the function under test as its oracle.
- Merge the two per-index hit count tests, and the dotted-key path test into
  the unique render key test.
- Keep only the plain-number total case in the countHits test.

E2E:
- Merge the two single-run guard steps into one.
- Drop the raw REST JSON check; the on-screen response already covers it.
- Actually check that invalid JSON sends no request.
- Fold the highlighted-key counter into isRequestHighlighted().

PHPUnit:
- Trim the index-part provider to its distinct cases and drop type-only
  assertions from the info test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the Dev Tools copy of the URL-to-index helper and its test; core's
helper does the same thing and is already tested.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Clipboard fallback, failed-state accessibility, and unresolved network-alias reporting need correction.

Review effort: Balanced
Findings: None

Resolved since last review (2)
Files not reviewed (2)
  • search/search-dev-tools/build/bundle.css: Generated file
  • search/search-dev-tools/package-lock.json: Generated file
Previously missed (3)

In code that hasn't changed since last review

Medium severity Fallback to execCommand when Clipboard API writeText fails

search/​search-dev-tools/​src/​components/​query-detail.js:20

If the modern Clipboard API is present but writeText() rejects (for example because clipboard permission is denied by policy), this returns the rejection and never tries the existing execCommand fallback. The Copy button then silently does nothing even though the fallback may still work. Catch a rejected writeText() call and continue into the fallback path.

Medium severity Expose failed re-run status text beyond color styling

search/​search-dev-tools/​src/​components/​query-detail.js:122

For a failed re-run, the chip still says only “Edited” or “Re-run”; failure is conveyed solely by its red styling because the adjacent textual hit state is deliberately hidden. A user who cannot perceive that color and later revisits the result has no textual indication that it failed. Include “failed” in the chip’s visible or accessible name when summary.failed is true.

Medium severity Avoid treating unresolved aliases as concrete indexes

search/​search-dev-tools/​src/​utils.js:251

When the network-alias lookup fails, the backend intentionally returns an empty list and omits alias_indexes. This fallback then treats vip-…-post-all itself as a concrete index, so a cross-site query is reported as reaching “1 site” and the breakdown includes the alias as an index even though the reached indexes are unknown. Preserve an explicit alias-lookup status (or detect an unresolved -all alias) and avoid presenting the alias/member count as real data.

- Copy falls back to execCommand when the Clipboard API refuses the write.
- A failed re-run says so in the status chip ("Edited · failed"), not only
  with its color.
- When the network alias lookup fails, the backend flags it and the UI
  shows "all sites via post-all" instead of treating the alias as an index;
  the per-index counts come from the hits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rebeccahum
rebeccahum requested a balanced review from Copilot October 6, 2026 22:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Strict CSP blocks the JSON tree’s inline indentation style, flattening response hierarchy on supported CSP-enabled sites.

1 open finding
1 resolved since last review
Files not reviewed (2)
  • search/search-dev-tools/build/bundle.css: Generated file
  • search/search-dev-tools/package-lock.json: Generated file

🧠 Review effort: Balanced

Comment thread search/search-dev-tools/src/components/json-tree.js
…eaks under strict style-src CSP'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@rebeccahum
rebeccahum requested a balanced review from Copilot October 7, 2026 14:58
The breakdown now lists only the hits each index returned. Remove the
helper, request-size parsing and styles that only served the
"+N not returned" item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The optional alias lookup currently generates false operational failure telemetry, and the README overstates error presentation.

2 open findings
Files not reviewed (2)
  • search/search-dev-tools/build/bundle.css: Generated file
  • search/search-dev-tools/package-lock.json: Generated file

🧠 Review effort: Balanced

Comment thread search/search-dev-tools/search-dev-tools.php Outdated
Comment thread search/search-dev-tools/README.md Outdated
rebeccahum and others added 2 commits October 7, 2026 09:49
… above the response tree'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ctly count as failed queries'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Clipboard failures are silently swallowed, leaving assistive-technology users without failure feedback.

0 open findings

2 resolved since last review
Files not reviewed (2)
  • search/search-dev-tools/build/bundle.css: Generated file
  • search/search-dev-tools/package-lock.json: Generated file
Previously missed (1)

In code that hasn't changed since last review

Medium severity Announce clipboard failure when both copy paths are refused

search/​search-dev-tools/​src/​components/​query-detail.js:325

If both clipboard paths are refused, this catch leaves the button unchanged and emits no live-region message, so screen-reader users receive no feedback that Copy failed. Announce the failure here (and consider a visible error state for sighted users) rather than silently swallowing it.

🧠 Review effort: Balanced

A refused or unavailable clipboard was swallowed silently. Show "Copy failed"
on the button and announce it to screen readers; a newer copy restarts the
label's reset timer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Transport failures leave the original successful status and response displayed instead of recording the failed re-run.

1 open finding
Files not reviewed (2)
  • search/search-dev-tools/build/bundle.css: Generated file
  • search/search-dev-tools/package-lock.json: Generated file

🧠 Review effort: Balanced

Comment thread search/search-dev-tools/src/components/query-detail.js
- A transport failure becomes the re-run's result: the header reads
  "Re-run/Edited · failed", the response shows the error, and it is
  announced like a non-2xx response.
- Hide the per-index breakdown for failed results.
- The Run endpoint reports "non-JSON" only for an undecodable body and passes
  other JSON (string or array messages) through.
- Clear the live region when the panel opens or closes, so it doesn't start
  with a stale message.
- Indent the JSON tree with the padding style again: Preact sets it through
  the CSSOM, which a strict style-src CSP doesn't block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The broad UI, accessibility, shadow-DOM, persistence, and backend diagnostic changes warrant final human validation.

0 open findings

1 resolved since last review
Files not reviewed (2)
  • search/search-dev-tools/build/bundle.css: Generated file
  • search/search-dev-tools/package-lock.json: Generated file

🧠 Review effort: Balanced

@rinatkhaziev rinatkhaziev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Y U NO GITHUB GITHUB

@rebeccahum
rebeccahum merged commit 3d3abac into develop Oct 7, 2026
51 checks passed
@rebeccahum
rebeccahum deleted the feat/search-dev-tools-redesign branch October 7, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants