Skip to content

improvement(logs): add copy raw trace button to trace view header#4968

Merged
waleedlatif1 merged 2 commits into
stagingfrom
feat/copy-trace
Jun 11, 2026
Merged

improvement(logs): add copy raw trace button to trace view header#4968
waleedlatif1 merged 2 commits into
stagingfrom
feat/copy-trace

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • adds a copy button to the trace view header in the log details sidebar that copies the raw trace spans as JSON, so the full execution trace can be pasted into an LLM
  • sits next to the expand/collapse controls, same ghost-button styling, clipboard → check icon swap on copy

Type of Change

  • Improvement

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a "Copy raw trace" button to the trace view header that serialises all spans as pretty-printed JSON and copies them to the clipboard. It also refactors several existing copy-to-clipboard patterns across log-details.tsx and trace-view.tsx to use the new shared useCopyToClipboard hook, removes an unused menuRef in execution-snapshot.tsx, and deletes the dead FileDownload export along with its download-in-progress state.

  • New button: Clipboard → Check icon swap in the trace header, ghostbutton styled to match the existing expand/collapse controls, with a tooltip on each state.
  • Hook adoption: Three separate [copied, setCopied] + setTimeout + cleanup patterns are replaced by useCopyToClipboard, removing ~25 lines of boilerplate and fixing a pre-existing double-fire of onActiveTabChange in the tab onChange handler.
  • Dead code removal: The standalone FileDownload component and the isDownloading guard in FileCard are deleted; the component was not consumed anywhere outside its own module."

Confidence Score: 5/5

Safe to merge. The new copy button is additive UI only, the hook migrations are mechanical replacements with identical runtime behaviour, and the deleted code had no consumers.

All changed paths are UI-only and the new feature is purely additive. The removed isDownloading guard in FileCard opens a door to duplicate tabs on rapid clicks, but this was pre-existing UX rather than a correctness regression introduced by this PR — no data is lost or corrupted.

No files require special attention. The slight behavioural change in file-download.tsx is minor.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/trace-view/trace-view.tsx Adds the Copy raw trace button using useCopyToClipboard; also migrates DetailCodeSection copy logic to the same hook.
apps/sim/app/workspace/[workspaceId]/logs/components/log-details/log-details.tsx Migrates WorkflowOutputSection and LogDetailsContent copy-to-clipboard patterns to useCopyToClipboard; simplifies the tab onChange handler.
apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/file-download/file-download.tsx Removes FileDownload export and the isDownloading guard from FileCard; loses double-click protection that prevented opening multiple tabs.
apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/file-download/index.ts Barrel updated to remove FileDownload export; no consumers existed.
apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/execution-snapshot/execution-snapshot.tsx Removes unused menuRef and its import; straightforward cleanup.

Reviews (2): Last reviewed commit: "improvement(logs): cleanup pass over log..." | Re-trigger Greptile

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jun 11, 2026 6:17pm

Request Review

@cursor

cursor Bot commented Jun 11, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
UI-only log sidebar changes; tab parent notification behavior is slightly narrowed on tab clicks but useLayoutEffect still propagates resolvedTab.

Overview
Adds a Copy raw trace control in the trace view header (next to expand/collapse) that copies formatted JSON of traceSpans, with clipboard/check feedback via useCopyToClipboard.

Clipboard cleanup: workflow output sections, trace detail JSON blocks, and run ID copy in log details now use useCopyToClipboard instead of manual navigator.clipboard + timeout refs.

File UI: removes the unused FileDownload export and drops per-card download loading/disabled state on FileCards (static Download button).

Misc: removes an unused useRef in execution snapshot; log details tab onChange only updates local tab state (parent tab sync still runs via existing useLayoutEffect on resolvedTab).

Reviewed by Cursor Bugbot for commit bc00f26. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit bc00f26. Configure here.

@waleedlatif1 waleedlatif1 merged commit b8daa0f into staging Jun 11, 2026
15 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/copy-trace branch June 11, 2026 18:18
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.

1 participant