Skip to content

Allow product-specific step span attributes - #3825

Merged
alangenfeld merged 1 commit into
mainfrom
alangenfeld/cache-sidebar-step-detail
Aug 27, 2026
Merged

alangenfeld merged 1 commit into
mainfrom
alangenfeld/cache-sidebar-step-detail

Conversation

@alangenfeld

@alangenfeld alangenfeld commented Aug 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary & Motivation

Products such as the Vercel dashboard enrich canonical workflow events with backend-specific metadata. buildTrace now takes an optional getStepAttributes callback so those attributes reach step span details without @workflow/web-shared knowing the fields; canonical event-derived fields win on key collision.

Test Plan

Unit test added.

@vercel

vercel Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, v0 Aug 26, 2026 9:23pm
example-nextjs-workflow-webpack Ready Ready Preview, v0 Aug 26, 2026 9:23pm
example-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workbench-astro-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workbench-express-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workbench-fastify-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workbench-hono-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workbench-nestjs-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workbench-nitro-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workbench-nuxt-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workbench-python-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workbench-sveltekit-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workbench-tanstack-start-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workbench-vite-workflow Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workflow-docs Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workflow-swc-playground Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workflow-tarballs Ready Ready Preview, v0 Aug 26, 2026 9:23pm
workflow-web Ready Ready Preview, v0 Aug 26, 2026 9:23pm

@changeset-bot

changeset-bot Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b8647a4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@workflow/web-shared Patch
@workflow/web Patch
@workflow/cli Patch
@workflow/nitro Patch
workflow Patch
@workflow/world-testing Patch
@workflow/nuxt Patch
@workflow/core Patch
@workflow/builders Patch
@workflow/next Patch
@workflow/vitest Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

⏳ Tests are running...

This comment will be updated with the results when the tests complete.


_Started at: _

@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

⏳ Benchmarks are running for 3d1fb2c... (run logs)

ℹ️ Metric definitions & methodology

Metrics —

All timestamps are deployment-side; runs are triggered in-deployment, so the CI runner and api.vercel.com sit outside every measured window. TTFS = start() → first step body (includes dispatch + any cold start); Fan-out TTFS/TTLS = first/last step completion of one Promise.all from the same anchor (the gap is the runtime’s fan-out spread); STSO/WO between step bodies; CRTT inside the workflow (excludes the api.vercel.com read path).

Cold starts stay in the numbers (real bursty-workload latency, inflates P75+); Best is the warm floor.

@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Sim World

Simulated world deterministic testing for races. Traces

🟠 world-sim scenario book — 1 fail of 41 total

fence=per-spec

scenario outcome events virt replay violations
✅ smoke-no-steps completed 3 0ms ok 0
✅ smoke-one-step completed 6 0ms ok 0
✅ hook-at-step-started completed 12 0ms ok 0
✅ hook-at-step-completed completed 12 0ms ok 0
✅ hook-at-hook-created completed 12 0ms ok 0
✅ deadline-hook-wins completed 7 1.0h ok 0
✅ deadline-expires completed 7 1.0h ok 0
✅ long-sleep completed 11 30.0d ok 0
✅ hook-never-arrives stalled 3 0ms skipped 0
✅ step-retries-twice completed 10 2.0s ok 0
✅ parallel-steps completed 9 0ms ok 0
✅ hook-on-execution-state completed 12 0ms ok 0
✅ peek-hook-before-branch completed 12 0ms ok 0
✅ peek-hook-after-branch completed 12 0ms ok 0
✅ peek-hook-at-registration completed 12 0ms ok 0
✅ race-hook-before-probe completed 12 0ms ok 0
✅ race-hook-after-probe completed 12 0ms ok 0
✅ race-duplicate-delivery completed 13 0ms ok 0
✅ attr-hook-before-step completed 11 0ms ok 0
✅ attr-hook-after-step completed 11 0ms ok 0
✅ attr-from-step-body completed 13 0ms ok 0
✅ fork-hook-after-timeout completed 14 1.0m ok 0
✅ fork-hook-before-timeout completed 14 1.0m ok 0
✅ count-hook-after-timeout completed 17 1.0m ok 0
✅ count-hook-before-timeout completed 20 1.0m ok 0
✅ stale-read-step-count-fork completed 20 1.0m ok 0
✅ stale-read-equal-step-counts completed 14 1.0m ok 0
✅ step-vs-step-fork completed 12 0ms ok 0
✅ step-vs-step-fork-fenced completed 12 0ms ok 0
✅ fence-catches-benign-direction completed 12 5ms ok 0
✅ in-flight-before-decision completed 17 1.0m ok 0
❌ in-flight-before-decision-counted completed 17 1.0m ok 0
✅ in-flight-after-decision completed 19 2.0m ok 0
✅ stale-read-step-count-fork-fenced completed 20 1.0m ok 0
✅ fork-hook-wins completed 13 1.0m ok 0
✅ fork-timeout-wins completed 13 1.0m ok 0
✅ unclaimed-payload-under-fork completed 17 1.0m ok 0
✅ claimed-payload-under-fork completed 17 1.0m ok 0
✅ writers-independent-step-bodies completed 12 0ms ok 0
✅ writers-scripted-tempo completed 12 0ms ok 0
✅ cancel-mid-step cancelled 7 0ms skipped 0

