Skip to content

Find in the diagram, from the palette's loupe (stage 8.4) - #266

Merged
endrix merged 4 commits into
mainfrom
feat/stage-8-4-find
Dec 2, 2026
Merged

endrix merged 4 commits into
mainfrom
feat/stage-8-4-find

Conversation

@endrix

@endrix endrix commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Stage 8.4 of the mlir-viewer convergence plan (mlir-viewer/docs/plans/dialogram-stage-8-plan.md): the palette's loupe opens find in the diagram, in every product. Ported from mlir-viewer's palette-search.ts and made neutral. The mlir-viewer pull request that feeds it and deletes its own search follows.

What the reader sees

  • The loupe opens a box at the top of the palette: a chip saying where it searches, the query with a .* toggle, a tab per field where the root names fields, the count, and the matches.
  • It finds nodes in the model, not in the drawing, so a node off screen or too small to be drawn at the zoom is found too.
  • With one node selected that holds other nodes, the search stays inside it, and the chip says so (× searches the whole view). A hit that find selected itself does not become the scope, so the next query is not confined to the last hit.
  • A click on a row, or Enter for the first, selects the hit and centres it where names are drawn at the zoom shown, else fits it no closer than 1:1. A product whose matches are read in the detail of a node says that zoom (ViewToolPalette.findReadableZoom).
  • The chip and the matches follow the selection and the model while the box is open.
  • In a palette that lists tools (wfpy, the sidecar products), the same text filters the tools, as GLSP's field did: one loupe, one box. Escape closes the box and gives the tools back.

What a producer gives

  • wf:searchText on a node: one text, matched with the name, or a text per field. A field named name stands for the name of the node.
  • wf:searchDetail on a node: shown beside a match, so that like rows can be told apart (mlir: the value an operation defines).
  • wf:searchFields on the root: [{ key, label, title? }], one tab each.
  • Without any of them a node is found by cal:entityName, or a frame by its label, and the row ends with its line from cal:sourceRange.

Changed

  • The view options are no longer filtered by the text, and the palette no longer says "No results found.": find says what it matched. The two tests of the old filter are rewritten for that.
  • GLSP draws a new body on every filter, which took the box out of the page and the focus out of the query (found live: Enter went to the page). The palette puts the focus and the caret back after it.

Checked

  • /code-review medium: seven findings, all fixed in the second commit (the × against an action handled later, Enter before the search, the selection followed, a revealed node as a scope again, one field without a tab, the scope's own node listed, the body drawn at every key).
  • Found by the live check in mlir-viewer and fixed in the third commit: find searched again when the model's action was handled, before its root was in place.
  • diagram-find.test.ts, 36 tests: matching by name, field, text and expression; scope, including a leaf selected and a hit find selected; rows, count, detail and line; the box (tabs, Enter, Escape, clearing the scope); the palette (loupe, tool filter with the focus kept, reveal by zoom); the stylesheet. The focus test fails without the fix.
  • Dialogram typecheck, build, every suite, and the neutrality check pass.
  • Live in wfpy (10_parallel_agents, harness on 9338): "keyw" finds keywords, the tools filter out, Enter selects and centres it with the caret kept in the query, the next query stays in view, Escape gives the 12 tools back. The mlir checkpoint (arith.constant inside an isolated function on Top_SW_array.llvm.mlir) comes with the mlir-viewer pull request.

https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY

The loupe opens a box at the top of the palette that finds nodes in the
model, not in the drawing, so a node off screen or too small to be drawn
is found too. Ported from mlir-viewer's search and made neutral:

- a node matches by its name (cal:entityName, or a frame's label) and by
  the text a producer adds (wf:searchText, one text or a text per field);
- a root that names fields (wf:searchFields) gets a tab per field, and a
  query can be a regular expression;
- with one node selected that holds others, the search stays inside it,
  and a hit that find selected itself does not become the scope;
- a row ends with the name of the node around the match, or its line
  inside a scope of that name, and wf:searchDetail tells like rows apart;
- a click or Enter selects the hit and centres it where names are drawn
  at the zoom, else fits it no closer than 1:1.

In a palette that lists tools the same text filters the tools, as GLSP's
field did. The view options are no longer filtered, and the palette no
longer says "No results found.": find says what it matched. GLSP draws a
new body on every filter, so the palette puts the focus back in the
query after it.

Claude-Session: https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY
- The × of the chip left the scope only until the next search: the node
  stays selected until the action that deselects it is handled. Its
  selection is now no scope until the reader selects something else.
- Enter went to the first match of the text as it was before the last
  keys. It searches first.
- The chip and the matches did not follow a click in the diagram while
  the box was open. The palette refreshes find on a selection change, and
  a search with the same answer leaves the rows, and the focus on one,
  alone.
- A node find revealed was never a scope again. It is one once the reader
  has selected something else and comes back to it. A scope is also kept
  while the action of a reveal is not handled yet.
- A root that names one field got no tab and a search of that field
  alone. It now matches every text, as the doc of wf:searchFields says.
- A search inside a node listed the node itself. It starts at what the
  node holds.
- The palette drew its whole body again at every key. It is told the
  text with the search, after the pause.

Claude-Session: https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY
The palette searched again when the action that brings a model was
handled, which is before its root is in place: the search was of the
model being replaced, and nothing searched the new one. Found live in
mlir-viewer, where a block expanded with find open kept "no matches".
Find now searches again on the editor context's model root change.

Claude-Session: https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY
A hit is centred where it can be read at the zoom shown, else fitted.
That zoom is the one names are drawn from. A product whose matches are
read in the detail of a node (mlir-viewer: a value in a row of the body)
overrides ViewToolPalette.findReadableZoom, so that a hit is not centred
on a box that does not show what matched.

Claude-Session: https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY
@endrix
endrix merged commit 551cbb7 into main Dec 2, 2026
1 check passed
@endrix
endrix deleted the feat/stage-8-4-find branch December 2, 2026 15:13
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.

1 participant