Skip to content

Send assertion messages to Sentry - #457

Merged
edolstra merged 1 commit into
mainfrom
sentry-info
May 14, 2026
Merged

edolstra merged 1 commit into
mainfrom
sentry-info

Conversation

@edolstra

@edolstra edolstra commented May 14, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

This includes a tag like

Assertion 'false && "This is an assertion failure"' failed in virtual void CmdCrash::run() at ../src/nix/crash.cc:36

in the sentry crash report.

Context

Summary by CodeRabbit

  • Chores
    • Enhanced error tracking and diagnostic capabilities. The system now captures additional context information when errors and assertion failures occur, with improved event categorization and tagging for better organization. This enables more efficient troubleshooting, improved issue tracking, and better support workflows for faster resolution.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 14, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 040f4885-99fb-479b-9deb-5403bd3b5a2a

📥 Commits

Reviewing files that changed from the base of the PR and between e4fb0ab and 1efbd30.

📒 Files selected for processing (5)
  • nix-meson-build-support/common/assert-fail/wrap-assert-fail.cc
  • src/libutil/include/nix/util/meson.build
  • src/libutil/include/nix/util/sentry.hh
  • src/libutil/util.cc
  • src/nix/main.cc

📝 Walkthrough

Walkthrough

This PR introduces a setSentryTag abstraction function to decouple Sentry tag-setting logic from application code. A new header declares the function, a default no-op implementation is provided, and existing Sentry tag assignments in main initialization and assertion failure handling are refactored to use this abstraction.

Changes

Sentry Tagging Abstraction

Layer / File(s) Summary
Sentry tag abstraction contract and default implementation
src/libutil/include/nix/util/sentry.hh, src/libutil/include/nix/util/meson.build, src/libutil/util.cc
A new setSentryTag extern function is declared in sentry.hh as a fun<void(const char *, const char *)>, registered to public headers via Meson, and initialized to a no-op lambda in util.cc.
Main application tagging refactoring
src/nix/main.cc
Includes the Sentry header and replaces direct sentry_set_tag calls with setSentryTag calls for both nix_command and nix_subcommand tags, eliminating conditional compilation guards.
Assertion failure Sentry integration
nix-meson-build-support/common/assert-fail/wrap-assert-fail.cc
The assertion wrapper includes the Sentry header and uses setSentryTag to tag assertion failures before panic, replacing the previous panic path.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • cole-h

Poem

A hop, a skip, through abstractions neat,
Sentry tags now have a function sweet.
No more direct calls in every place,
Indirection gives flexibility grace.
Assertions hop through Sentry's embrace! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. 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 accurately summarizes the main objective of the changeset: adding Sentry integration to capture assertion failure messages in crash reports.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentry-info

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

@github-actions

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request May 14, 2026 21:28 Inactive
@edolstra
edolstra added this pull request to the merge queue May 14, 2026
Merged via the queue into main with commit 5dbb952 May 14, 2026
29 checks passed
@edolstra
edolstra deleted the sentry-info branch May 14, 2026 22:01

This branch was previously deployed

1 inactive deployment
pull request — 1efbd305 Deployed May 14, 2026 by github-actions[bot]
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