[#72881] Handle generated Crowdin conflicts in release-to-dev merges#22249
[#72881] Handle generated Crowdin conflicts in release-to-dev merges#22249
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an automated, conservative 3-way YAML merge helper to reduce manual conflict resolution when release→dev merges conflict only in generated Crowdin locale files, and integrates it into the existing release-to-dev merge PR workflow and docs.
Changes:
- Introduce
OpenProject::GeneratedLocaleConflictMergerwith safe 3-way YAML merge logic for generated Crowdin locale conflicts. - Add a runnable helper script (
script/i18n/merge_generated_locale_conflicts) and RSpec coverage for common conflict scenarios. - Update the
create-merge-release-into-dev-prworkflow and developer docs to use/describe the helper duringmerge-release/...conflict resolution.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
lib/open_project/generated_locale_conflict_merger.rb |
Implements conservative 3-way YAML merge for conflicted generated locale files and stages safe resolutions. |
script/i18n/merge_generated_locale_conflicts |
Adds a CLI entrypoint to run the merger locally/CI. |
spec/lib/open_project/generated_locale_conflict_merger_spec.rb |
Covers merge behavior for key scenarios (one-side change, nested merge, scalar conflict, invalid YAML, missing stages, mixed conflicts). |
docs/development/git-workflow/README.md |
Documents how to use the helper when resolving merge-release/... branches locally. |
.github/workflows/create-merge-release-into-dev-pr.yml |
Runs the helper during merge-conflict handling and annotates PR body with outcome. |
You can also share your feedback on Copilot code review. Take the survey.
36da46e to
bf214c5
Compare
bf214c5 to
feb4575
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
You can also share your feedback on Copilot code review. Take the survey.
9058168 to
c746cc7
Compare
2d1f69a to
07ea65e
Compare
NobodysNightmare
left a comment
There was a problem hiding this comment.
I like the new version of the code much more. By now I might be biased, because I read it once before, but it was much easier for me to get into the Merger class and navigate between methods when I had questions about how something worked.
I left some additional feedback, but nothing blocking from my side.
52bf929 to
8991582
Compare
8991582 to
735bb76
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
You can also share your feedback on Copilot code review. Take the survey.
b36c094 to
945b7cd
Compare
|
@toy I've tried to address all your comments. Please take another look! |
Adds `GeneratedLocaleConflictMerger` to handle generated Crowdin locale conflicts in the `create-merge-release-into-dev-pr` workflow. The helper reads Git merge stages, performs a recursive three-way YAML merge for hash-shaped locale data under crowdin paths, and prefers the dev side when both branches changed the same leaf. Files are left unresolved when the merged result differs from all raw stages (avoiding YAML reserialization churn), or when YAML cannot be parsed safely. Wires the helper into the workflow so that locale-only conflicts are resolved automatically. When non-locale conflicts remain, the merge is aborted and the PR body notes manual resolution is needed. Adds a `script/i18n/merge_generated_locale_conflicts` entry point for local use and documents the workflow in the git-workflow README.
945b7cd to
e8d4069
Compare
|
@toy some discussion points before final review/merge:
tl;dr I think this a step in the right direction, but I think we should revisit and possibly simplify. |
Ticket
https://community.openproject.org/wp/72881
Summary
Goal: Reduce manual conflict resolution work when
create-merge-release-into-dev-propens a PR for merging the latestrelease/*branch intodev.This adds a helper that handles generated Crowdin locale conflicts on the temporary
merge-release/...branch and wires it into the workflow. It also documents the same helper for developers resolving those branches locally.Why this approach
Although Crowdin locale files are generated artifacts, they are generated independently on
devand release branches. A three-way merge preserves non-overlapping generated changes without blindly taking one side when both branches changed the same translation entry differently. Later Crowdin runs can still normalize the files, but this reduces manual conflict work without discarding valid branch-specific generated output..gitattributeswould apply globally, but this behavior is specific to the release-to-dev maintenance workflow. Keeping it in the workflow/helper makes the automation targeted and easier to reason about.What changed
OpenProject::GeneratedLocaleConflictMergerscript/i18n/merge_generated_locale_conflictscreate-merge-release-into-dev-prto run the helper on the PR branch pathMerge behavior
The helper only touches unresolved files matching
**/config/locales/crowdin/*.yml(i.e.config/locales/crowdin/*.ymlandmodules/*/config/locales/crowdin/*.yml).It:
devside when both branches changed the same leaf differentlygit rmwhen deletion is the correct safe resultOnly expected merge failures (invalid YAML, non-hash top-level, no matching raw stage) are caught via
MergeError. Git plumbing errors and other unexpected failures propagate as real errors rather than being silently treated as unresolved files.Files outside the generated Crowdin locale paths are left alone. If conflicts remain after running the helper, they still require manual resolution.
Workflow integration
After
git mergefails, the workflow follows one of four paths:Merge checklist
config/locales/crowdin/ru.ymlandmodules/backlogs/config/locales/crowdin/ru.yml)