SF-3791 Create Settings.xml for resources when missing#3894
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3894 +/- ##
=======================================
Coverage 80.89% 80.90%
=======================================
Files 630 630
Lines 40657 40677 +20
Branches 6577 6602 +25
=======================================
+ Hits 32889 32909 +20
Misses 6741 6741
Partials 1027 1027 ☔ View full report in Codecov by Sentry. |
Nateowami
left a comment
There was a problem hiding this comment.
@Nateowami made 1 comment.
Reviewable status: 0 of 3 files reviewed, all discussions resolved.
src/SIL.XForge.Scripture/Services/ParatextService.cs line 2842 at r1 (raw file):
// Perform migrations, as resources may not have had all migrations run on them await MigrateResourceIfRequiredAsync(username, targetParatextId, overrideLanguageId, token);
So, am I inferring correctly that the resource does not contain Settings.xml, but does contain the information (in a different format), and when Paratext unpacks it, it runs a migration?
pmachapman
left a comment
There was a problem hiding this comment.
@pmachapman made 1 comment.
Reviewable status: 0 of 3 files reviewed, all discussions resolved (waiting on Nateowami).
src/SIL.XForge.Scripture/Services/ParatextService.cs line 2842 at r1 (raw file):
Previously, Nateowami wrote…
So, am I inferring correctly that the resource does not contain Settings.xml, but does contain the information (in a different format), and when Paratext unpacks it, it runs a migration?
Yes, that is correct.
Nateowami
left a comment
There was a problem hiding this comment.
@Nateowami reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on pmachapman).
src/SIL.XForge.Scripture/Services/ParatextDataHelper.cs line 160 at r1 (raw file):
if (fileSystemService.FileExists(oldSsfFile)) { scrText.Settings.RemoveSetting("AllowAdvancedMorphology");
I don't understand how this migration works. The comment says "rename". I would think it would require parsing settings and then saving them in a new format. I also don't know why these settings are being removed (are they allowed in .ssf files but not Settings.xml?). How was this list created?
My best guess:
- ParatextData automatically loaded settings from the .ssf file
- The settings are now in an internal representation, in the scrText
- We're removing some that aren't needed? Not sure why
- When we tell it to save, it implicitly saves to Settings.xml
- Then we can safely remove the .ssf file
I don't think I could pick this up and reason about it.
pmachapman
left a comment
There was a problem hiding this comment.
@pmachapman made 1 comment.
Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on Nateowami).
src/SIL.XForge.Scripture/Services/ParatextDataHelper.cs line 160 at r1 (raw file):
Previously, Nateowami wrote…
I don't understand how this migration works. The comment says "rename". I would think it would require parsing settings and then saving them in a new format. I also don't know why these settings are being removed (are they allowed in .ssf files but not Settings.xml?). How was this list created?
My best guess:
- ParatextData automatically loaded settings from the .ssf file
- The settings are now in an internal representation, in the scrText
- We're removing some that aren't needed? Not sure why
- When we tell it to save, it implicitly saves to Settings.xml
- Then we can safely remove the .ssf file
I don't think I could pick this up and reason about it.
I have updated the comment to be a bit clearer (hopefully). This code is a direct port of the Paratext migration MigrateProjectSettings.
Nateowami
left a comment
There was a problem hiding this comment.
@Nateowami reviewed 1 file and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on pmachapman).
This PR ensures that a Settings.xml file is present for a resource when it is installed, and will perform any required resource migrations on sync.
This change is