Repository navigation
Update to moz.l10n 0.13, migrating all Fluent messages with selectors - #4351
Conversation
|
The tests are failing. |
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
mathjazz
left a comment
There was a problem hiding this comment.
Left a few comments in the migration, the rest looks good.
Also, do the following messages not need a migration?
platform-note = Platform: { PLATFORM() }
item-count = { NUMBER($n) } items| for e in value_entities: | ||
| msg = fluent_parse_entry(e.string) | ||
| e.value = message_to_json(msg.value) | ||
| Entity.objects.bulk_update(value_entities, ["value"]) |
There was a problem hiding this comment.
Worth adding batch_size here in line 36, too? If not else for 3rd party users.
There was a problem hiding this comment.
Eh, the actual entity counts here will all fit into a single batch, but there's no harm either.
| # The `?` JSON operator is not directly supported by Django | ||
| value_entities = Entity.objects.raw(""" | ||
| SELECT * FROM base_entity e | ||
| JOIN base_resource r ON r.id = e.resource_id | ||
| WHERE r.format = 'fluent' AND e.value ? 'decl' | ||
| """) |
There was a problem hiding this comment.
There's has_key:
| # The `?` JSON operator is not directly supported by Django | |
| value_entities = Entity.objects.raw(""" | |
| SELECT * FROM base_entity e | |
| JOIN base_resource r ON r.id = e.resource_id | |
| WHERE r.format = 'fluent' AND e.value ? 'decl' | |
| """) | |
| Entity.objects.filter(resource__format="fluent", value__has_key="decl"). |
|
|
||
| operations = [ | ||
| migrations.RunPython( | ||
| reparse_multi_pattern_fluent, reverse_code=reparse_multi_pattern_fluent |
There was a problem hiding this comment.
Any chance 0.12 can load the 0.13-shaped JSON?
Then a code-only rollback is safe without touching the data and we can use migrations.RunPython.noop for the reverse migration.
There was a problem hiding this comment.
moz-l10n 0.12 is fine loading messages parsed by 0.13, but it'll serialize them wrong -- we'll get NUMBER() wrappers in every select message. So if this needs a rollback, it does need to be run with moz-l10n 0.12.
|
Thanks. Could you please address this one?
|
Ah, sorry for missing that! Such messages don't need a migration because they don't exist in any active message. We never use Or is your concern about non-Mozilla Pontoon users? If so, then we're going to need to make the migration quite a bit more inclusive to ensure we catch everything. Should we? |
Ah, thanks for clarifying. Leaving the decision to you. |
Fixes #4230