ref(native): scope application to event#1769
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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); |
There was a problem hiding this comment.
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)
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) |
There was a problem hiding this comment.
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.


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_eventwith updated signature. This is what the app hang feature will then also usenative_backend_apply_scopeis the "source of truth" for all paths (update file & actual event)#skip-changelog