Repository navigation
Keep FW Lite Windows projects when the app is uninstalled - #2789
hahn-kev-bot wants to merge 2 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
| _defaultBaseDataDir = BaseDataDir; | ||
| } | ||
|
|
||
| public string BaseDataDir |
There was a problem hiding this comment.
what else is this used for now? It feels like it would be too easy to use the wrong data dir without guidance.
There was a problem hiding this comment.
Now it only holds app-local state: app.log, msal.cache, the new fw-lite-settings.json from develop, and the WebView profile. It's also where the old flat projects sit until they're migrated. Projects, media and failed syncs moved to ProjectDataDir.
Agreed it was too easy to grab the wrong one, and ProjectDataDir is a trap too: it's the intended folder, but a failed migration falls back to BaseDataDir. In 8e833c5:
- Both properties now say what they're for, and
ProjectDataDirsays to read the folder in use fromLcmCrdtConfig.ProjectPath/HarmonyConfig, never from the property. - The kernel no longer keeps a
baseDataPathlocal, so nothing invites reuse. - The two-folder layout is in
backend/FwLite/AGENTS.mdand the troubleshooting guide.
If you'd rather the name carry it, I can rename the property to something like AppStateDir and keep BaseDataDir as the config key ([ConfigurationKeyName]), so env vars, CI and settings files keep working.
MSIX installs kept projects in the package's LocalState, which Windows deletes on uninstall (#1391). Project data now lives in C:\ProgramData\SIL\FieldWorks Lite\<user>, which MSIX does not virtualize, with each project in projects\<code>\<code>.sqlite. The auth cache and logs stay in LocalState. Existing installs are migrated once at startup: each database is copied with SQLite's backup API, media paths in the copy are re-pointed at the new cache, and the copy is verified before a single directory rename makes it live. The old databases are then renamed to .sqlite.migrated so a stale copy can't sync under the same ClientId. Any failure keeps the app on LocalState and retries next start; a lease stops a second instance from migrating while another is still using LocalState. Project discovery finds both layouts, so other platforms are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BaseDataDir now only holds app-local state (logs, auth cache, settings file), and ProjectDataDir is only the intended project folder: a failed migration falls back to BaseDataDir. Say so on both properties, point code at LcmCrdtConfig.ProjectPath, and add the layout to the FwLite AGENTS.md and the troubleshooting guide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b112de0 to
8e833c5
Compare
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
AI summary
Fixes #1391 for Windows. MSIX installs kept projects in the package's
LocalState, and Windows deletes that folder on uninstall. Builds on the Harmony update in #2788 (merged).Summary
One-time migration at startup (
ProjectDataFolderMigration), resolved before any project path is used:LcmCrdtConfig.UseProjectFolders: new projects go inprojects/{code}/{code}.sqlite. Discovery always finds both layouts, and the folder wins on a duplicate code. Only Windows MSIX turns it on, so other platforms, FwLiteWeb and Platform.Bible are unchanged.FwLiteMauiConfig.ProjectDataDirdefaults to ProgramData on packaged Windows unlessBaseDataDiris overridden. Troubleshooting's "data folder" now opens the project root.Evidence
LcmCrdt.Tests):ProjectFolderLayoutTests(7) andProjectDataFolderMigrationTests(10).FwLiteDesktopTest, so no real install was touched):LocalState.Migrated 1 projects from …\LocalState to C:\ProgramData\SIL\FieldWorks Lite\<user>. The files are visible from outside the package (not virtualized), the legacy db became.sqlite.migrated, the media path was rewritten, and the log has no errors. Creating an example project in-app wroteprojects\example-project\example-project.sqlite.quick_checkok, all entries present).Merge Danger
Door: one-way, per user.
Once an install has migrated, an older build looks in
LocalState, finds only.sqlite.migratedfiles and shows no projects. The data is intact, but a rollback would need a reverse migration or manual renames.Blast Radius: Windows-MSIX.
Every MSIX user runs the migration on first start after updating.
LocalState.Test plan
dotnet test backend/FwLite/LcmCrdt.Tests --filter "FullyQualifiedName~ProjectDataFolderMigrationTests|FullyQualifiedName~ProjectFolderLayoutTests|FullyQualifiedName~OpenProjectTests|FullyQualifiedName~MediaTests"(45 pass on develop)FwLiteMaui.TestsMauiTroubleshootingServiceTests; Windows MAUI head and FwLiteWeb build🤖 Generated with Claude Code