Skip to content

ref(native): scope application to event#1769

Open
bitsandfoxes wants to merge 1 commit into
masterfrom
fix/native-flush-scope
Open

ref(native): scope application to event#1769
bitsandfoxes wants to merge 1 commit into
masterfrom
fix/native-flush-scope

Conversation

@bitsandfoxes
Copy link
Copy Markdown
Contributor

Enables #1742

This PR does not change the current output at all. For #1742 the daemon needs to be able to create non-crash events (i.e. app hangs).

  • build_native_crash_event -> build_native_event with updated signature. This is what the app hang feature will then also use
  • native_backend_apply_scope is the "source of truth" for all paths (update file & actual event)
  • The way the snapshot that gets applied to events gets updated should be unified. This means the Windows specific duplication gets removed

#skip-changelog

@bitsandfoxes bitsandfoxes requested review from jpnurmi and mujacica May 29, 2026 14:46
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 3c6fd49. Configure here.

sentry_value_t event_contexts = sentry_value_new_object();
sentry_value_set_by_key(event_contexts, "os", os_context);
sentry_value_incref(os_context);
native_backend_apply_scope(event, options);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Flush drops explicit "fatal" level for minidump-only fallback

Medium Severity

The old native_backend_flush_scope explicitly set level to SENTRY_LEVEL_FATAL on the periodically flushed event. The new code creates a plain sentry_value_new_object() and calls native_backend_apply_scope, which delegates to sentry__scope_apply_to_event. Since the event has no "level" key, the scope's default level (SENTRY_LEVEL_ERROR → "error") is applied. In the write_envelope_with_minidump path (minidump-only mode), the raw event JSON from the file is sent directly without the daemon overriding the level. If the crash handler doesn't successfully write the event file, the daemon falls back to the periodically flushed file, which now carries level "error" instead of "fatal".

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3c6fd49. Configure here.

// provide one), leave it; otherwise synthesize a minimal one so native-only
// consumers still symbolicate.
static void
native_backend_ensure_device_arch(sentry_value_t event)
Copy link
Copy Markdown
Collaborator

@jpnurmi jpnurmi May 29, 2026

Choose a reason for hiding this comment

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

The native_backend_ prefix is used only for native backend "methods" that implement the sentry_backend_t interface. It could be left out of both internal helpers; this and native_backend_apply_scope.

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