Repository navigation
Open
Labels
area:testingbugSomething isn't workingeffort-medium1-2 jours, quelques fichierseffort-smallQuelques heures, 1 fichierenhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is neededpriority:medium
Description
Context
Follow-up from #1181 which added the new rtk telemetry {status|enable|disable|forget} subcommands implementing GDPR consent and erasure flow.
The implementation in src/core/telemetry_cmd.rs (~165 lines) merged without unit tests. Given the sensitivity of the code path (consent management, data erasure, GDPR compliance), this should be addressed before the next release.
Scope
At minimum, the following tests should be added:
maybe_ping() consent guard
- Returns no-op when
consent_givenisNone - Returns no-op when
consent_givenisSome(false) - Only sends when
consent_given == Some(true)ANDenabled == true
send_erasure_request()
- Includes the
X-RTK-Tokenheader whenRTK_TELEMETRY_TOKENis set at compile time - Returns error on 4xx/5xx HTTP response
- Times out cleanly after 5s
- Handles empty/malformed server response
run_forget()
- Deletes
.device_saltif present - Deletes
history.dbif present - Preserves device hash for erasure HTTP call (even after salt deletion)
- Displays full hash (not truncated) in fallback error message
- Works correctly when salt file does not exist (no panic)
prompt_telemetry_consent()
- Returns
Ok(())immediately whenconsent_given == Some(true)orSome(false)(no re-ask) - Returns
Ok(())silently whenstdinis not a TTY (CI/CD mode) — no prompt output - Only prompts when
consent_given == NoneAND TTY is interactive
save_telemetry_consent()
- Writes
consent_given,consent_date, andenabledatomically - Preserves other config fields on save
Notes
- Follow the pattern in
src/core/tracking.rs::testsfor DB fixture setup. - Use a
TempDirfor isolation and pointRTK_DATA_DIRat it for tests that touch the filesystem. - Mock HTTP with a simple local server (or use the approach already used elsewhere in the codebase if one exists).
Priority: medium — the code is working correctly (manually verified during #1181 review), but regression risk is high given GDPR implications.
Metadata
Metadata
Assignees
Labels
area:testingbugSomething isn't workingeffort-medium1-2 jours, quelques fichierseffort-smallQuelques heures, 1 fichierenhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is neededpriority:medium
Activity
pszymkowiak commentedon Apr 12, 2026
🔍 Automated Triage
featuremediumSummary
Well-scoped request to add unit tests for telemetry_cmd.rs (GDPR consent/erasure); PR #1270 already in progress — monitor for completion and watch #2106 for a related regression introduced by that PR.
📁 Relevant files
src/core/telemetry_cmd.rssrc/core/tracking.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
a22407332FilipeMonteiro commentedon Apr 13, 2026
Hi! I'd like to work on this issue.
Could you assign this to me? I'll have a draft PR up shortly.
test(telemetry): add comprehensive unit tests for telemetry_cmd.rs (f…
test(telemetry): add comprehensive unit tests for telemetry_cmd.rs (f…
test(telemetry): add comprehensive unit tests for telemetry_cmd.rs (f…
test(telemetry): add comprehensive unit tests for telemetry_cmd.rs
test(telemetry): add comprehensive unit tests for telemetry_cmd.rs
test(telemetry): add comprehensive unit tests for telemetry_cmd.rs