How to Test Migration Recipes

To test migration recipes, use the following mach command:

./mach fluent-migration-test python/l10n/fluent_migrations/bug_1485002_newtab.py

This will analyze your migration recipe to check that the migrate function exists, and interacts correctly with the migration context. Once that passes, it clones gecko-strings into $OBJDIR/python/l10n, creates a reference localization by adding your local Fluent strings to the ones in gecko-strings. It then runs the migration recipe, both as dry run and as actual migration. Finally it analyzes the commits, and checks if any migrations were actually run and the bug number in the commit message matches the migration name.

It will also show the diff between the migrated files and the reference, ignoring blank lines.

You can inspect the generated repository further by looking at

ls $OBJDIR/python/l10n/bug_1485002_newtab/en-US

Caveats

Be aware of hard-coded English context in migration. Consider for example:

ctx.add_transforms(
        "browser/browser/preferences/siteDataSettings.ftl",
        "browser/browser/preferences/siteDataSettings.ftl",
        transforms_from(
"""
site-usage-persistent = { site-usage-pattern } (Persistent)
""")
)

This Transform will pass a manual comparison, since the two files are identical, but will result in (Persistent) being hard-coded in English for all languages.