phrase / phrase-cli

CLI for the Phrase API
https://developers.phrase.com
MIT License
42 stars 6 forks source link

phrase push with cleanup doesn't work with several sources #147

Open vollmond08 opened 4 months ago

vollmond08 commented 4 months ago

Good morning, can you help me, please? Regarding these PRs: https://github.com/phrase/phrase-cli/issues/22 https://github.com/phrase/openapi/pull/518

Looks like if I have project with several sources then phrase push --wait --cleanup should work, but it doesn't.

phrase push --wait --cleanup
Uploading translations/test1/translations.en.json...
Upload Id: 2c5ec14fab35d2d0a9e89ef3a14c471f, filename: translations.en.json succeeded. Waiting for your file to be processed...
Successfully uploaded and processed translations/test1/translations.en.json.
Following key(s) are about to be deleted from your project:
spa.test2.footer1
1 key(s) successfully deleted.

Uploading translations/test2/translations.en.json...
Upload Id: c33f5f4e0f52dd44b2b820f4a58587da, filename: translations.en.json succeeded. Waiting for your file to be processed...
Successfully uploaded and processed translations/test2/translations.en.json.
Following key(s) are about to be deleted from your project:
spa.test1.header1
1 key(s) successfully deleted.

For testing purposes I created project with 2 sources. So first uploading doesn't wait for second uploading and deletes spa.test2.footer1 key but shouldn't because it still needed in second source. @jablan mention you, hope you don't mind

jablan commented 4 months ago

hey @vollmond08 thanks for reporting, just checked the code, and you are right, the cleanup works only in the scope of a single source. I will open an internal ticket to address this. can't say when it will be done yet.

vollmond08 commented 4 months ago

thanks a lot, will be waiting for resolving or new info

ajayktrada commented 3 months ago

HI team,

We are also facing an issue with this behavior.

When we define multiple sources in the same config file and try to do a cleanup, it deletes keys from every source file and keeps those present in the last source file.

The reason behind this is that phrase push cleanup generates individual upload IDs for each source file mentioned config.

We should introduce a kind of flag that creates only one upload ID per config file; in that case, it won't delete the keys from other source files.