[CrashReporting] Attach crash log and user note to the pending crash event

The redacted log used to ride a separate message event from the native
crash (minidump + stack), forcing manual correlation in Sentry. Fold it
into the pending crash envelope(s) instead by appending well-formed
attachment items before consent releases them: sentry-native replays
cached envelopes byte-for-byte (raw read, raw serialize in 0.17.3), so
the appended crash-log.txt and user-note.txt items upload with the very
event that already carries the dump and stack.

Covers both storage locations: Ask mode's consent-held files in
<database>/cache and AlwaysSend's transport-dumped files in
<database>/<run>.run, which must be attached before sentry_init replays
them. When no pending crash event exists (unclean exit without a native
crash) the standalone message event remains as fallback, now also
carrying the optional note.

The dialog gains an optional free-text field ('Here's what I was
doing...') that travels as user-note.txt; the mock JSON records it too.
This commit is contained in:
Lukas Brübach 2026-10-17 15:11:30 +02:00 • committed by GitHub
parent 038e56aab6
commit 2a21c87e7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 437 additions and 31 deletions

View file

@ -22,8 +22,11 @@ class CrashReporter;
*
* Mock mode (default): the Send path writes a redacted JSON file to the temp
* dir instead of uploading anything. Real mode (realSending, with a live
* CrashReporter): Send gives consent and captures a redacted message event
* with the log preview attached; failure offers a local save instead.
* CrashReporter): Send first folds the redacted log and the optional user note
* into the pending native crash event(s), then gives consent so dump, stack,
* log and note upload as one Sentry event; when no pending crash event exists
* it falls back to a standalone message event with the same attachments.
* Failure offers a local save instead.
*/
class DlgCrashReport : public QDialog
{
@ -32,7 +35,7 @@ public:
explicit DlgCrashReport(QWidget *parent = nullptr, bool realSending = false, CrashReporter *_reporter = nullptr);
static QString buildRedactedPreview();
static QString writeMockReport(const QString &previewText);
static QString writeMockReport(const QString &previewText, const QString &userNote = QString());
void reject() override;
@ -43,6 +46,7 @@ private:
QLabel *infoLabel;
QLabel *accountLabel;
QPlainTextEdit *previewArea;
QPlainTextEdit *noteArea;
QCheckBox *rememberBox;
QPushButton *sendButton;
QPushButton *dontSendButton;