Files
deepseek-harness/apps/web/tests
涂轶翔 8b04316918 feat(ui-tool): fold run_code subcalls (#8834)
* feat(ui-tool): fold program sub-call lists by default

* feat(ui-tool): show a program call as one row over its source and sub-calls

A run_code or cua_run_code call renders as one collapsed row with the
program's description and its sub-call count. Opening it lists the PTC
source code row and then the sub-calls. A failed call shows its first
error line in place of the count, and an interrupted call shows that it
stopped.

A call with more than 32 sub-calls lists the first 10 and the last 10
around a row that states how many are omitted. The three numbers are
constants in ToolCallTree.

The row replaces the separate collapsed count row. A collapsed program
call mounts neither its own toolview nor its sub-calls.

* feat(ui-tool): title the program source row "Source code"

The row also heads cua_run_code programs in Standard mode, where "PTC"
names a different agent mode.

* test(web): refresh the scoped PTC round goldens for the program call row

The persistent-in-memory variant of the PTC round renders the same
program call row as the per-call variant.

* fix(ui-tool): keep the program call state whole and move the error line to the source row

A failed program call shows "Failed" after its description, the way an
interrupted call shows "Stopped". The count and both states never
shrink, so a narrow row truncates only the description. The error line
could shrink together with the description, which clipped "Stopped"
beside a long description and hid a short description beside a long
error line.

The source code row shows the first error line without its "Error: "
lead.

* feat(ui-tool): mark the program call row with a hub icon

Add the hub-outline product glyph, a central node wired to three
satellite nodes, and use it for the program call header instead of
layers-outline, which keeps its other uses.

* feat(ui-tool): reveal omitted program sub-calls 50 per side on click

Lower the sub-call list threshold to 24. The omission row becomes a
"Show more (N hidden)" button that lists up to 50 more sub-calls on each
side per activation; reopening the program call returns to the first and
last 10.

* docs(ui-tool): describe the sub-call list constants as the initial window

* feat(ui-tool): list the first 20 sub-calls and double the list per show-more click

A program call with more than 24 sub-calls now lists its first 20 followed
by the "Show more" row; each click doubles the listed count (20, 40,
80, ...) until every sub-call is listed. Reopening the program call returns
to the first 20.

* fix(ui-tool): show a failed program call's error line with its "Error: " lead

The source code row of a failed program call shows the result's first
line unchanged, like every other failed tool row. The "Error: " lead is
the tool pipeline's model-facing failure text; removing it in the card
with a pattern match edited recorded text for one tool variant only.

* feat(ui-tool): render a program call's own row through a dedicated source row

`run_code` and `cua_run_code` register `SourceCodeRow` in
`tool.call.toolview`. It shows the program and its output, with the
first error line on failure, and no description, because the program
call's header row shows it. `GenericToolCard` keeps no program-call
branch. Image labels in flattened result text move to
`formatResultImage`, which both rows use.

The two registrations add two occupant lines to the
`tool.call.toolview` slot report, so its catalog budget rises to 136.
2026-11-27 19:21:49 +08:00
..

apps/web browser e2e

English | 中文

These tests boot the real web composition in-process and drive it with real browsers over real HTTP. Chromium runs the full lane; the model and reasoning picker scenario also runs in WebKit to cover native mouse focus behavior. Session replay recovery also runs in WebKit, sharing the fresh-round-trip recording and expected output without rewriting them. It covers active-stream reload, completed-turn reload, and reopening a Session. The lane's mechanics — modes, fixtures, goldens, and the deliberate composition divergences from dsh web — are documented in scaffold.ts and the browser e2e Agent Note.

After installing workspace dependencies, install the browsers and their system dependencies from the repository root:

pnpm --filter @deepseek-ai/dsh-web-frontend exec playwright install --with-deps chromium webkit

On Linux, --with-deps installs dependencies through the system package manager. The persistent CI VM must provide these dependencies through image maintenance; CI installs only the browser binaries, as required by the failover runbook.

Ordinary scenarios begin with no registered Workspace or Session and a durable marker recording a removed default Workspace, so explicit folder-selection scenarios retain control of their cwd. launchWebScaffold({ firstUse: true }) leaves initialization eligible for startup scenarios.

Same-day message goldens use the shared WEB_FIXTURE_TIME: seeded transcripts pass it as createdAt and pin the browser calendar with pinBrowserClock; scenarios that submit live messages also use pinHostClock and restore it after teardown. These clocks advance with real elapsed time while keeping native timers intact, so midnight does not change a scenario's date labels.

Every scenario requires the whole client composition to activate. The product boot only warns about inactive entries outside its required list, but the watchConsole tripwire, the real-host smoke, and the assembled jsdom boot treat a web boot: warning as a failure. No scenario option relaxes this: an inactive plugin in a product composition is a defect to fix.

Completion observations

State-sensitive cases use Workspace, admission, attachment, and model-stream barriers to separate visible intermediate states from completed operations. Model-picker persistence assertions wait for the saved default, independently of menu closure. Details close waits for frame transitions; archive verification assigns an explicit title to the seeded Session and follows that identity across reload. The CI test reliability workflow owns these synchronization rules.

Idle-submission handoff waits up to the scaffold's 30-second turn-completion budget for Host frames and browser placement. Vitest owns scaffold teardown so a replay-consumption error does not replace the failed scenario assertion.

Plugin-manager and HMR lifecycle switches wait up to PLUGIN_TOGGLE_SETTLE_MS (10 seconds) for the Host's profile write and the store's follow-up inventory read, the two steps that republish aria-checked; that constant's JSDoc records the measured chain.

Explicit scrolling uses scrollIntoView from support.ts: it resolves the locator again when its old element detaches and checks connection in the same browser task as native scrolling. Scenarios retain their visibility and geometry assertions after scrolling.

Question-composer resize assertions wait for overflow, the clipping mask, and toggle visibility to agree after CSS scroll timelines update.

The snapshot after closing a sidebar pane moves the pointer outside the controls and waits for hover tooltips to close before capture. Keyboard focus remains on the pane.

The same-origin terminal case waits for the UI-triggered Host close operation before checking process termination. It also checks the first window's process, saved bindings and layout after reload.

These are Host-face tests

They type-check in the root tsconfig.host.json, not in the Client aggregate, because they read Host services directly: ctx.connection, the Host SessionStore, and ctx.sessionProjectionCache. Driving a browser at runtime does not make a file part of the Client program — the two faces merge Cordis Context under the same keys with different services, so one program cannot see both. Moving these files into the Client aggregate makes every Host-service access fail to compile.

A new scenario joins both program lists in the same change: its file in the root tsconfig.host.json include and in the Client aggregate's apps/web/tsconfig.json exclude. That project includes all of tests, so a file missing from the exclude compiles as Client code, and the Client compiler gate of pnpm run typecheck keeps failing with Host-service errors until it is listed.

Do not import @deepseek-ai/dsh-client-* here

Importing a Client package — a value or a type — pulls its TypeScript project and referenced projects into the Host build graph. Generated Remote declarations are available before package compilation, but this does not make the Host and Client Cordis Context declarations compatible. Keep these tests on the Host face and use only the explicit built-client harness exception below.

When a scenario needs a Client-owned constant or pure function, mirror it here instead, next to the commented-out import that names the source module. A drift then surfaces as a missed selector or a stale mirrored value — a loud failure, never a silent pass. scaffold.ts follows this rule for the welcome-notice namespace, acknowledgement field, version, and asserted Chinese copy.

The built-client harness is the exception. assembled-boot.ts imports AppWebEntry, the boot-manifest type, and RemoteMock; assembled-remote.ts imports the Client test runtime's default responses and RemoteMock. These packages are explicit project references for booting the real shell against a test-owned carrier. The chat scenarios mirror conversationContextKey in support.ts instead of importing its Client owner.

Nothing mechanically enforces this rule; keep it in review.