Skip to content

Fix P2 bug batch (14 issues, one commit each) - #4604

Closed
alvynabranches wants to merge 15 commits into
mozilla:mainfrom
alvynabranches:fix/p2-bugs
Closed

alvynabranches wants to merge 15 commits into
mozilla:mainfrom
alvynabranches:fix/p2-bugs

Conversation

@alvynabranches

Copy link
Copy Markdown

Fixes #2260
Fixes #2284
Fixes #2562
Fixes #3596
Fixes #3601
Fixes #3612
Fixes #3621
Fixes #3500
Fixes #4183
Fixes #3831
Fixes #4053
Fixes #4206
Fixes #4540

One commit per issue plus a ruff style commit. All Python files pass ruff check and ruff format --check (ruff 0.16.1, repo-pinned).

Notes:

alvynabranches and others added 15 commits October 12, 2026 00:04
On POST /translations/approve/ 500, wrapFetch returns {} with no
status/translation. The hook still dispatched updateEntityTranslation
with undefined, wiping the current translation and (in older array-based
code) crashing useTranslationStatus with "tx is undefined".

Only dispatch entity updates on success (results.status), matching the
guard already used in useSendTranslation. Success with translation=null
(no active translation left) still clears to undefined correctly.

Fixes mozilla#3612
parse_entry() only returns the first entry and silently drops trailing
Junk, so translations like 'key = value<newline>[foo]' passed validation
and later failed sync with 'Expected an entry start'.

Validate the full resource with parser.parse() and require exactly one
Message/Term. Surface Junk annotation messages, report multiple entries
as a single-entry error.

Fixes mozilla#3621
Regenerating .po files from scratch dropped headers present only in
target files, e.g. X-WagtailLocalize-TranslationID required by
wagtail-localize. Merge any existing X- headers (outside the trim list)
from the previous target file before serializing.

Fixes mozilla#3596
Forced syncs rewrite all locales, but git only commits byte-differing
files. Counting every rewrite inflated messages (122 localizations for
2 files/1 locale) and entity-only translator matching credited stale
authors across locales.

- Serialize to string and skip unchanged files before counting.
- Track (entity_id, locale_id) pairs for Co-authored-by attribution.
Concurrent approve/sync could elect different active translations,
violating the entity_locale_active unique constraint and aborting sync.

Wrap reset in transaction.atomic with select_for_update, clear any
duplicate active rows, and activate via queryset update inside the same
transaction instead of instance save.

Fixes mozilla#2284
Syncing en-US/en/templates as a target locale corrupts stats and
violates base_locale check constraints, wiping the Resources tab.

Filter source codes from locale_map with a warning instead of crashing.

Fixes mozilla#2260
The Terminology project is DB-only (sync_disabled), so sync's
notify_users() never ran for it and new terms triggered no
new_string notifications.

Reuse notify_users() after term creation (new localizable terms,
becoming-localizable, and text changes creating new entities).
Notifications are best-effort and never break term saves. create_entity
now returns (entity, created) and keeps self.entity_id in sync.

Fixes mozilla#2562
Entities are keyed by (resource path, key), so a move obsoletes the old
row and creates a new one, orphaning translations, change markers and
stats. Match added entities to just-obsoleted ones by exact key and
string, re-pointing non-rejected translations (pk unchanged, so
comments, checks and TM follow) and carrying ChangedEntityLocale markers.
Ambiguous keys are skipped. Also abort syncs that would obsolete >100
entities and >75% of rows, rolling back the atomic transaction instead
of mass-deleting metadata.
moz.l10n collapses a select nested inside another select with the same
selector, dropping outer text of inner variants. Detect such entries
with fluent.syntax and preserve stored value/properties/string instead
of persisting corruption; warn once per resource. New entries are stored
as-is with a warning and heal on force resync after the library fix.
- checks: trailing Junk line and multiple entries are blocking errors.
- sync formats: nested same-selector detection helper cases.
Use Pontoon <no-reply@pontoon.mozilla.com> as default sender, add
do-not-reply footer to transactional and verification emails, and point
the disabled-account contact link at pontoon-team@mozilla.com instead of
the no-reply address.

Fixes mozilla#3831
Custom LOGGING wiped Django's default django.request logger, so 500s
from broken allauth config (e.g. missing SocialApp table) were silent.

Restore django.request ERROR logger and allauth INFO logger on console
with verbose formatter, and log exceptions in provider_login_url with
provider id for diagnosability.

Fixes mozilla#4053
Apply WIP contrast patch (stronger control borders, placeholders,
tooltip surfaces, status palette without -alt variants, single focus
indicator). Based on attached WIP by flodolo, with profile.css hunk
adapted to current main.

Fixes mozilla#4206
POST /api/v2/comments/translations/ with {translation, content} creates
a translation comment as the authenticated user (PAT or session),
sanitizes HTML, logs COMMENT_ADDED, and sends comment notifications,
mirroring the UI add-comment flow for LLM-based LQA.

Fixes mozilla#4540
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment