Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-6833: Copying empty fields during translation copying shouldn't be skipped #390

Merged
merged 2 commits into from
Jun 24, 2024

Conversation

barw4
Copy link
Member

@barw4 barw4 commented Oct 26, 2023

🎫 Issue IBX-6833

Description:

When one is copying translations using the copyTranslationsFromPublishedVersion method during publishing empty values are left out and not stored in the database which could result in entries not appearing in ezcontentobject_attribute table resulting in missing translations and broken language masks.

For QA:

Maintainer note:

Requires extensive multilingual content updating testing, ideally in multiple tabs or even by at least 2 separate editors at the same time (though for that unrelated bugs might occur). Possible regressions: EZEE-2661 but doesn't really require scheduler interaction, rather checking if translations were copied properly.

@barw4 barw4 added Bug Something isn't working Ready for review labels Oct 26, 2023
@barw4 barw4 requested a review from a team October 26, 2023 15:02
@barw4 barw4 self-assigned this Oct 26, 2023
@sonarcloud
Copy link

sonarcloud bot commented Oct 26, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@ViniTou ViniTou left a comment

Choose a reason for hiding this comment

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

I can not wrap my head around it, why storing empty values is somehow breaking our system? How it is handled when you just creating version with empty values?

Also, which of those is not enough so the isCopied flag is not set to true and you need to pass additional argument?

                } elseif (!$isFieldUpdated && $isLanguageNew && !$fieldDefinition->isTranslatable) {
                    $isCopied = true;
                }

@barw4
Copy link
Member Author

barw4 commented Oct 30, 2023

I can not wrap my head around it, why storing empty values is somehow breaking our system?

@ViniTou The problem is that they are not stored.

Also, which of those is not enough so the isCopied flag is not set to true and you need to pass additional argument?

The isCopied flag is irrelevant here. Our system fails when ($isLanguageNew && $isEmpty) === true and that's what happens if we are copying translations from published version using the copyTranslationsFromPublishedVersion method. In such case, empty value is skipped and therefore an empty field that ought to be translated is not injected into a db.

@barw4 barw4 requested review from ViniTou and a team October 30, 2023 15:08
@ViniTou
Copy link
Contributor

ViniTou commented Oct 31, 2023

Ok, then in which case (outside of copying translation) $isLanguageNew && $isEmpty is happening and storing is skipped? Like it seems that there is/was valid case for skipping empty values without breaking the system.

The isCopied flag is irrelevant here.

I know, it was more about, that maybe we can set it using some other logic to not skip adding without introducing new argument to method signature.

@barw4
Copy link
Member Author

barw4 commented Oct 31, 2023

Ok, then in which case (outside of copying translation) $isLanguageNew && $isEmpty is happening and storing is skipped? Like it seems that there is/was valid case for skipping empty values without breaking the system.

For example when we are creating a new version in a new language and we are not basing it on another translation so that values are empty.

I know, it was more about, that maybe we can set it using some other logic to not skip adding without introducing new argument to method signature.

The isCopied flag is mostly used for non-translatable fields so I cannot see how would it help in this case:

 elseif (!$isFieldUpdated && $isLanguageNew && !$fieldDefinition->isTranslatable) {
                    $isCopied = true;
                }

@barw4 barw4 force-pushed the ibx-6833-do-not-skip-empty-fields-during-update branch from 413b7c6 to 1d54c9b Compare May 8, 2024 11:45
@barw4 barw4 requested review from alongosz and a team May 8, 2024 11:45
Copy link

sonarcloud bot commented May 8, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@barw4 barw4 requested review from Nattfarinn and a team May 24, 2024 07:59
Copy link
Contributor

@webhdx webhdx left a comment

Choose a reason for hiding this comment

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

It's quite a drastic change and we definitely need a solid QA round here to detect possible side effects. I also feel like fields were skipped for a reason but adding them anyway seems like a reasonable solution to keep data integrity.

@webhdx webhdx requested a review from a team June 14, 2024 08:18
Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

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

After digging into this deeper, I don't see any apparent issues with this change, though there might be some unforeseen side-effects. Indeed we need to vary that internal method based on either content update or copying fields during publishing, which reuses that method.

Probably more refactoring would be better suited now that we know these operations are actually not the same, but this - what @barw4 did now - seems like the simplest way to achieve it.

I've updated PR description with some extra tips for QA to investigate.

@alongosz alongosz requested a review from a team June 19, 2024 13:42
@barw4 barw4 force-pushed the ibx-6833-do-not-skip-empty-fields-during-update branch from 081032f to 3d412b6 Compare June 19, 2024 13:56
Copy link

sonarcloud bot commented Jun 19, 2024

Copy link

@tomaszszopinski tomaszszopinski left a comment

Choose a reason for hiding this comment

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

QA approved on Ibexa DXP oss 3.3.x-dev

@alongosz alongosz merged commit 17e78be into 1.3 Jun 24, 2024
23 checks passed
@alongosz alongosz deleted the ibx-6833-do-not-skip-empty-fields-during-update branch June 24, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working QA approved
Development

Successfully merging this pull request may close these issues.

9 participants