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

add handling for irresolvable conflicts #4939

Merged
merged 9 commits into from
Nov 19, 2024

Conversation

ajtmccarty
Copy link
Contributor

@ajtmccarty ajtmccarty commented Nov 15, 2024

PR is too big, sorry

going to save some remaining changes for a follow-up PR

add the ability to mark certain diff conflicts as irresolvable. right now, this is all node-level delete conflicts. for example, if I delete a node on main and update it on branch, we will block merging until the conflict is resolved manually, either by deleting the node on branch or undoing the changes on branch

this required some changes to DiffCombiner and DiffConflictsEnricher and some new tests b/c they were not correctly handling a manual undo of a conflict in some cases

@github-actions github-actions bot added the group/backend Issue related to the backend (API Server, Git Agent) label Nov 15, 2024
Copy link

codspeed-hq bot commented Nov 15, 2024

CodSpeed Performance Report

Merging #4939 will not alter performance

Comparing ajtm-11142024-irresolvable-conflicts (be716c3) with develop (636a71e)

Summary

✅ 10 untouched benchmarks

@ajtmccarty ajtmccarty force-pushed the ajtm-11142024-irresolvable-conflicts branch from 39530fc to df49784 Compare November 18, 2024 18:09
@ajtmccarty ajtmccarty marked this pull request as ready for review November 19, 2024 02:11
@ajtmccarty ajtmccarty requested a review from a team November 19, 2024 02:11
@@ -18,6 +18,7 @@ async def calculate_diff(
diff_branch: Branch,
from_time: Timestamp,
to_time: Timestamp,
is_first_diff: bool = False,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the is_first_diff and include_unchanged args are used to keep UNCHANGED values around until a little later in the diff incremental calculation process where they are used for setting previous values

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the changes in here are to exclude diff elements that have been reset to the pre-branch values

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the changes in here are to remove conflicts from nodes that are not in the diff for the base branch b/c if the diff element is not in the base diff, then it has not changed or it has been reset to its pre-diff value

Copy link
Contributor

@ogenstad ogenstad left a comment

Choose a reason for hiding this comment

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

Nice work!

@@ -62,8 +63,8 @@ async def calculate_diff(
await base_diff_query.execute(db=self.db)
for query_result in base_diff_query.get_results():
diff_parser.read_result(query_result=query_result)

diff_parser.parse()
include_unchanged = not is_first_diff
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big deal but was thinking if is_first_diff could be worded differently so that we avoid this double negative situation here. Seems like it's mostly used in this location.

)
combined_relationships.add(combined_relationship)
combined_relationship_elements = {cre for cre in combined_relationship_elements if cre.properties}
includes_parent = self._child_parent_uuid_map.get(node_id, (None, None))[1] == later_relationship.name
Copy link
Contributor

Choose a reason for hiding this comment

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

This part looks a bit hairy, might it be cleaner to have a method that takes the node_id as input and optionally returns the secondary value of the tuple if the node exists in self._child_parent_uuid_map? "_get_parent_rel_name" or so?

@ajtmccarty ajtmccarty force-pushed the ajtm-11142024-irresolvable-conflicts branch from d76c6ba to be716c3 Compare November 19, 2024 14:38
@ajtmccarty ajtmccarty merged commit e63d63e into develop Nov 19, 2024
32 checks passed
@ajtmccarty ajtmccarty deleted the ajtm-11142024-irresolvable-conflicts branch November 19, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants