Skip to content

feat(trace): report requests still pending when an action ran - #42173

Open
John Hill (unlikelyzero) wants to merge 1 commit into
microsoft:mainfrom
unlikelyzero:trace-cli-pending-requests
Open

feat(trace): report requests still pending when an action ran#42173
John Hill (unlikelyzero) wants to merge 1 commit into
microsoft:mainfrom
unlikelyzero:trace-cli-pending-requests

Conversation

@unlikelyzero

Copy link
Copy Markdown
Contributor

Summary

  • trace actions --pending lists actions that started (or finished, with --phase end) while requests were still outstanding
  • trace requests --pending-at <action-id> [--phase start|end] lists which requests were pending at that point, and how long each overran
  • Aborted requests are excluded from pending results

Fixes #42172

Actions that run while requests are outstanding are the usual cause of flaky
clicks and stale assertions, but the trace CLI could not surface them:
`trace requests` prints durations without start times, so the overlap between
a request and an action was not derivable from its output.

Correlate each action's startTime with the HAR entries' _monotonicTime, both
of which come from the same monotonicTime() source:

  trace requests --pending-at <action-id> [--phase start|end]
  trace actions --pending [--phase start|end]

`--phase start` answers "did we act too early", `--phase end` answers "did we
move on too early". At the end phase an `Origin` column separates requests
that predated the action ('before' - the page never settled) from ones the
action itself triggered and did not wait for ('during'), which have different
fixes.

A failed or aborted request keeps `harEntry.time` at its -1 default, so its
end is unknown; such requests are counted separately rather than reported as
pending, which would otherwise flag every `route.abort()`ed request against
every later action. Actions that never finished, and configuration actions
that carry no ordinal, are likewise excluded and reported as counts.
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.

trace CLI: surface requests still pending when an action ran

2 participants