Skip to content

feat: let users choose what an export includes - #1278

Open
darkbanjo wants to merge 2 commits into
mainfrom
jkab/selective-export
Open

darkbanjo wants to merge 2 commits into
mainfrom
jkab/selective-export

Conversation

@darkbanjo

Copy link
Copy Markdown
Collaborator

What

Settings → Preferences → Export My Data now offers a checkbox per data group — chats/projects/prompts, MCP connections, skills and agents, models and providers, tasks and automations, preferences.

Everything is checked by default, so the plain action produces the same whole-account backup as before: exportUserData is called with no options in that case, taking the identical code path rather than a filtered equivalent.

Why

Sharing a subset. A team standing up the same MCP servers and skills wants to hand round those two groups, not a copy of everyone's chat history. mcp_secrets, models_secrets and agents_secrets are local-only and never upload, so a shared bundle's credentials reach only the importing device — the recipient can substitute their own.

Notes

  • No importer changes needed. It already iterates the keys present in the file (Object.entries(fileTables)), and its own docs say omitted tables had zero rows, so a partial envelope restores cleanly on current and older builds.
  • Partial envelopes omit keys rather than writing empty arrays, and UserDataExport['tables'] became Partial<Record<…>> to say so in the type. An empty array would claim the user has no chats; a missing key says chats were not asked for, and only one of those is safe for a restore to act on.
  • Grouping invariants are asserted by tests, not left to review. A credential table never leaves its parent (mcp_secrets/mcp_servers, models_secrets/models, agents_secrets/agents), and every exportable table belongs to exactly one group. That second one matters because includedTables is derived from the PowerSync schema, so a new table there joins exports automatically and would otherwise silently belong to no group and vanish from selective exports.
  • Group labels are built during render with t rather than at module scope, so they follow a language change.

Testing

  • 14 DAL tests including the new partition and pairing invariants
  • 418 tests pass across src/dal and src/settings
  • tsc, lint and prettier clean
  • i18n catalogs extracted and committed

- offer a checkbox per data group in Settings -> Preferences -> Export My
  Data, so a subset can be shared without handing over chat history
- keep every group checked by default and call exportUserData with no
  options in that case, so a full backup takes the identical code path
- omit absent keys from a partial envelope rather than writing empty
  arrays; UserDataExport['tables'] is now Partial to say so in the type,
  because an empty array would claim the user has no chats
- assert the grouping invariants in tests: credential tables never leave
  their parent, and every exportable table belongs to exactly one group
  (includedTables is schema-derived, so a new table would otherwise join
  exports and silently belong to no group)
@github-actions

Copy link
Copy Markdown

Semgrep Security Scan

No security issues found.

The group checkboxes were raw <input type="checkbox">, which renders and
labels correctly but bypasses the design system's styling and focus
treatment and would look out of place against the rest of the settings
page. Swapped to the `Checkbox` primitive from
src/components/ui/checkbox.tsx, matching how tasks and the
debug-transcript dialog use it. Behaviour is unchanged; `onChange`
becomes `onCheckedChange`.
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown

Preview environment deployed 🚀

Service URL
Marketing / blog / docs https://thunderbolt-pr-1278.preview.thunderbolt.io
App https://app-pr-1278.preview.thunderbolt.io
API https://api-pr-1278.preview.thunderbolt.io
Keycloak https://auth-pr-1278.preview.thunderbolt.io
PowerSync https://powersync-pr-1278.preview.thunderbolt.io

Stack: preview-pr-1278 · Commit: b435ee9bb1c50d91213742b9a3152de58ecc3fd7

Auto-destroys on PR close/merge. Login via the bundled Keycloak realm — demo@thunderbolt.io / demo by default.

@github-actions

Copy link
Copy Markdown

PR Metrics

Metric Value
Lines changed (prod code) +511 / -45
JS bundle size (gzipped) 🟢 643.2 KB → 643.4 KB (+163 B, +0.0%)
Test coverage 🟢 82.07% → 82.10% (+0.0%)
Performance (preview) Preview not ready — Render deploy may have timed out
Accessibility
Best Practices
SEO

Updated Mon, 14 Sep 2026 01:14:39 GMT · run #3019

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔭 thunder-deep-review (advisory)

Reviewed the diff — no issues to report. ✅ Never approves, never requests changes, never gates merge.
head: b435ee9bb1c5 · mode: deep · deferred 0 item(s) already reported by other bots (best-effort dedup)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant