Skip to content

Add the summary, errors, actions, detail and transcript queries - #622

Open
vishnuv688 wants to merge 3 commits into
feat/603-open-trace-locationsfrom
feat/604-trace-query-actions
Open

vishnuv688 wants to merge 3 commits into
feat/603-open-trace-locationsfrom
feat/604-trace-query-actions

Conversation

@vishnuv688

Copy link
Copy Markdown
Member

What & why

The queries an agent starts a failed run with (#493), named after @wdio/mcp's trace tools:

Query Returns
traceSummary(handle) Runner, browser or device, duration, counts, the first error and the test tree with each node's outcome; past half the budget the tree keeps its failed branches
traceErrors(handle) Failed top-level actions, steps that failed on their own (such as a failing hook), console errors and failed requests, by time, each tied to the action last started before it
traceActions(handle, { status, group, fromMs, toMs }) The top-level actions in order, with the rows each issued (a wait's polls, up to 20)
traceActionDetail(handle, callId) Args, result, error, expected and actual, call site and the source lines around it, within the budget
traceTranscript(handle) The zip's transcript.md, a page of lines at a time

The whole point is reading few tokens, so every result uses the package's own types, times are ms from the trace start, every string is cut, and every result is held within its character budget.

Closes #604

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Polish (an improvement to an existing feature)
  • Breaking change (existing behavior changes for users)
  • Documentation
  • Internal (build, CI, dependencies, tooling)

Packages touched

  • shared (types and contracts)
  • core (framework-agnostic capture/reporting)
  • elements (published element/snapshot API: @wdio/elements)
  • service (WebdriverIO adapter)
  • nightwatch-devtools (Nightwatch adapter)
  • selenium-devtools (Selenium adapter)
  • selenium-devtools-py (Selenium Python adapter)
  • backend (server)
  • app (UI)
  • script (page-injected runtime)
  • trace (Trace mode)

Also trace-query and otel, which the list does not name.

Capability matrix

Not applicable yet: no adapter behaviour and no user-facing tool. Whether the trace tools get a row is decided with the docs in #608.

Notes for reviewers

  • Stacked on Open a trace from a zip, an output folder or an https URL #620 (Add the trace query library package #619 and Share manifest-to-zip resolution and the action key through trace #618 below it). Review this PR's own commit.

  • Failure semantics come from shared's rules, never reimplemented: a poll that a passing wait retried past is never reported, a failed wait is listed once by the wait, with its failed polls reachable through traceActions and traceActionDetail, and firstError is the first failed top-level action, then the first failed step. When the trace failed and neither exists, firstError stays unset rather than naming an unrelated console error or request.

  • Moves into shared: the app's trace outcome rule (trace-outcome.ts; ESLint lets the app import only trace-reader from trace, so shared rather than trace), otel's failed-request rule (request-failure.ts, which Trace query: console and network #605 replaces with the Network tab's rule so there is one), and the row-level failure rule (rowFailure). The app's TraceSummary type is renamed TraceRunSummary to free the name for traceSummary's result. The app and otel changes are meant to change no behaviour; the reviews compared them line by line.

  • Reader changes: TraceActionGroupNode.error keeps a step's own error message, so a trace failed by a hook can say so. A step or command error whose message is not a string is refused at the reader (a command keeps its failure with a fixed message, so it never turns into a pass).

  • Budget rule: a cursor is offset/total/fingerprint, a 32-bit FNV-1a hash of the listing's scope (its filters), so a cursor handed to a different listing is refused even at equal length; a full page counts its { items, total, nextCursor } wrapper and separators against maxChars. A detail that overflows drops source lines first, then cuts its fields step by step.

  • Known limits:

    • The zip keeps an error's message but no stack, so the call site and source lines stand in for it.
    • The queries read the whole zip: narrowing a shared session or spec zip to the test openTrace selected is a follow-up.
  • Token measurements (serialized characters), against each fixture's transcript.md:

    Fixture transcript.md summary errors summary + errors + detail
    nightwatch-bdd 1198 961 1057 3166
    python-pytest 1934 to 2509 437 22 1522 to 1868
    selenium-mocha 941 to 950 1151 1005 to 1056 3139 to 3190
    wdio-mocha 417 to 544 373 to 556 22 to 287 1454 to 1705

    On these 2 to 5 action fixtures the queries cost a little more than the transcript, and give the test tree, expected and actual values and source lines it lacks. On a synthetic 300-action run with one failure, transcript.md is 11,153 characters against 2,496 for summary + errors + detail.

  • Tests run every query over all 8 committed adapter fixtures, plus zips written in the test with this checkout's writer (a passing wait with a retried poll, a timed-out wait, a failed assertion, console errors, failed requests) and fixtures edited to carry a failing hook and malformed errors.

  • Checks run. pnpm build, pnpm test (365 files, 5033 tests), pnpm lint (0 errors) and pnpm typecheck pass; leak grep clean on the trace-query and otel dists.

Screenshots / recordings

Not applicable: no UI change.

🤖 Generated with Claude Code

traceSummary, traceErrors, traceActions, traceActionDetail and
traceTranscript are the queries an agent starts a failure with, named
after @wdio/mcp's trace tools. Each returns the package's own result
types, times relative to the trace start, every string cut and every
result held within its character budget.

A failure is judged by shared's rules, so a poll that a passing wait
retried past is never reported and a failed wait is listed once, by
the wait. A trace failed by a step alone, such as a failing hook, gets
a step error: the reader now keeps a step's own error message, and
refuses a non-string message on a step or a command.

Cursors carry a fingerprint of their listing, so one handed to another
listing is refused even at equal length, and a full page counts its
own wrapper against the budget.

The trace outcome rule moves from the app into shared, so the player
and these queries judge a trace alike, as does the rule for a failed
request that otel used.

Closes #604
@vishnuv688 vishnuv688 self-assigned this Nov 27, 2026
@vercel

vercel Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devtools Ready Ready Preview Nov 27, 2026 7:04am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The changes appear safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The changes appear safe to merge.

Summary

Adds five queries for reading trace summaries, errors, actions, action details and transcripts.

  • Trace summaries and error lists show how a run went and what failed.
  • Action lists filter and page trace actions, with wait polls nested underneath.
  • Action details show values, errors, and source around a call site.
  • Transcript queries return the trace’s markdown a page of lines at a time.
  • Paged queries count their wrapper and filters when they limit results.
  • Shared code owns the outcome and failed-request rules used by trace readers and callers.

No new actionable issues were found in the changes since the previous review.

Reviews (3) · Last reviewed commit: "Refuse a query budget too small for any ..." · Reviewed by Greptile

Comment thread packages/trace-query/src/action-list.ts Resolved
- A traceActions row too large for a page sheds the rows it issued,
  counting them in omittedChildren, then cuts its own title and error,
  so a page always fits maxChars even when its one row is a wait with
  many polls.
- A summary still over its budget cuts the first error's text, then
  leaves the test tree out and counts it in omittedTests.
- traceActionDetail drops the call's own source line before it cuts
  any argument, result or error value.
Below a thousand characters a summary's own fields, or one error with
its message, cannot fit, so a result could still overrun maxChars. The
queries now refuse a budget below MIN_QUERY_CHARS, and from there up a
test holds every query's whole result within its budget on every
adapter fixture and on a trace of oversized values. The tests that
forced paging and cutting with smaller budgets use larger runs.
@vishnuv688

Copy link
Copy Markdown
Member Author

Greptile's remaining concern, that the size limits must hold, is addressed in f52155a. A query now refuses a maxChars below 1000 (MIN_QUERY_CHARS): below that a summary's own fields, or one error with its message and URL, cannot fit, so no cutting could hold the limit. From 1000 up, a test checks every query's whole serialized result (summary, errors, actions, detail, transcript) at budgets from 1000 to 20000 on all 8 adapter fixtures and on a trace of oversized values (5000-character titles, arguments, selectors and errors, a wait with 25 polls, 200 source lines of 500 characters), and none exceeds its budget.

This branch has not been deployed

No deployments
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