Skip to content

refactor(data): migrate translate data to v2 cache/preference/dataapi architecture#13264

Draft
EurFelux wants to merge 8 commits intov2from
refactor/v2/translate-data
Draft

refactor(data): migrate translate data to v2 cache/preference/dataapi architecture#13264
EurFelux wants to merge 8 commits intov2from
refactor/v2/translate-data

Conversation

@EurFelux
Copy link
Collaborator

@EurFelux EurFelux commented Mar 6, 2026

What this PR does

Before this PR:
Translate-related data (page state, preferences, history) was stored in Redux (v1 data layer) with no v2 equivalents defined.

After this PR:
Translate data is fully classified and migrated to the v2 data architecture:

  • Cache: Translate page state (source/target language, input text, etc.) added to cacheSchemas.ts
  • Preference: Translate preferences (default languages, service provider) added to preferenceSchemas.ts
  • DataApi: New translate_history SQLite table with Drizzle ORM schema and migration

Why we need it and why it was done in this way

This is part of the ongoing v2 data layer migration (Redux → Cache/Preference/DataApi). Translate data was one of the remaining pieces that needed to be classified and migrated.

The following tradeoffs were made:

  • Translate history is stored in SQLite (DataApi) rather than Cache, since it is critical business data that should persist across sessions.
  • Page-level UI state (current selections, input text) uses Cache as it is ephemeral and can be safely lost.

The following alternatives were considered:
N/A — this follows the established v2 data classification pattern.

Breaking changes

None. This PR only adds new schemas and types; no existing functionality is modified.

Special notes for your reviewer

  • The classification.json and target-key-definitions.json updates reflect the data classification tooling output.
  • Migration mapping in PreferencesMappings.ts is updated to support translate preference migration from v1.
  • One unused import removed from src/renderer/src/store/translate.ts.

Checklist

Release note

NONE

EurFelux added 8 commits March 6, 2026 16:44
Add SQLite schema for custom translate languages with unique langCode
constraint.
Include migration logic to transfer data from Dexie export to new table.
- Remove translate state from renderer persist cache
- Update translate preference types to use TranslateBidirectionalPair
- Regenerate preference schemas and mappings with new classification
- Update translate auto copy target key to
  feature.translate.page.auto_copy
@DeJeune DeJeune marked this pull request as ready for review March 7, 2026 10:18
@DeJeune DeJeune requested a review from a team March 7, 2026 10:18
@DeJeune DeJeune requested a review from 0xfullex as a code owner March 7, 2026 10:18
@DeJeune DeJeune marked this pull request as draft March 7, 2026 10:18
@DeJeune DeJeune added the v2 label Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants