Fix chroot helper with Sentry#433
Conversation
📝 WalkthroughWalkthroughThe non-Windows chroot helper early-return in Changes
Sequence Diagram(s)sequenceDiagram
participant Init as Init (mainWrapped)
participant Chroot as ChrootHelper
participant Sentry as Sentry Init
participant Crash as Crash Handler
rect rgba(200,200,255,0.5)
Init->>Chroot: (new) check argv[0] == chrootHelperName -> early-return
end
rect rgba(200,255,200,0.5)
Init->>Sentry: Initialize
Init->>Crash: Register handlers
end
note over Init,Chroot: Old flow: Init -> Sentry -> Crash -> Chroot (early-return)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
The chroot helper only works if there are no other threads, but Sentry creates a worker thread. So don't start Sentry in the chroot helper.
f1935bc to
8008e4d
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/functional/shell.sh (1)
68-71: Line 68: Prefer one-shot env assignment instead ofexport.This keeps the regression trigger scoped to the intended
nix shellcall and avoids future cross-test side effects from a persistent exported variable.Suggested diff
-export NIX_SENTRY_ENDPOINT=file://$TEST_ROOT/sentry-endpoint # test whether Sentry is disabled in the chroot helper -nix shell --sandbox-build-dir /build-tmp \ +NIX_SENTRY_ENDPOINT="file://$TEST_ROOT/sentry-endpoint" \ # test whether Sentry is disabled in the chroot helper +nix shell --sandbox-build-dir /build-tmp \ --sandbox-paths '/nix? /bin? /lib? /lib64? /usr?' \ --store "$TEST_ROOT/store0" -f shell-hello.nix hello -c hello | grep 'Hello World'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/functional/shell.sh` around lines 68 - 71, Replace the persistent export of NIX_SENTRY_ENDPOINT with a one-shot environment assignment scoped to the nix shell invocation so the variable only affects that single command; locate the export line that sets NIX_SENTRY_ENDPOINT=file://$TEST_ROOT/sentry-endpoint and move it inline immediately before the `nix shell --sandbox-build-dir ... -f shell-hello.nix hello -c hello | grep 'Hello World'` invocation so the environment is applied only to that process.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/functional/shell.sh`:
- Around line 68-71: Replace the persistent export of NIX_SENTRY_ENDPOINT with a
one-shot environment assignment scoped to the nix shell invocation so the
variable only affects that single command; locate the export line that sets
NIX_SENTRY_ENDPOINT=file://$TEST_ROOT/sentry-endpoint and move it inline
immediately before the `nix shell --sandbox-build-dir ... -f shell-hello.nix
hello -c hello | grep 'Hello World'` invocation so the environment is applied
only to that process.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 591e87d6-94bd-49bd-8c04-698c454b7bf6
📒 Files selected for processing (2)
src/nix/main.cctests/functional/shell.sh
🚧 Files skipped from review as they are similar to previous changes (1)
- src/nix/main.cc
Motivation
The chroot helper only works if there are no other threads, but Sentry creates a worker thread. So don't start Sentry in the chroot helper.
Context
Summary by CodeRabbit
Refactor
Tests