mirror of
https://github.com/vercel/workflow.git
synced 2026-09-14 19:59:43 +08:00
37f10111a8
`runtime.ts` computes a source-map-remapped `errorStack` when a run fails and
passes it to a log whose framing line — "Error while running workflow" — has
no body of its own. `composeLogLine` drops `errorStack` unconditionally, on
the assumption (true for the step executor and the combined runtime, which
render `${framing}\n${stack}`, false here) that the message already carries
it. The stack never reaches the console; #4021 noted this at the call site
and worked around it by adding `errorMessage`, but the stack itself is still
discarded.
- `composeLogLine` promotes the `errorStack` field into the stack body when
the message carries no body of its own, so it goes through the same frame
trimming and is still never duplicated when the caller did embed one. This
also lets #4021's existing `body.includes(errorMessage)` check suppress the
now-redundant `error` row at this call site.
- The header row is skipped when it would be a lone class name that the
promoted stack header already states. A badge still always renders —
attribution is the one thing the stack cannot express — so the step
executor and combined-runtime sites are untouched, as is a stack naming a
different class than `errorName`.
Adds a runtime-level regression test that drives a throwing workflow through
`workflowEntrypoint` and asserts the emitted `console.error` line carries the
message and a stack frame, plus formatter unit tests for the promote,
don't-duplicate, badge and different-class cases. No existing snapshot
changes: the composition is identical everywhere except the run-failure log.
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>