Repository navigation
Conversation
Add CopyButton and TextWithCopyButton to @workflow/web-shared and replace the five separate copy implementations in web-shared and the web app. Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
Contributor
🦋 Changeset detectedLatest commit: d9fe8da The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
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 |
Contributor
Sim WorldSimulated world deterministic testing for races. Traces 🟢 world-sim scenario book — 0 fail of 45 total
Full trace: |
Signed-off-by: Mitul Shah <[email protected]> Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
Delete copyable-text.tsx again and switch ErrorCodeBadge to CopyButton while keeping main's shared cn import from @workflow/web-shared. Describe CopyButton neutrally in its doc comment. Signed-off-by: Mitul Shah <[email protected]> Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
2 of 3 tasks
mitul-s
added a commit
that referenced
this pull request
Nov 17, 2026
### What Deletes dead code in `@workflow/web-shared`, and removes every public export that neither `@workflow/web` nor the Vercel dashboard (`vercel/front`) imports, including the unused `@workflow/web-shared/components` entry point. This is the web-shared half of #5529. The `@workflow/web` half is in #5543, and the two PRs don't depend on each other. ### Why Code that nothing runs still has to be maintained and reviewed, and every export is API we have to keep working. Consumers are expected to update with this change rather than hold the cleanup back. The dashboard only needs one change, listed below. ### Preview [workflow-web preview](https://workflow-web-git-web-shared-delete-dead-code.labs.vercel.dev/?tab=runs) 1. Open a run whose input or output contains a stream, a run reference, a class instance or encrypted data, and go to `?tab=trace`. 2. Select the step and check that the inspector still renders stream and run refs as links, class instances with their class name, and encrypted fields as `Encrypted` with a Decrypt button that decrypts them. #### Change needed in `vercel/front` `hydrateResourceIOWithKey` is removed. Swap it for `hydrateResourceIOAsync`, which takes the same arguments: - `observability/(tabs)/workflows/lib/use-events-list-data.ts` (lines 8, 73, 107, 141) - `observability/(tabs)/workflows/components/run-details-view.tsx` (lines 9, 192) Nothing else the dashboard imports changes (checked against front's `main` on 2026-11-17), and front never imports the `/components` subpath. #### Removed exports | Export | What happened to the code | | --- | --- | | `hydrateResourceIOWithKey` | Deleted. It only forwarded to `hydrateResourceIOAsync`. | | `MenuDropdown`, `MenuDropdownOption` | Deleted. Unused here, in front, and anywhere else in the org (`gh search code --owner vercel`). | | `materializeSteps`, `materializeHooks`, `materializeWaits`, `materializeAll` and the `Materialized*` types | Deleted `lib/event-materialization.ts` and its tests. Only `index.ts` and tests imported it. | | `shouldShowReenqueueButton`, `hasPendingStepsFromEvents`, `hasPendingHooksFromEvents`, `isTerminalStatus` | Deleted. `analyzeEvents` stays. | | `identifyStreamSteps`, `StreamStep` | Deleted. | | `looksLikeWorkflowIdSearchInput` | Deleted, along with its tests. | | `CLASS_INSTANCE_REF_TYPE`, `ClassInstanceRef`, `extractStreamIds`, `isClassInstanceRef`, `isStreamId`, `isStreamRef`, `STREAM_REF_TYPE`, `truncateId`, `StreamRef` | Re-exports from `@workflow/core/serialization-format`. Import them from there. | | `hookEventsToHookEntity`, `isEncryptedMarker`, `DUPLICATE_EVENT_MESSAGE`, `findDuplicateEventIds`, `isSealedNoopEvent`, `SEALED_EVENT_MESSAGE`, `parseExactWorkflowSearchId`, `ExactWorkflowSearchId`, `isQuickJSSnapshotRun`, `extractConversation`, `isDoStreamStep`, `formatDurationPrecise`, `DecodedStreamChunkSource`, `useToast` | Still used inside the package. Only the export from the entry point goes. | | `ResolveHookModal`, `ConversationView`, `SidebarDataProvider`, `SelectedSpanInfo`, `DecryptClickContext`, `DecryptClickContextValue`, `IconButton`, `Kbd`, `LoadMoreButton` | Same: used internally, no longer exported. | #### Kept on purpose - Types that are part of an API that stays public, so callers can annotate what they pass in or get back: `ButtonProps`, `DataInspectorProps`, the `useHookActions`/`HookResolveModalWrapper`/`ResolveHookDropdownItem` prop and option types, `EventAnalysis`, `RunLimitGuidance`/`RunLimitGuidanceKind`, `RunStateHydratorOptions`/`StateHistoryPage` (the docs describe `createRunStateHydrator` for custom inspectors), and `SpanSelectionInfo`/`DetailResource` (the arguments and result of `FetchSpanDetail`). - `SpanEvent`, which is part of `Span`, and which the v5 What's New page says is still exported. - `collapseRefs` and `isDeepEqual` stay exported from their modules for their tests. #### Other cleanup - Deleted `ui/card.tsx` and `ui/alert.tsx` (unused copies of web's shadcn components), `hooks/use-dark-mode.ts`, `DuplicateEventTooltip`, and the unused `getPaginationDisplay` in `lib/utils.ts`. - Deleted `src/index.d.ts` and `src/components/index.d.ts`: tsc ignores a `.d.ts` next to a `.ts` of the same name, and the published types come from `dist/`. - `ui/data-inspector.tsx` drops its private copies of the ref type guards and imports them from `lib/hydration.ts`. - Dropped `export` from symbols that only their own file uses (`AttributeBlock`, `DetailKeyValueRow`, `sortAttributeKeys`, `TimelineBar`, `kbdVariants`, `MIN_START`/`MIN_END`/`MeasureFn`/`TruncateResult`, `EXPIRED_DISPLAY_NAME`, `summarizeArrayBufferView`, `isRunLevelEvent`, `convertEventsToSpanEvents`). - Comments that still mentioned `ObjectInspector` now say `DataInspector`. - Removed the unused `shiki` dependency. The lockfile diff is three deleted lines. #### Overlap with other open PRs - #5557 rebuilds `MenuDropdown` on Radix, but this PR deletes it because nothing uses it. Only one of the two should land. - #5528 edits `lib/event-materialization.ts` and `start-hook.test.ts`, which this PR deletes and trims. Whichever lands second resolves the conflict by keeping the deletion. - #5522, #5523, #5528 and #5530 edit the same entry-point barrels (`src/index.ts`, `src/components/index.ts`), so expect small conflicts there. #### Differences from #5529 - #5529's sync with `main` restored `ui/alert.tsx` and `shiki` by taking `main`'s copies of conflicting files. This PR deletes them again because they are still unused on `main`. - #5529 kept `hydrateResourceIOWithKey` as a deprecated alias for the dashboard. This PR removes it. ### How did you test your changes? - `pnpm turbo typecheck test build --filter=@workflow/web-shared` on the first commit: 10/10 tasks passed. - `pnpm typecheck` in `packages/web-shared`: no errors. - `pnpm vitest run` in `packages/web-shared`: 34 files, 276 tests passed. Ten fewer than `main`: the seven `event-materialization` tests, the start Hook materialization test, and the two `looksLikeWorkflowIdSearchInput` tests, all of which covered deleted code. - `pnpm turbo build test --filter=@workflow/web` against this branch: 10/10 passed, so `web` builds on the smaller API. `react-router typegen && tsc --noEmit` in `packages/web` reports the same 19 errors as `main`. - `pnpm biome check packages/web-shared`: no errors. - Export audit: every remaining export from `src/index.ts` is imported by `packages/web` or front, apart from the types kept on purpose above. - Visuals were not rendered. The only runtime change is `DataInspector`'s ref detection, which now uses the `@workflow/core` guards. They check `__type` with `in`, so they also match the non-enumerable opaque refs that `collapseRefs` builds, and the existing `DataInspector`/`collapseRefs` tests pass. ### PR Checklist - Required to merge - [x] 📦 `pnpm changeset` was run to create a changelog for this PR - Use the correct semver bump type: `patch` for bug fixes, `minor` for new features, `major` for breaking changes. - Use `pnpm changeset --empty` if you are changing documentation or workbench apps - [x] 🔒 DCO sign-off passes (run `git commit --signoff` on your commits) - [ ] 📝 Ping `@vercel/workflow` in a comment once the PR is ready, and the above checklist is complete _Written by fx_ --------- Signed-off-by: mitul-s <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consolidate the observability UI's five copy-to-clipboard implementations into one
CopyButton(plusTextWithCopyButton) in@workflow/web-shared.Why
Copying worked five different ways:
web-shared'strace-viewer/components/copy-button.tsxreset after 1 s and dropped clipboard failures (void navigator.clipboard.writeText(...).then(...)). Sidebar, ui and event-list code imported it from undertrace-viewer.CopyableText,HookTokenCelland the copy part ofErrorCodeBadgeeach reset after 2 s and handled their own errors.CopyableTextandHookTokenCellhid the button withopacity-0 group-hover, so a keyboard user tabbed onto a control they couldn't see.classNameoverrides or child selectors (copyable-data-block,error-stack-block,stream-viewer,event-details-panel). Appearance should come through props, not className overrides.Approach
packages/web-shared/src/components/ui/copy-button.tsxfollows the design system'sCopyButtonpattern and is built on ourButton:text(a string, or a function that resolves it on click; the hook token uses this to fetch the secret only when you copy it, and the button shows a spinner meanwhile),label(accessible name, defaultCopy to clipboard),variant(tertiaryby default,secondary, ordefaultfor inverted surfaces),size(tiny|small),onCopy,onCopyError.useToastadapter, so host apps keep their own toast system.onCopyErrorreplaces the toast.<output aria-live="polite">) announces "Copied" or the failure.TextWithCopyButtonwraps text and shows the button on hover, onfocus-within(so keyboard focus reveals it), and always onhover: nonedevices.overlayputs asecondarybutton over the end of the text for table cells, which is whatCopyableText overlaydid.Call sites now set appearance through props. Any
classNameleft on a call site only positions the button:sidebar/copyable-data-blockvariant="secondary"+ positionui/error-stack-blocktertiary(default) + positionevent-list/event-details-paneltertiary(default)stream-viewer[&>div]/[&_svg]resizetertiary(default)sidebar/attributes-blockshrink-0 -mr-1-my-0.5 -mr-1so the 24px button keeps the 24px rowCopyableText(5 uses)TextWithCopyButtonwith specific labels ("Copy run ID", "Copy hook ID", "Copy workflow name")HookTokenCellTextWithCopyButtonwith lazytextErrorCodeBadgeButton+ own stateCopyButton variant="default"(inverted, matches the tooltip pill)Deleted:
trace-viewer/components/copy-button.tsx(never exported; the package'sexportsmap blocks deep imports, and no external consumer was found) and the web app'scopyable-text.tsx. New public exports:CopyButton,CopyButtonProps,TextWithCopyButton,TextWithCopyButtonProps.Visual changes to expect (visuals were not rendered; please check in a preview)
tertiarybutton (gray icon) instead of a red-tinted bordered one.tinysize) instead of the 16px override.Validation
Run on current
main(8e2e3cf, which includes #5518's sharedcnand #5524's design tokens) with this change applied:pnpm turbo typecheck test build --filter=@workflow/web-shared --filter=@workflow/web: 12/12 tasks pass. web-shared has 286 tests and web has 165, all passing.biome check packages/web-shared packages/web: no errors. The warnings that remain were already there.@workflow/webhas notypecheckscript.tsc --noEmit -p packages/webreports no errors in the touched files.New
packages/web/app/components/display-utils/copy-button.test.tsx(jsdom) covers: copy plus the polite "Copied" announcement and the 1 s reset, the failure toast and announcement, lazytext, no click propagation, and the reveal classes for hover and focus.packages/web-shared/test/error-stack-block.test.tsassertedbg-red-100, which came only from the old copy button's className override. It now asserts the block's ownvar(--ds-red-100)background.Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>