Repository navigation
bunfig: apply telemetry = false in every command that reads the file
#40728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -405,6 +405,15 @@ impl<'a> Parser<'a, '_> { | |
| self.add_error(json.loc, b"bunfig expects an object { } at the root")?; | ||
| } | ||
|
|
||
| // Read before anything in the file can fail: nothing but `true` leaves crash reports on. | ||
| let telemetry = match self.counts { | ||
| Counts::Everything | Counts::OnlyForTheTool => json.get(b"telemetry"), | ||
| Counts::OnlyInstall => None, | ||
|
Comment on lines
+409
to
+411
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟣 pre-existing, not blocking: Users who put Why this was flaggedA user sets Verification: A user with |
||
| }; | ||
|
Comment on lines
+409
to
+412
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if telemetry.is_some_and(|expr| expr.as_bool() != Some(true)) { | ||
| bun_analytics::opt_out_by_config(); | ||
| } | ||
|
|
||
| if self.counts == Counts::OnlyForTheTool { | ||
| return self.read_for_tool(&json); | ||
| } | ||
|
|
@@ -453,13 +462,8 @@ impl<'a> Parser<'a, '_> { | |
| self.load_preload(&expr)?; | ||
| } | ||
|
|
||
| if let Some(expr) = json.get(b"telemetry") { | ||
| if let Some(expr) = telemetry { | ||
| self.expect(&expr, ExprTag::EBoolean)?; | ||
| bun_analytics::set_enabled(if expr.as_bool().expect("infallible: type checked") { | ||
| bun_analytics::TriState::Yes | ||
| } else { | ||
| bun_analytics::TriState::No | ||
| }); | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: oven-sh/bun
Length of output: 15322
Script executed:
Repository: oven-sh/bun
Length of output: 19386
Script executed:
Repository: oven-sh/bun
Length of output: 42829
Script executed:
Repository: oven-sh/bun
Length of output: 6666
Script executed:
Repository: oven-sh/bun
Length of output: 8895
Script executed:
Repository: oven-sh/bun
Length of output: 4539
Script executed:
Repository: oven-sh/bun
Length of output: 8537
Exclude
bunxfrom the telemetry statement.bunxdoes not applytelemetry = falseto its own process. The paragraph can lead users to rely on an ineffective crash-upload opt-out. Clarify the exception and direct users toDO_NOT_TRACK=1.Suggested fix
Committable suggestion