Translated strings marked as Has been translated, gets empty, translation seen in history
Hey! We experience an issue that is looking very similar to #3717. We had it on 3.10, so we hoped that it will be fixed after upgrading to 4.0.4, but it still there.
Describe the bug
Already translated strings become empty, marked as not translated. At the same time, Has been translated warning is shown, and we can clearly see the original translation in history.

The flow that seems to lead to that behavior (but we are not sure yet) is next:
- New strings added to translate (via Add new translation string in the web interface)
- These strings get updated by translators
- New strings added after that
- Those previously translated strings go to broken state (already translated, and empty)
Also, there was a manual file upload for one of the languages (not affected by the issue) around that time. I wonder if this could be somehow related?
UPD Just noticed that all strings from this uploaded file now replaced with empty strings too:

UPD2 Tried to reupload the file again twice: on first try it wasn't uploaded at all even if it said that upload is successful the strings keep unchanged (empty). The second time it was uploaded but now most of strings are marked as failing checks, however no error is shown:
Both times using Replace file option.
Please let me know what debug information, logs, additional info I can provide to help track the issue.
Additional info
Our translation files are JSON.
* Weblate: 4.0.4
* Django: 3.0.6
* siphashc: 1.3
* Whoosh: 2.7.4
* translate-toolkit: 2.5.1
* lxml: 4.3.2
* Pillow: 7.1.2
* bleach: 3.1.5
* python-dateutil: 2.8.1
* social-auth-core: 3.3.3
* social-auth-app-django: 3.1.0
* django-crispy-forms: 1.9.0
* oauthlib: 3.1.0
* django-compressor: 2.4
* djangorestframework: 3.11.0
* django-appconf: 1.0.4
* user-agents: 2.1
* filelock: 3.0.12
* setuptools: 40.8.0
* jellyfish: 0.7.2
* openpyxl: 3.0.1
* celery: 4.4.2
* kombu: 4.6.8
* translation-finder: 2.0
* html2text: 2020.1.16
* pycairo: 1.16.2
* pygobject: 3.30.4
* diff-match-patch: 20181111
* requests: 2.23.0
* django-redis: 4.11.0
* hiredis: 1.0.1
* sentry_sdk: 0.14.3
* Cython: 0.29.17
* misaka: 2.1.1
* GitPython: 3.1.2
* borgbackup: 1.1.11
* Python: 3.7.3
* Git: 2.20.1
* psycopg2: 2.7.7
* phply: 1.2.5
* chardet: 3.0.4
* ruamel.yaml: 0.16.10
* tesserocr: 2.5.1
* akismet: 1.1
* boto3: 1.13.4
* zeep: 3.4.0
* aeidon: 1.7.0
* Mercurial: 5.4
* git-svn: 2.20.1
* git-review: 1.28.0
* Database backends: django.db.backends.postgresql
* Cache backends: default:RedisCache, avatar:FileBasedCache
* Email setup: django.core.mail.backends.smtp.EmailBackend: smtp.yandex.com
* OS encoding: filesystem=utf-8, default=utf-8
* Celery: redis://cache:6379/1, redis://cache:6379/1, regular
* Platform: Linux 4.15.0-74-generic (x86_64)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Also, there's starting to appear such errors here and there:
This one appeared when trying to create a new string.
On the second try, the string created successfully.
Can you also check what is in the files? Is the string properly saved there or it's missing?
@nijel in the files those strings become empty:

When the string is not translated, it is not shown in the files at all (as expected). With this issue, they were shown, but empty.
Can please you do a little of testing?
- Force commit of the problematic file
- Check that the repository contains empty strings now
- Edit the string
- Force commit of the problematic file
- Check that the repository contains translated string now
Also, please look into the logs for errors while committing changes.
There's no exact 'problematic' file, the problem previously occurred on all files that were edited recently by translators.
By the way, since the last time, we haven't experienced the problem. I wonder if this could be related to the fact we started manually commit changes to the local repository (from the repository maintenance page) from time to time now - generally, before adding new strings.
Also, not sure how we should look into logs, is it possible only with external services?
For the logs, see https://docs.weblate.org/en/latest/contributing/debugging.html#weblate-logs
But I think I've identified cause of your problem. There really seems to be a bug which can cause some loss in case of adding new strings.
Thank you for your report, the issue you have reported has just been fixed.
- In case you see a problem with the fix, please comment on this issue.
- In case you see a similar problem, please open a separate issue.
- If you are happy with the outcome, consider supporting Weblate by donating.
Great to hear it, thanks! Looking forward to 4.1