Skip to content

Conversation

@SamKomesarook
Copy link

@SamKomesarook SamKomesarook commented Dec 9, 2025

Note

Adds a TraceEmbed component for MDX blogs and a shared spans API, updating TraceView to support embedding via initial span selection and disabled routing.

  • Embeds:
    • components/embeds/trace-embed.tsx: New TraceEmbed that fetches shared trace and spans, supports spanId, host, previewOnly, and fixed height, and renders TraceView with routing disabled.
  • API:
    • app/api/shared/traces/[traceId]/spans/route.ts: New GET endpoint returning shared spans with ZodError and generic error handling.
  • Blog:
    • app/blog/[slug]/page.tsx: MDX components map trace/Trace tags to TraceEmbed for inline trace embeds.
  • Trace View:
    • components/shared/traces/trace-view.tsx: Accepts initialSpanId and disableRouting; initializes selection from initialSpanId or spanId query; suppresses URL updates when disableRouting is true; minor effect dependency updates.

Written by Cursor Bugbot for commit 94c7843. This will update automatically on new commits. Configure here.


Important

Adds TraceEmbed component for embedding trace views in blog posts, with new API route for fetching spans and updates to TraceView for initial span selection and routing control.

  • New Feature:
    • Adds TraceEmbed component in trace-embed.tsx for embedding trace views with props like traceId, spanId, host, and previewOnly.
    • Supports fetching trace and spans data from API and handles loading, error, and data states.
  • API:
    • Adds GET handler in route.ts for /api/shared/traces/[traceId]/spans to fetch spans by traceId.
    • Handles ZodError with 400 status and other errors with 500 status.
  • Integration:
    • Updates page.tsx to include TraceEmbed in blog posts, allowing <trace> and <Trace> tags.
  • TraceView Enhancements:
    • Updates trace-view.tsx to accept initialSpanId and disableRouting props for initial span selection and routing control.

This description was created by Ellipsis for 94c7843. You can customize this summary. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 94c7843 in 57 seconds. Click for details.
  • Reviewed 217 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. frontend/app/api/shared/traces/[traceId]/spans/route.ts:16
  • Draft comment:
    Good error handling using ZodError. Consider optionally logging unexpected errors to aid debugging in production.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. frontend/app/blog/[slug]/page.tsx:60
  • Draft comment:
    Clear addition of TraceEmbed in MDX components. Ensure MDX content supplies the necessary props for proper rendering.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. frontend/components/embeds/trace-embed.tsx:24
  • Draft comment:
    Good use of useMemo to resolve the host. Ensure that the API endpoints support proper CORS when using a dynamic host value.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
4. frontend/components/shared/traces/trace-view.tsx:150
  • Draft comment:
    Integration of 'initialSpanId' and 'disableRouting' props works as expected. Consider adding inline documentation for these new props to clarify their purpose.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_OoRlxk45jaqa0SAG

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

setSelectedSpan({ ...span, collapsed: false });
}
}, []);
}, [initialSpanId, searchParams, setSelectedSpan, spans]);
Copy link

Choose a reason for hiding this comment

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

Bug: Span selection reset on URL parameter changes

The second useEffect has searchParams and spans in its dependency array, causing it to re-run whenever URL parameters change. When disableRouting is true (as in the embed component), user span selections are not persisted to the URL, so any searchParams change will reset the selection back to initialSpanId or the first span, losing the user's interactive selection. Previously this logic only ran on mount with an empty dependency array.

Fix in Cursor Fix in Web


if (!spansRes.ok) {
const text = await spansRes.text();
throw new Error(text || "Failed to load spans.");
Copy link

Choose a reason for hiding this comment

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

Bug: Error responses parsed as text display raw JSON

When API requests fail, the error responses are read using text() but the API endpoints return JSON objects like { error: "message" }. This causes the displayed error message to show raw JSON strings like {"error":"Trace not found"} to users instead of just the error message. The code should parse the JSON response and extract the error field.

Fix in Cursor Fix in Web

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