Commit Graph

30 Commits

Author SHA1 Message Date
Alex Langenfeld fe2fd8c457 Classify Workflow stream failures (#3850)
## Summary & Motivation

Stream infrastructure failures (HTTP/2 session wedges, transport timeouts, non-2xx stream responses) surfaced as plain `Error`, so terminal classification attributed them to customer code as `USER_ERROR`. They now carry a catchable `StreamError` with a `STREAM_ERROR` run error code, attributed to the SDK and retried when transport-level or 5xx.

The v4 events response body is wrapped so a post-header stream failure is classified and reported to the dispatcher recycler — a response header arriving is not yet a successful streamed request.

## Test Plan

Unit tests added across classification, serialization round-trip, the streamer, and the v4 transport; 331 `@workflow/core` and 123 `@workflow/world-vercel` focused tests pass.
2026-09-03 16:31:18 -05:00
Mitul Shah 695a1b76d0 fix(web-shared): describe map-like iterables via entries() (#3806)
* fix(web-shared): expand Web API iterables

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

* fix(web-shared): inspect generic iterables

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

* fix(web-shared): compare iterator identity safely

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

* test(web-shared): cover inspector iterable entries

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

* fix(web-shared): describe map-like iterables via entries()

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

---------

Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-08-31 11:34:29 -04:00
Karthik Kalyan 5a59bb82e8 Add disabled state to decrypt controls (#3715) 2026-08-21 14:35:55 -07:00
Karthik Kalyan 4bd533de17 fix(web-shared): shorten workflow-prefixed step names (#3684)
* fix(web-shared): shorten workflow-prefixed step names

* fix(web-shared): shorten event list step names
2026-08-19 17:07:50 -07:00
Mitul Shah 6ca2f1b3b7 fix(web-shared): optimize MiddleTruncate resizing (#3630)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-08-18 15:39:12 -07:00
Mitul Shah 14b52ac04b [1/4] Replace shared observability component styles with Tailwind (#3295)
* Replace hard-coded UI styles with Tailwind

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

* Update Tailwind migration verification

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

* Remove documentation changes from style migration

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

* Split trace, graph, and workbench style changes

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

---------

Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mitul-s <19615826+mitul-s@users.noreply.github.com>
2026-08-12 19:13:39 +00:00
Mitul Shah d06b55e641 Rename new-trace-viewer to trace-viewer (#3298)
* Rename new-trace-viewer to trace-viewer.

Move the directory, rename NewTraceViewer to TraceViewer across web-shared and web, and update the build script and README.

Signed-off-by: mitul-s <mitulxshah@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix TraceViewer import ordering

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

---------

Signed-off-by: mitul-s <mitulxshah@gmail.com>
Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 16:34:48 -04:00
Mitul Shah 951695ba2a Remove the legacy trace viewer in favor of NewTraceViewer. (#3296)
Drop RunTraceView and WorkflowTraceViewer, move shared Span/Trace types into lib/trace-types, and keep timing helpers under the new viewer.

Signed-off-by: mitul-s <mitulxshah@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 16:34:48 -04:00
Alex Langenfeld a799025af9 Surface a Request ID in the run sidebar attribute panel (#3293)
## Summary & Motivation

One warm compute instance serves many invocations, so the Compute Instance ID already in this panel can't distinguish steps that ran inline within a single flow-function invocation — sibling steps sharing a Request ID did. It's also the value Vercel Logs indexes by, and this panel's View Logs button is where a reader takes it next.

The key is `vercelId`, not `requestId`: that's the name world-vercel stores the SDK's request id under crossing the wire, and AnalyticsEvent's sibling `requestId` field is declared but never written. Nothing in this repository populates `vercelId` on the object the panel receives yet — only AnalyticsEvent carries it, and grouping steps by invocation needs a step-level aggregation in workflow-server first — so the row ships as forward-compatible plumbing in the slot next to Compute Instance ID.

The second commit is an independent fix: `sortByAttributeOrder` guarded `indexOf` with `|| 0`, but a miss returns -1, which is truthy, so any key absent from `attributeOrder` sorted ahead of every listed key. It can be dropped on its own.

## Test Plan

Unit tests added; the two ordering assertions fail against the unfixed comparator. The new row could not be verified by hand — no local code path populates it.
2026-08-03 13:05:09 -05:00
Nathan Rajlich 32ac8e73fd Fix Biome lint violations and add Biome CI check (#3222)
* Fix Biome lint violations and add Biome CI check

Biome was not configured to respect .gitignore, so ~92% of the 13,355
reported diagnostics came from gitignored build artifacts. Enable VCS
integration (useIgnoreFile), apply safe auto-fixes across the repo, fix
the remaining mechanical errors by hand, downgrade judgment-call a11y /
dangerouslySetInnerHTML rules to warnings, and add a 'biome ci' job to
the Lint workflow so violations block PRs going forward.

* Use an empty changeset (no behavior change, no release needed)
2026-07-30 22:32:12 +00:00
Mitul Shah 8a766884cf change timing markers to be precise on the timeline (#2775)
* doen

* Fix: Old test file `test/format-duration-precise.test.ts` still asserts two-decimal output ("45.20s", "1m 0.00s") that no longer matches the trimmed-zero output of `formatDurationPrecise`, so `pnpm test`/CI fails.

This commit fixes the issue reported at packages/web-shared/test/format-duration-precise.test.ts:15

## Bug

The PR changed `formatDurationPrecise` (in `packages/web-shared/src/lib/utils.ts`) to trim trailing zeros by wrapping the fractional value in `Number(x.toFixed(fractionDigits))`:

```ts
if (normalizedMs < MS_IN_MINUTE) {
  return `${Number((normalizedMs / MS_IN_SECOND).toFixed(fractionDigits))}s`;
}
...
parts.push(`${Number(seconds.toFixed(fractionDigits))}s`);
```

`Number("45.20")` → `45.2`, `Number("0.00")` → `0`, so whole/half seconds now render without padding.

A new test file `packages/web-shared/src/lib/utils.test.ts` reflects this behavior, but the pre-existing `packages/web-shared/test/format-duration-precise.test.ts` was left untouched and still asserts the **old** padded output.

## Concrete trigger

Reproduced the actual function output (integer decomposition + trimmed zeros):

| Input | Old assertion | New actual output |
|-------|---------------|-------------------|
| `45200` | `45.20s` | `45.2s` |
| `999.6` | `1.00s` | `1s` |
| `999.5` | `1.00s` | `1s` |
| `59999` | `1m 0.00s` | `1m 0s` |
| `59995` | `1m 0.00s` | `1m 0s` |
| `119999` | `2m 0.00s` | `2m 0s` |
| `3659999` | `1h 1m 0.00s` | `1h 1m 0s` |
| `86459999` | `1d 1m 0.00s` | `1d 1m 0s` |

The root `vitest.config.ts` uses default include globs, so `test/*.test.ts` runs and these assertions fail, breaking CI. (I couldn't run vitest directly in the sandbox because dev deps weren't installed / `vitest/config` unresolved, so I reproduced the exact function logic in a standalone Node script to confirm the outputs.)

## Fix

Updated the stale assertions in `test/format-duration-precise.test.ts` to the trimmed-zero outputs, and adjusted the file-level doc comment (which referenced `"1m 0.00s"` / `"60.00s"`) to describe the current behavior.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: mitul-s <mitulxshah@gmail.com>

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
2026-07-06 18:27:10 -04:00
Karthik Kalyan 89f4726b73 Fix compressed workflow error display (#2680)
* Fix compressed workflow data display

* Add OSS web no-key hydration regression

* Scope compression normalization to read paths; tidy hydration

Address review feedback on the compressed-data fix:

- world-vercel: keep gzip/zstd decompression on the o11y/display read
  paths (getStep/getRun/getEvent/getWorkflowRunEvents/getHook) but not on
  the runtime event-append path (world.events.create, createStep,
  updateStep). That path is runtime-only and re-hydrates every payload via
  the decompress-aware helpers, so decompressing at the adapter was
  redundant work on the TTFB-sensitive run_started/inline-delta path and
  skewed the runtime's deserialize compression telemetry to `codec: none`.
  deserializeStep is now shape-only; normalizeStepData runs in the read
  filter. Adds a regression test pinning the write-path pass-through.
- serialized-data: drop dead `errorRef`/`metadataRef` normalization (refs
  are descriptor objects, never compressed byte payloads).
- web: in the wait-entity path, filter events by correlationId before
  hydrating so an encryption key doesn't decrypt the whole event page.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Peter Wielander <peter.wielander@vercel.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 16:50:43 -07:00
Karthik Kalyan 148d4743e5 Use and show event occurredAt (#2613) 2026-06-26 20:00:30 -07:00
Mitul Shah 8393716687 Fix trace detail panel Input/Output flicker (selection-driven state machine) (#2637)
* Add selection-driven span-detail primitives

Extract the run/step/hook/sleep fetch+hydrate core out of useWorkflowResourceData
into a plain async fetchSpanDetailResource (no React state), and add a
selection-driven state machine in web-shared:

- deriveSpanDetailView / resourceNeedsFetchedDetail: pure view-model deriver
  whose status (idle/loading/ready/error) is a function of (selection, fetched
  detail), so it can never lag the selection.
- useSelectedSpanDetail: fetches a selected span's detail directly with a
  request-token to drop stale/out-of-order responses.

* Drive trace detail panel from the span-detail state machine

Replace the cross-package selection round-trip (EntityDetailPanel useEffect ->
onSpanSelect -> page spanSelection state -> useWorkflowResourceData -> context)
with a single injected fetchSpanDetail capability:

- EntityDetailPanel consumes useSelectedSpanDetail; its loading state now stays
  in phase with the selected span, so Input/Output no longer vanish and pop back
  in while navigating.
- SidebarDataContext drops spanDetailData/Loading/Error + onSpanSelect for a
  single fetchSpanDetail; RunDetailView injects it and drops the duplicate
  spanSelection state.
- WorkflowTraceViewer / RunTraceView take fetchSpanDetail too.

* Test span-detail view-model transitions; add changeset

Cover deriveSpanDetailView (idle/loading/ready/error, stale-detail rejection,
hooks ready inline) and resourceNeedsFetchedDetail.

* Trim redundant/narrative comments in span-detail state machine

Comment-only cleanup: drop PR-narration and cross-file duplication from the
deriveSpanDetailView / useSelectedSpanDetail / EntityDetailPanel / fetchSpanDetail
doc comments, keeping the non-obvious intent (request-token, error scoping,
decrypt closure).

* delete pointless coments

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-06-26 16:42:47 -04:00
Karthik Kalyan b9a10d87e1 Thread occurredAt into web-shared entities (#2608) 2026-06-23 17:47:40 -07:00
Mitul Shah 6512d38df5 [web-shared] reskin json viewer (no duplicates, better colours and navigation) (#2434)
* fix(web-shared): stop data inspector duplicating expanded objects

Expanded objects/arrays now render bracket delimiters ({ … } / [ … ])
instead of repeating the inline preview alongside the child tree.

Co-authored-by: Cursor <cursoragent@cursor.com>

* nice

* fix: sync lockfile after dropping react-inspector

The react-inspector removal landed in package.json but the lockfile was
reverted during cleanup, breaking frozen-lockfile installs in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shared): keep data inspector colors theme-aware

Drop the dark-mode color overrides (and the data-theme/useDarkMode
wiring) and rely on the theme-aware --ds-* tokens, matching front:
strings stay green in both light and dark instead of turning blue.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(web-shared): add data inspector tests; tidy comments

Cover collapseRefs ref/typed-array/Map/Set handling and the rendered
tree (keys, value colors, brackets, commas, collapse/expand, empties,
dates, class/Map/Set prefixes) via jsdom + testing-library.

Co-authored-by: Cursor <cursoragent@cursor.com>

* revert(web-shared): drop data inspector tests

Remove the test suite and its jsdom/@testing-library devDependencies to
avoid adding new packages. Keeps the data inspector code unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor(web-shared): extract data inspector styles to a sibling module

Move the class-name map and CSS string out of the component into
data-inspector.styles.ts for readability. Still injected via the
hoistable <style>; no behavior or dependency change.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shared): restore ARIA tree semantics for the data inspector

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shared): render RegExp values as /source/flags

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(web-shared): add unit tests for CopyableDataBlock JSON viewer (#2584)

Export serializeForClipboard and cover its clipboard formatting (strings, primitives, pretty-printed JSON, circular/BigInt fallbacks) plus CopyableDataBlock/EncryptedDataBlock rendering.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 14:54:15 -04:00
Pranay Prakash 5f0b845211 RFC: compress serialized payload refs — zstd (gzip fallback), specVersion 5 (#2394)
* feat(core,world): gzip-compress serialized payloads behind specVersion 5

Add a composable 'gzip' format prefix layer to the serialization
pipeline (compress before encrypt: encr(gzip(devl))), cutting stored
payload bytes by ~70-87% on real-world-style workloads. Compression is
gated on run specVersion 5 (new SPEC_VERSION_SUPPORTS_COMPRESSION) and
on target-deployment capabilities for cross-deployment writes; payloads
under 1KB or that don't compress meaningfully are stored unchanged.
Reads dispatch on the format prefix so both compressed and uncompressed
data are always readable. WORKFLOW_DISABLE_COMPRESSION=1 disables
writes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(core): add CPU/perf compression benchmark + shared workloads

Split the compression benchmark into reproducible size and CPU scripts
sharing deterministic workloads (lib/workloads.mjs). The CPU benchmark
measures serialize/deserialize overhead per payload, total CPU across
thousands of events, and compares gzip levels/brotli/deflate. Documents
how to run the size, CPU, and end-to-end (bench.bench.ts) benchmarks
against local and Vercel in scripts/README.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(world-vercel): advertise specVersion 5 to enable compression on Vercel

Now that workflow-server declares spec-5 support (vercel/workflow-server#520),
bump the Vercel world's advertised specVersion from 4 to 5 so new Vercel runs
are stamped spec 5 and become eligible for gzip payload compression. Payloads
stay opaque to the server (compression is client-side); spec 5 is a superset of
spec 4, so initial run attributes still work.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(core): emit OTel span attributes for compression impact

Track gzip payload compression on both the serialize (write) and
deserialize (read) paths via span attributes:
workflow.serialization.{operation,compressed,uncompressed_bytes,
stored_bytes,compression_ratio}. Sizes are measured at the compression
boundary (pre-encryption), so they reflect compression's effect rather
than the at-rest size.

The compression codec stays pure — compress/decompress optionally
populate a CompressionStats sink, threaded through CodecOptions to the
mode serializers and read by the dehydrate/hydrate wrappers, which set
attributes on the active span. Telemetry failures are swallowed so they
can never break the serialize/deserialize data path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(core,web-shared): prefer zstd compression codec (gzip fallback)

Switch the payload compression codec to zstd, which benchmarks 3–7×
faster than gzip at an equal-or-better ratio on representative workloads
(compression runs at every step boundary, so the write CPU is a per-step
tax). zstd uses node:zlib (>= 22.15); gzip via the portable
CompressionStream remains the fallback when zstd is unavailable, and
WORKFLOW_COMPRESSION_CODEC=gzip forces it. Reads dispatch on the format
prefix, so 'zstd' and 'gzip' payloads are both always decodable.

zstd is Node-only (Web CompressionStream has no zstd), so the browser
o11y read path registers a WASM-backed decoder (@tootallnate/zstd-wasm)
via a new registerZstdDecoder hook; node:zlib handles Node-side reads
(runtime replay, CLI, server o11y). A new workflow.serialization.codec
span attribute reports which codec applied. gzip and zstd read support
co-ship, so the existing specVersion-5 capability gate is unchanged.

Verified end-to-end: spec-5 runs store zstd-prefixed payloads on disk
and replay/complete correctly; the WASM decoder round-trips node:zlib
zstd output. Benchmarks updated to compare zstd vs gzip.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-06-16 23:27:47 +00:00
Mitul Shah eb2b8c988d [web-shared] Show precise durations in the new trace viewer (#2335)
* [web-shared] Show precise durations in the new trace viewer

The events list and timeline bar labels now render two-decimal seconds for
durations over 1s instead of rounding to whole seconds.

Co-authored-by: Cursor <cursoragent@cursor.com>

* [web-shared] Fix duration rounding at unit boundaries

formatDurationPrecise bucketed durations on the raw ms value but only
rounded at display time, so inputs just below a unit boundary carried
into the next unit without re-bucketing (e.g. 59999ms -> "60.00s").

Round to centisecond precision FIRST, then decompose in integer
centisecond space so the seconds component stays in [0.00, 59.99] and
carries re-bucket into the next unit (59999ms -> "1m 0.00s").

Co-authored-by: Cursor <cursoragent@cursor.com>

* [web-shared] Simplify precise duration formatting

Reuse the existing MS_IN_* constants instead of the centisecond decomposition; behavior is unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 20:57:29 +00:00
Mitul Shah 3e49c6ebf4 Fix flickering on the detail panel when navigating the trace viewer (#2325)
* ok

* Update events-list.tsx

* Apply suggestion from @VaguelySerious

Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Mitul Shah <mitulxshah@gmail.com>

---------

Signed-off-by: Mitul Shah <mitulxshah@gmail.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-06-10 12:43:36 -04:00
Karthik Kalyan 63f1a9906d [web-shared] Fix message-only error rendering (#2251)
* Fix message-only error rendering

* Handle non-string error stacks
2026-06-04 15:39:47 -07:00
Karthik Kalyan 5bf2c167a5 Add serializable reviver compatibility check (#2250) 2026-06-04 12:50:32 -07:00
Karthik Kalyan 24a96d8301 Fix HookConflictError web hydration (#2249) 2026-06-04 11:47:07 -07:00
Karthik Kalyan ad5c068d7f [web-shared][web] Fix events tab search (#2107)
* Add server-backed exact ID search to the Events tab.

Replace client-side substring filtering with API lookups for full correlation and event IDs so searches work beyond the first loaded page.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix exact ID search dimming and support wrun_ correlation IDs.

Disable group dimming for server search results and accept run IDs in the exact ID parser so run-level correlation search works.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix dimmed row when searching by event ID for run-level events.

Map selectedGroupKey to __run__ for run-level search results so the matched row is treated as related instead of dimmed.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Remove run ID search from Events tab exact ID lookup.

Workflow-server only accepts step, wait, and hook correlation IDs — not wrun_. Update the search placeholder and validation toast accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Harden exact ID search UX and correlation fetch limits.

Normalize lowercase ULIDs, scope Enter toasts to ID-like input, abort stale searches, disable search when unavailable, expand parser tests, and cap correlation pagination in workflow web.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix search clear race and surface truncated correlation results.

Guard successful exact-ID search against aborted requests, invalidate in-flight work when the input clears, and return truncation metadata from correlation pagination.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Differentiate exact ID search errors from not-found results.

Return a discriminated union from onExactIdSearch and show search errors in the Events tab instead of mislabeling them as missing IDs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Apply suggestion from @VaguelySerious

Signed-off-by: Peter Wielander <mittgfu@gmail.com>

---------

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-05-29 11:00:53 -07:00
Mitul Shah b33c5ef120 Better search handling on the trace viewer (#2144)
* Update copyable-data-block.tsx

* Update event-list.tsx

* Create clever-spans-search.md

* Update index.ts

* Update detail-panel.tsx

* Create icon-button.tsx

* nice

* nice

* cleanup
2026-05-29 16:20:23 +00:00
Peter Wielander a490f584e0 [web-shared] Fix "Queued for" duration for retried steps (#2087) 2026-05-22 18:51:59 +02:00
Nathan Rajlich c80b747af8 fix(web-shared): hydrate FatalError/RetryableError and Error subclasses in o11y (#1942)
* fix(web-shared): hydrate FatalError/RetryableError and Error subclasses in o11y

The web o11y reviver set was missing entries for the recently-added
serialization types (FatalError, RetryableError, the built-in Error
subclasses, AggregateError, DOMException), causing devalue.unflatten to
throw "Unknown type X" and the UI to surface "Failed to load resource
details" whenever a step or run failed with one of these error types.

Adds the missing revivers to getWebRevivers() and a regression test that
round-trips real values through the runtime's dehydrateStepError back
through the web reviver set.

* fix(web-shared): address review feedback on error revivers

- Pass `cause` through ErrorOptions to the subclass constructor instead of
  assigning afterwards, matching `getCommonRevivers` in core. This gives
  the resulting `cause` property the same engine-set, non-enumerable
  semantics as a freshly thrown Error in the consumer realm.
- Guard `RetryableError.retryAfter` against missing/undefined values from
  older runtime payloads — without it, `new Date(undefined)` produces an
  Invalid Date rather than the property being absent. Add a defensive
  test that drives the reviver directly with a payload missing the field.
2026-05-05 23:01:50 +00:00
Mitul Shah aeb495bccc [trace viewer] Polish items (#1872)
* wip

* context

* cleanup

* wip

* wip

* Update trace-viewer.tsx

* adjust hovers

* time marker

* tweak

* Update event-list.tsx

* header

* Update utils.ts

* search

* Update timeline.tsx

* ship

* Update timeline.tsx

* Update event-list.tsx

* Create icons.tsx

* Update trace-viewer.tsx

* Update utils.ts

* new trace viewrr

* Update workflow-trace-view.tsx

* Fix: Runtime crash when `trace` is `undefined`: `NewTraceViewerComponent` receives `undefined` (cast as `Trace`) and immediately accesses `trace.spans`, causing "Cannot read properties of undefined".


This commit fixes the issue reported at packages/web-shared/src/components/trace-viewer-new.tsx:28

**Bug Analysis:**

In `trace-viewer-new.tsx`, the `buildTrace` function returns `undefined` when `!run?.runId`. The result is stored in `trace` which has type `TraceWithMeta | undefined`. However, on line 28, `trace` is passed directly to `NewTraceViewerComponent` with a type assertion `trace as Trace`, which silences the TypeScript error but does not prevent the runtime crash.

Inside `NewTraceViewerComponent` (in `new-trace-viewer/trace-viewer.tsx` line 98), the component immediately accesses `trace.spans`:

```tsx
<ActiveSpanProvider spans={trace.spans}>
```

When `trace` is `undefined`, this produces: `TypeError: Cannot read properties of undefined (reading 'spans')`.

This happens whenever the component renders before `run.runId` is available — a normal scenario during initial loading.

The old `WorkflowTraceViewer` component (in `workflow-trace-view.tsx` line 953) correctly handles this with a `if (!trace)` guard that renders a loading skeleton. The new component lacks this guard.

**Fix:**

Added a null guard in `trace-viewer-new.tsx` that checks `if (!trace)` before rendering `NewTraceViewerComponent`. When trace is undefined, a simple loading placeholder is rendered instead. This prevents the crash and follows the same pattern as the existing `WorkflowTraceViewer`. The `as Trace` cast on line 28 is now safe because `trace` is guaranteed to be defined after the guard.


Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: mitul-s <mitulxshah@gmail.com>

* fixed edge view

* Update timeline.tsx

* ship it

* cleanup

* Update trace-viewer.tsx

* wip

* wip

* Add detail pane to the new trace viewer + cleanup  (#1714)

* detail pane

* cleanup

* cleanup

* cleanu

* fix

* Update workflow-trace-view.tsx

* cleanup

* Update entity-detail-panel.tsx

* move sidebar provider into export

* dead code

* cleaning up more

* remove decorative indenting & output loader

* fix bars

* Update inspector-theme.ts

* cleanups

* Update copyable-data-block.tsx

* cleanup

* chonky

* Update timeline.tsx

* bug fxi

* marker lines

* wip

* changes

* Update event-list.tsx

* rounded

* Update event-list.tsx

* middle truncate component

* cleanup

* height updatres

* colour fixes

---------

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-04-30 16:50:24 -04:00
Karthik Kalyan 9ea125427f Decode UTF-8 stream chunks (#1852)
* Decode typed array stream chunks

* Render decoded stream bytes with raw view

* Render decoded bytes in data inspector

* Use generic byte inspector for streams

* review feedback: narrow stream-display exports, fix tab a11y, add collapseRefs tests

- Remove unused formatStreamChunkForDisplay/sanitizeStreamChunkForDisplay
  exports; keep only the formatArrayBufferViewForDisplay path actually used
  by DataInspector.
- Replace broken role=tablist/role=tab on the Decoded/Bytes switcher
  with aria-pressed toggle-button semantics.
- Export collapseRefs/isBytesDisplay and add regression tests covering
  typed-array detection (top-level, nested in object/array/Map/Set,
  DataView exclusion).

* Replace eval with JSON.parse in serialization revive helper (#1848)

* Replace eval with JSON.parse in serialization revive helper

devalue.stringify() always produces valid JSON — special values
(undefined, NaN, Infinity, -0) are encoded as negative integer
sentinels. JSON.parse yields the same flattened array form that
unflatten() expects, without the eval anti-pattern (VULN-918).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Drop redundant workflow package from changeset

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

* Add e2e test for UTF-8 parseable stream chunks

Emits Uint8Array chunks containing multi-byte UTF-8 (Latin Extended,
CJK, emoji, RTL Arabic) plus a UTF-8 encoded JSON document, and
asserts each chunk round-trips through TextDecoder({ fatal: true }).
Exercises the same decode path the web inspector relies on for
typed-array stream values.

Made-with: Cursor

---------

Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 09:22:05 -07:00
Karthik Kalyan 29eb8bbea8 [web-shared] Fix trace viewer step spans for v1 events (#1406)
* fix trace viewer for v1 events

* add changeset

* add a test

* add a test for web-shared

* add lock file

* update logic to look for run_created event first

* handle step created

* add changeset
2026-03-16 14:24:08 -07:00
Karthik Kalyan 0e2eb5c775 [web-shared] Fix trace viewer run span segments for v1 events (#1404)
* fix trace viewer for v1 events

* add changeset

* add a test

* add a test for web-shared

* add lock file

* update logic to look for run_created event first
2026-03-16 20:20:05 +00:00