Skip to content

fix upload warnings marked as translated - #4652

Open
baha-bouali wants to merge 3 commits into
mozilla:mainfrom
baha-bouali:fix-4625-upload-warnings
Open

baha-bouali wants to merge 3 commits into
mozilla:mainfrom
baha-bouali:fix-4625-upload-warnings

Conversation

@baha-bouali

Copy link
Copy Markdown
Contributor

Fixes #4625

Cause

update_db_translations() returns (created, approved_suggestions), but write_db_updates() recieved them in the reverse order, as (updated_translations, new_translations). As a result, add_failed_checks() only received the approved suggestions: newly created translations never had their warnings stored, so they showed as Translated instead of Warnings.

This affects both callers of write_db_updates(): translation uploads and repository sync.

Changes

  • update_db_translations() now returns the lists in the order the caller expects, so the names match the intended contents.
  • add_failed_checks() now receives both lists. Approved suggestions were already checked (by accident); checking only the new translations would have dropped that.

Tests

Added regression tests:

  • test_upload_translations_stores_missing_placeholder_warning
  • test_upload_translations_approved_suggestion_stores_warning: an upload matching an existing suggestion re-approves it and keeps its warning.
  • test_ftl_translations_failed_checks: a translation imported from the repository keeps its warning.

@baha-bouali

Copy link
Copy Markdown
Contributor Author

Here is the Before/After GUI proof:

warningsProof.webm

@mathjazz mathjazz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking this down! The fix and the tests look good.

The swap seems to go back to the sync refactor (#3312), so new translations from sync and uploads haven't been checked since then. Since this has been happening for a while, existing translations created by sync or upload still lack their warnings and errors.

We need to re-check those separately.

ActionLog.objects.bulk_create(actions)

return created, list(suggestions.values())
return list(suggestions.values()), created

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Since both helpers in write_db_updates() now get new_translations + updated_translations, the split return isn't needed anymore. Returning a single list (or a NamedTuple) would rule out this kind of swap in the future. Fine to leave as is, though.

@baha-bouali baha-bouali Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed to a single list. all tests passed and the behaviour should remain unchanged

@mathjazz mathjazz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, looks good!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upload: Translations with Warnings show up as Translated in the translate view

2 participants