Skip to content

Sentry: Preserve native Windows paths during initialization - #320

Open
Kheartz wants to merge 1 commit into
MafiaHub:developfrom
Kheartz:fix/sentry-windows-paths
Open

Kheartz wants to merge 1 commit into
MafiaHub:developfrom
Kheartz:fix/sentry-windows-paths

Conversation

@Kheartz

@Kheartz Kheartz commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Crash reporting can abort application startup with 0xC0000005 when the launcher is installed in a Windows folder such as Masaüstü. The Framework passes native code-page path strings to Sentry's narrow APIs, which decode them as UTF-8. On Windows code page 1252, the database path is rejected and sentry_init dereferences it in sentry__path_create_dir_all.

Keep paths as std::filesystem::path at the SDK boundary and use Sentry's wide Windows APIs for the Crashpad handler, cache database, startup attachments, and dynamically attached files. Filesystem conversion errors return Framework::Error. The public string interfaces retain their existing native filesystem encoding; this change does not recover characters already lost by a caller's conversion.

Before / after

Measured on Windows x64, native code page 1252, using the real Sentry/Crashpad backend with an empty DSN (uploads disabled). Each case runs in its own process.

Regression case Before: unchanged develop wrapper After
ASCII installation directory Pass Pass
Masaüstü installation directory Access violation: 0xC0000005 Pass: reporter initializes and cache exists
Relative installation directory Pass Pass
Missing Crashpad handler Returns an error Returns an error
A file blocks the cache directory Returns an error Returns an error

The new Windows regression target also exercises startup and dynamic attachments with native non-ASCII filenames. It selects a losslessly representable Unicode fixture for the active Windows code page and is included in RunFrameworkTests.

Validation

  • builds\build.bat RunFrameworkSentryTests 64: all 5 cases pass after the fix; the non-ASCII installation case fails with 0xC0000005 before the fix.
  • builds\build.bat RunFrameworkTests 64: 659 Framework tests, 1 client scripting test, and all 5 Sentry cases pass.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Sentry handling of Windows filesystem paths, including paths with characters from the native code page.
    • Attachment paths are resolved to absolute paths, and filesystem errors now include clearer error details.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4427b480-a60e-4eaf-bea5-cd0af2e32b62

📥 Commits

Reviewing files that changed from the base of the PR and between eb8c84f and 37c7f61.


📒 Files selected for processing (4)
  • code/framework/src/external/sentry/wrapper.cpp
  • code/framework/src/external/sentry/wrapper.h
  • code/tests/CMakeLists.txt
  • code/tests/sentry_ut.cpp

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



Walkthrough

The Sentry wrapper now preserves native filesystem paths on Windows, resolves attachment paths to absolute paths, and reports filesystem errors through framework errors. Windows integration tests cover path handling and initialization failures.

Changes

Sentry Path Handling

Layer / File(s) Summary
Native path registration and errors
code/framework/src/external/sentry/wrapper.cpp, code/framework/src/external/sentry/wrapper.h
The wrapper uses wide Sentry path APIs on Windows and narrow APIs on other platforms. It resolves attachment paths to absolute paths and returns filesystem errors as framework errors. The path encoding convention is documented.
Windows Sentry integration tests
code/tests/sentry_ut.cpp, code/tests/CMakeLists.txt
The Windows test executable runs five scenarios in child processes, checks their results, and cleans up its sandbox. CMake adds the executable and runner to the Windows test target.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: segfaultd

Merge Risk: ⚪ Minimal · up to 37c7f

No actionable issue is established that would prevent merging after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 3 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preserving native Windows paths during Sentry initialization.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Docstring Coverage

Explanation

Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 3 files. (1 skipped: 1 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks each path at night
Wide trails keep Windows names in sight
Five small tests hop through their run
They check the cache and handler one by one
Then tidy up before the dawn is done

Comment @coderabbitai help to get the list of available commands.

@Kheartz

Kheartz commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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