Clean up apps with empty names or empty descriptions

RESOLVED WONTFIX

Status

Marketplace
General
P4
normal
RESOLVED WONTFIX
5 years ago
2 years ago

People

(Reporter: mat, Unassigned)

Tracking

Points:
---
Dependency tree / graph

Details

(Whiteboard: [marketplace-transition])

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
We have a few hundred apps in production that have empty descriptions or empty name in some locale (usually english) because of bug 891376, bug 894563, and bug 888831 which have since been fixed.

This can cause the developers or admins to be unable to edit basic details for these apps, as long as bug 896466 is not fixed.

We need to come up with a way of removing those empty Translations. We need to be careful though, not to remove Translations, even if they are empty, if they are the only Translation for that field for each affected app.

I ran different queries to check, and it appears that we have (in remora at least, so possibly more in production):
- 286 non-deleted apps with empty descriptions. Of those, many are disabled or not public. If we only consider public ones, that drops to 104. 
- 82 non-deleted apps with empty names. If we only consider public non-disabled ones, that drops to 49.

(There is some possible overlapping between the 2 lists)

I'll come up with the SQL query to clean them up. This is something that I prefer to check manually instead of automating, we need to be extra careful about what we delete.
(Reporter)

Updated

5 years ago
Blocks: 902057
Created attachment 786908 [details]
output.txt

apps with an empty description that are public or queued on prod
(Reporter)

Updated

5 years ago
Priority: -- → P2
(Reporter)

Comment 2

5 years ago
It's more difficult I thought, because of the way our translations are set up.

We are using a MySQL InnoDB "feature" that allows you to have a Foreign Key Constraint pointing to a non-unique field. Because of this, you can DELETE (or UPDATE the id of) translation rows, even if there are other translations in other languages for the same id. The only ways to delete the problematic rows is to:
a) Disable constraint checking before doing it, using django.db.connection.constraint_checks_disabled context manager in python, or SET FOREIGN_KEY_CHECKS = 0 in SQL
b) Set the field on the addon to NULL before deleting the translation and then back to the correct id

The method a) is probably the best, although it scares me to disable foreign key checks, even in a specific script.
(Reporter)

Comment 3

5 years ago
Turns out it's even more difficult than I thought yesterday, and things already looked pretty grim then.

I have a branch here that almost works: https://github.com/diox/zamboni/tree/delete-translations

I say "almost" because there is another problem: when we fetch translations for a model, we only consider 2 locales: 1) the current_language and 2) the model's get_fallback() method (which, for apps, is their default_locale). 

Therefore, depending on the translation you try to delete you might end up with an empty result when fetching the corresponding model later, just because our code only fetches translations in those 2 locales. I'm not sure how to fix it, so I'm stuck here for now.

Comment 4

5 years ago
Sounds like we should put the site into read-only mode (there's a bug for that) before we make this change, yes?
(Reporter)

Comment 5

5 years ago
Yep. I do hope that the fallback mechanism won't get in the way: If most of the concerned apps have a default_locale set to something other than the locale their empty translations is, it'll be fine. If not, then we'll be unable to remove the translation, and might have to work on a case by case basis to fix them.
Priority: P2 → P3
(Reporter)

Comment 6

4 years ago
I merged https://github.com/mozilla/zamboni/commit/b5fd0309cc3683f84eb3d26c5d862b5f4ac9bd6e to allow us to delete individual Translations.

The issue mentioned in comment 3 is still there, though, but at least we made some progress...
Depends on: 983749
(Reporter)

Updated

4 years ago
Priority: P3 → P4
(Reporter)

Updated

2 years ago
Assignee: mpillard → nobody

Updated

2 years ago
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WONTFIX
Whiteboard: [marketplace-transition]
You need to log in before you can comment on or make changes to this bug.