feat: add telemetry consent fields to Settings (Rust + TypeScript)

New fields: telemetry_consent, crash_reporting_enabled, analytics_enabled,
anonymous_id. All Option/null by default for backward compatibility with
existing settings.json files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-03-25 16:05:13 +01:00
parent 3028a3616c
commit d7166ea993
8 changed files with 97 additions and 8 deletions

View File

@@ -24,6 +24,10 @@ const emptySettings: Settings = {
github_token: null,
github_username: null,
auto_pull_interval_minutes: null,
telemetry_consent: null,
crash_reporting_enabled: null,
analytics_enabled: null,
anonymous_id: null,
}
const populatedSettings: Settings = {
@@ -33,6 +37,10 @@ const populatedSettings: Settings = {
github_token: null,
github_username: null,
auto_pull_interval_minutes: 5,
telemetry_consent: null,
crash_reporting_enabled: null,
analytics_enabled: null,
anonymous_id: null,
}
describe('SettingsPanel', () => {
@@ -87,14 +95,14 @@ describe('SettingsPanel', () => {
fireEvent.click(screen.getByTestId('settings-save'))
expect(onSave).toHaveBeenCalledWith({
expect(onSave).toHaveBeenCalledWith(expect.objectContaining({
anthropic_key: null,
openai_key: 'sk-openai-test',
google_key: null,
github_token: null,
github_username: null,
auto_pull_interval_minutes: 5,
})
}))
expect(onClose).toHaveBeenCalled()
})
@@ -108,14 +116,14 @@ describe('SettingsPanel', () => {
fireEvent.click(screen.getByTestId('settings-save'))
expect(onSave).toHaveBeenCalledWith({
expect(onSave).toHaveBeenCalledWith(expect.objectContaining({
anthropic_key: null,
openai_key: null,
google_key: null,
github_token: null,
github_username: null,
auto_pull_interval_minutes: 5,
})
}))
})
it('calls onClose when Cancel is clicked', () => {
@@ -150,14 +158,14 @@ describe('SettingsPanel', () => {
fireEvent.change(openaiInput, { target: { value: 'sk-openai-test' } })
fireEvent.keyDown(screen.getByTestId('settings-panel'), { key: 'Enter', metaKey: true })
expect(onSave).toHaveBeenCalledWith({
expect(onSave).toHaveBeenCalledWith(expect.objectContaining({
anthropic_key: null,
openai_key: 'sk-openai-test',
google_key: null,
github_token: null,
github_username: null,
auto_pull_interval_minutes: 5,
})
}))
})
it('calls onClose when clicking backdrop', () => {

View File

@@ -142,7 +142,11 @@ function SettingsPanelInner({ settings, onSave, onClose }: Omit<SettingsPanelPro
github_token: ghOverride ? ghOverride.token : (githubToken ?? null),
github_username: ghOverride ? ghOverride.username : (githubUsername ?? null),
auto_pull_interval_minutes: pullInterval,
}), [openaiKey, googleKey, githubToken, githubUsername, pullInterval])
telemetry_consent: settings.telemetry_consent,
crash_reporting_enabled: settings.crash_reporting_enabled,
analytics_enabled: settings.analytics_enabled,
anonymous_id: settings.anonymous_id,
}), [openaiKey, googleKey, githubToken, githubUsername, pullInterval, settings.telemetry_consent, settings.crash_reporting_enabled, settings.analytics_enabled, settings.anonymous_id])
const handleSave = () => {
onSave(buildSettings())