Full trace: world-sim.txt

@github-actions

Copy link
Copy Markdown
Contributor
Framework Flow route Step reg. Framework output
hono 200.9 KiB (±0) 40.3 KiB (±0) 1.76 MiB (±0)
nextjs-turbopack 206.3 KiB (±0) 439 B (±0) 763.1 KiB (±0)
About these numbers

Sizes are gzip; parentheses show the change against main.
Flow route and Step reg. gate this job, on raw bytes rather than the gzip shown, at max(2%, 50.0 KiB). Framework output is informational.

3d1fb2c · run

@alangenfeld
alangenfeld force-pushed the alangenfeld/cache-sidebar-step-detail branch from 3d1fb2c to ce72f03 Compare August 26, 2026 21:00
@alangenfeld alangenfeld changed the title Cache resolved trace span details Project step provenance onto trace spans Aug 26, 2026
@alangenfeld
alangenfeld force-pushed the alangenfeld/cache-sidebar-step-detail branch from ce72f03 to 1e2d97c Compare August 26, 2026 21:01
@vercel
vercel Bot temporarily deployed to Preview – workflow-docs August 26, 2026 21:01 Inactive
@alangenfeld
alangenfeld force-pushed the alangenfeld/cache-sidebar-step-detail branch from 515fc7c to 41a11bc Compare August 26, 2026 21:19
@alangenfeld alangenfeld changed the title Project step provenance onto trace spans Allow product-specific step span attributes Aug 26, 2026
Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com>
@alangenfeld
alangenfeld force-pushed the alangenfeld/cache-sidebar-step-detail branch from 41a11bc to b8647a4 Compare August 26, 2026 21:19
@vercel
vercel Bot temporarily deployed to Preview – workflow-docs August 26, 2026 21:19 Inactive

@karthikscale3 karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: Approved with a few non-blocking API and test follow-ups.

}

export type GetStepAttributes = (
events: Event[]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: This callback is meant to read product-specific enrichment fields, but its input is fixed to the base Event[]. The new test already has to cast to access externalAttemptId, and Front will need the same workaround for vercelId / computeInstanceId. Could we make GetStepAttributes, buildTrace, and TraceViewer generic over TEvent extends Event so consumers retain their enriched event type?


export type GetStepAttributes = (
events: Event[]
) => Record<string, unknown> | undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: The return type suggests any product-specific key can be surfaced, but the sidebar drops keys that are not registered in attributeToDisplayFn. The current Vercel fields happen to be registered, so this works for this use case; please either document that display registration is also required or expose a way for consumers to provide display metadata.

});
const stepSpan = trace.spans.find((span) => span.resource === 'step');

expect(stepSpan?.attributes.data).toMatchObject({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: Could we add a collision assertion here? The implementation intentionally spreads canonical step fields after extension attributes, so a test where the callback returns stepId or status would lock in the non-overridable guarantee documented in the implementation.

@karthikscale3 karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be useful to add a link to the logs page from the side bar and filtering it by the requestId.

@github-actions

Copy link
Copy Markdown
Contributor

No backport to stable for 36944cd (AI decision).

This commit adds a new optional getStepAttributes callback to buildTrace/stepToSpan/TraceViewer, plus a new exported GetStepAttributes type — a purely additive API surface so products can inject their own step span attributes. That is feature work (the subject is even feat(web-shared)), not a fix to broken behavior on stable, so it stays on main.

To override, re-run the Backport to stable workflow manually via workflow_dispatch and paste this commit SHA into the ref input:

36944cdcad824f3628c29ecc056f3b9d1293cb05

This branch was successfully deployed

17 active and 1 inactive deployments
Preview – workflow-swc-playground — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – example-nextjs-workflow-webpack — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – example-nextjs-workflow-turbopack — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workbench-nuxt-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workbench-sveltekit-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – example-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workbench-vite-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workbench-tanstack-start-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workbench-astro-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workbench-nitro-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workbench-express-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workflow-tarballs — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workbench-hono-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workbench-nestjs-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workbench-fastify-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workflow-web — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workbench-python-workflow — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
Preview – workflow-docs — b8647a44 Deployed Aug 26, 2026 by vercel[bot]
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.

2 participants