Skip to content

feat: add scope merging mechanism - #1373

Open
giortzisg wants to merge 2 commits into
scopes/scope-storagefrom
scopes/scope-merge
Open

feat: add scope merging mechanism#1373
giortzisg wants to merge 2 commits into
scopes/scope-storagefrom
scopes/scope-merge

Conversation

@giortzisg

@giortzisg giortzisg commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Description

Issues

Changelog Entry Instructions

To add a custom changelog entry, uncomment the section above. Supports:

  • Single entry: just write text
  • Multiple entries: use bullet points
  • Nested bullets: indent 4+ spaces

For more details: custom changelog entries

Reminders

@linear-code

linear-code Bot commented Jul 23, 2026

Copy link
Copy Markdown

GO-155

@giortzisg
giortzisg force-pushed the scopes/scope-merge branch from 8f6a8b4 to e509cb6 Compare July 23, 2026 08:45
@giortzisg
giortzisg marked this pull request as ready for review July 23, 2026 08:51
Comment thread scope.go Outdated
@giortzisg
giortzisg force-pushed the scopes/scope-merge branch from e509cb6 to 5ea0d02 Compare July 30, 2026 20:45
@giortzisg
giortzisg force-pushed the scopes/scope-merge branch from 5ea0d02 to 2905cce Compare August 4, 2026 15:25
Comment thread scope.go Outdated
@giortzisg
giortzisg force-pushed the scopes/scope-merge branch 2 times, most recently from 8b46a73 to b3bd79f Compare August 5, 2026 09:59
Comment thread scope.go Outdated
@giortzisg
giortzisg force-pushed the scopes/scope-merge branch 2 times, most recently from a32be8d to af060b8 Compare August 12, 2026 12:11
Comment thread scope.go
Comment thread scope.go
Comment thread scope.go
Comment thread scope.go
Comment thread scope.go
Comment thread metrics.go Outdated

@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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f1ba13c. Configure here.

Comment thread client.go
Comment thread scope.go
Comment thread scope.go
Comment on lines +430 to +432
if key == "trace" {
continue
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Manually set trace contexts on the scope are now silently ignored for error events due to an unconditional skip. This breaks error-to-trace linking for users relying on this feature.
Severity: MEDIUM

Suggested Fix

Restore the previous conditional logic in the loop within mergeScope. The check for the trace key should only continue if the event is a transaction. Re-add the && event.Type == transactionType condition to the if statement to allow error events to correctly inherit the trace context from the scope.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: scope.go#L430-L432

Potential issue: The refactoring in `mergeScope` unconditionally skips the `trace`
context from the scope. Previously, this context was only skipped for transaction
events, allowing error events to use a manually set trace context. This was documented
behavior used "to link errors and traces/spans in Sentry." The new implementation
silently ignores any manually set `trace` context on the scope for error events,
breaking this functionality. The automatic trace resolution via `applyTraceToEvent` does
not provide an alternative for this manual use case, resulting in a regression where
error events may no longer be correctly linked to traces if a user was relying on this
manual mechanism.

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