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

feat: better merge algorithm #4910

Merged
merged 175 commits into from May 16, 2024
Merged

feat: better merge algorithm #4910

merged 175 commits into from May 16, 2024

Conversation

mitchellwrosen
Copy link
Member

@mitchellwrosen mitchellwrosen commented Apr 30, 2024

This PR contains the MVP / minimal thing / version 0 of the new merge algorithm.

See merge.output.md for an overview of its behavior.

In summary, we diff namespaces based on "syntactic hashes" in which a pretty-print environment renders references before hashing. This is the mechanism by which we distinguish "user changes" from auto-propagated changes.

There are a number of different preconditions that each namespace (and their LCA) must satisfy before we can attempt a merge, such as having no conflicted names, and having exactly one properly-placed name for each constructor of a particular naming of a data declaration. See the above transcript for more details.

A couple outstanding things:

And a note about the code quality:

  • Whoops, a lot of stuff is still badly organized and badly documented. Some helper functions and variables are probably still called honk, bonk, and perhaps oink. However, none of it was feeling like it should block the review of this PR. I plan to continue to refine things in the upcoming days.

Tip: Use `merge /topic1 /main` to merge your work back into
the main branch.
Tip: To merge your work back into the main branch, first
`switch /main` then `merge /topic1`.

foo/main> branch /topic2

Done. I've created the topic2 branch based off of main.
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated issue, but maybe we want to use the slash syntax here too?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so; the slash isn't part of the branch name. Maybe that's also an argument against using it in the "I merged /bob into /alice" output message 🤔

& UF.hashTermsId
& Map.toList
& mapMaybe \(var, (_, ref, wk, _, _)) -> do
guard (WK.watchKindShouldBeStoredInDatabase wk)
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this guard about?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's keeping only these:

foo = ...

test> bar = ...

but not

> hey

nor

wat> x = ...

@mitchellwrosen mitchellwrosen marked this pull request as ready for review May 6, 2024 16:33
mitchellwrosen and others added 2 commits May 9, 2024 14:43
Co-authored-by: Arya Irani <538571+aryairani@users.noreply.github.com>
Co-authored-by: Arya Irani <538571+aryairani@users.noreply.github.com>
@aryairani aryairani modified the milestone: ucm 0.5.20 May 9, 2024
Copy link
Contributor

@aryairani aryairani left a comment

Choose a reason for hiding this comment

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

I still owe a more detailed review later, but this is at least great and I wanna avoid more merge conflicts

@aryairani aryairani merged commit 05b941c into trunk May 16, 2024
19 checks passed
@aryairani aryairani deleted the topic/merge4 branch May 16, 2024 12:18
@pchiusano
Copy link
Member

Yay!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants