Skip to content

Commit a210def

Browse files
committed
Say that telemetry off does not stop mapbox report
A report is something someone ran on purpose, so it still fetches the CLI's token from cli.mapbox.com with telemetry off. The README's opt-out section and the report docs now say so, and an end-to-end test holds it for `config set telemetry off`.
1 parent 9a2e7b9 commit a210def

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,11 @@ or, to turn it off in every shell,
702702
mapbox config set telemetry off
703703
```
704704

705+
Opting out does not stop [`mapbox report`](#feedback-about-the-cli), since
706+
you run it on purpose: it still fetches the CLI's token from
707+
`https://cli.mapbox.com/config/token.json` when it has none, and sends your
708+
message with the CLI's version and OS appended.
709+
705710
For additional information on our data processing activities and your
706711
related rights, please see our Mapbox
707712
[Privacy Policy](https://www.mapbox.com/legal/privacy).

‎docs/commands.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2034,7 +2034,10 @@ revoked with no new one yet, this API refuses it, or it is rate-limited
20342034
your token, though the message is still filed under Mapbox's account. With
20352035
none of your own, the command fails with `cli_token_unavailable` or
20362036
`cli_token_forbidden`, or with the `429` itself. Each run tries the CLI's
2037-
token again; nothing here is put off for later.
2037+
token again; nothing here is put off for later. Turning telemetry off does
2038+
not change any of this: a report is something you ran on purpose, so it
2039+
still fetches the CLI's token from `https://cli.mapbox.com/config/token.json`
2040+
when it has none.
20382041

20392042
#### Parameters
20402043

‎tests/dry_run.rs‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,23 @@ mod report_token {
813813
assert!(state.contains(r#""token":"pk.fresh""#), "{state}");
814814
}
815815

816+
/// Telemetry off stops the background fetch, not `report`: someone ran
817+
/// it on purpose. Every run here sets `MAPBOX_CLI_NO_TELEMETRY`; this
818+
/// adds the setting.
819+
#[test]
820+
fn telemetry_off_does_not_stop_report_fetching() {
821+
let config = config_dir("report-telemetry-off");
822+
let set = run(&config, &["config", "set", "telemetry", "off"]);
823+
assert!(set.status.success(), "{}", stderr(&set));
824+
let out = sent_nowhere(&config, &["--debug", "report", "A test"])
825+
.env("MAPBOX_INTERNAL_CLI_TOKEN_URL", token_endpoint("pk.fresh"))
826+
.output()
827+
.expect("run mapbox");
828+
let state = std::fs::read_to_string(config.join("cli-token.json"))
829+
.unwrap_or_else(|_| panic!("nothing fetched: {}", stderr(&out)));
830+
assert!(state.contains(r#""token":"pk.fresh""#), "{state}");
831+
}
832+
816833
/// A command fetches past the backoff, so the reason it gives is what
817834
/// that fetch found, not the backoff's wait, which it never waited for.
818835
#[test]

0 commit comments

Comments
 (0)