Skip to content

test: pin the property panel's agent UI in a real DOM before it moves to wfpy-ide - #132

Open
endrix wants to merge 2 commits into
mainfrom
test/agent-editor-characterization
Open

endrix wants to merge 2 commits into
mainfrom
test/agent-editor-characterization

Conversation

@endrix

@endrix endrix commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Nothing tested wfpy's agent UI, and all of it is about to move from the platform into wfpy-ide:

  • the @agent editor, about 1,900 lines inside one method of property-panel.ts;
  • Agent Tools;
  • the agent-context section;
  • the @tool editor;
  • the annotation wizard's @tool and @viewer templates.

This PR pins that UI as it is, so the refactor and the move can be checked against it.

The dependency

happy-dom 21.0.4 (released 2026-10-20) becomes a dev dependency of @dialogram/diagram-client, pinned exactly. It adds no advisory: npm audit --package-lock-only reports the same 28 with and without it, all already on main. Only the files that ask for it (// @vitest-environment happy-dom) run in it; the rest of the suite stays on node. The lockfile change is happy-dom and its five packages.

What is pinned (packages/diagram-client/test/agent-ui/)

The tests render the shipped PropertyPanel, with only its window chrome skipped, and the shipped wizard handler. The dispatcher and the VS Code bridge are recorders. lit, the Markdown renderer and DOMPurify run for real against happy-dom.

What How
The whole panel for wfpy's analyst agent (arguments from fixtures-speculation-flow.json) DOM dump snapshot
What showing an agent asks for: the server's skills and agent presets, the host's tool settings exact actions and calls
What Save sends, for a default prompt, an edited one, a picked skill and a picked preset; Remove annotation text and argument updates
The skill and preset pickers the server's answers fill; the message when none was found picker items, DOM
Agent Tools: the host's settings shown and each change sent; absent without a run driver or without @agent DOM, calls
The agent context of a stateful agent (wfpy's input shape, Markdown, thinking, a long reply); absent without a history or with a broken one; replaced in place when the run updates it DOM, element identity
The @tool editor and its Save DOM, annotation text
The header's Add @agent, Add @tool and Wizard buttons exact actions
The wizard's menus, @tool, @viewer open, diff and open-with (from the settings, and a custom editor remembered), and remove exact annotation text

The tests characterize; they do not judge. What they pin is what ships today. Two things they made visible, unchanged here:

  • Saving a @tool rewrites inheritStdio=true as inherit_stdio=True.
  • An agent input that isn't wfpy's message shape (task, instance, inputs, fileInputs) renders as an empty card.

Checks

  • Changing one placeholder string in the agent editor fails two of these tests.
  • diagram-client: 400/400 (73 files).
  • scripts/typecheck.sh: 5/5.

https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv

… to wfpy-ide

Nothing tested wfpy's agent UI: the `@agent` editor (about 1,900 lines inside
one method of the property panel), Agent Tools, the agent-context section, the
`@tool` editor and the annotation wizard's `@tool` and `@viewer` templates.
All of it is about to move out of the platform into wfpy-ide, so it is pinned
first, as it is.

`happy-dom` 21.0.4 (2026-10-20) becomes a dev dependency of diagram-client,
pinned exactly; it adds no advisory to `npm audit`. Only the files that ask
for it (`// @vitest-environment happy-dom`) run in it; the rest of the suite
stays on `node`.

`test/agent-ui/` renders the shipped `PropertyPanel` (its window chrome
skipped) and the shipped wizard handler, with the dispatcher and the VS Code
bridge as recorders, and pins:

- the whole panel for wfpy's analyst agent (arguments from the speculation-flow
  fixture), as an indented DOM dump;
- what showing an agent asks for: the server's skills and agent presets, the
  host's tool settings;
- what Save sends: the annotation text and the argument updates, for a
  default and an edited prompt, a picked skill and a picked preset; Remove;
- the skill and preset pickers the server's answers fill, and the message
  when none was found;
- Agent Tools: the host's settings shown, each change sent; absent without a
  run driver and without `@agent`;
- the agent context of a stateful agent (wfpy's message shape, Markdown,
  thinking, a long reply), absent without or with a broken history, replaced
  in place when the run updates it;
- the `@tool` editor and its Save;
- the header's Add @agent, Add @tool and Wizard buttons;
- the wizard's menus, `@tool`, `@viewer` open, diff and open-with (from the
  settings, and a custom editor remembered), and remove.

They characterize, they do not judge: what they pin is what ships today.
Changing one placeholder string in the agent editor fails two of them.

Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
- Agent Tools: the test changed the auth mode after turning the tools off,
  which disables the select, so it pinned a call no person can make. It now
  changes the auth mode while the tools are on, then turns them off, and
  checks the select is disabled.
- The `@tool` Save pins an operation that names one argument two ways
  (`inherit_stdio=True` in the text, `inheritStdio: "true"` in the updates);
  it is now marked as a known defect, asserted explicitly, so fixing it during
  the move reads as intended.
- The discovered-skill and preset caches are static; each test now starts
  with them empty (`resetAgentUi`), not just with a node name of its own.
- The discovery listener a test installs is removed when the test ends.
- The DOM dump keeps inline styles, so the switches' look and the dimmed
  select are pinned too.
- The header buttons are looked up in the Annotations section, not the first
  `.section-actions` on the page.
- The VS Code bridge recorder answers what the real one declares when a test
  does not say (`[]` editors, `true` appended).
- The panel's doc says what is skipped: the whole window wiring, including
  the link listener.
- The wizard tests clear the injected behaviour like the others; a redundant
  root argument is gone.

The recorder module must not import panel code (the bridge mock loads it and
panel code imports the bridge), which the cache reset briefly did: a cycle
the module loader waits on forever. Noted in harness.ts.

Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
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