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

bugfix: update no longer tries to put non-test watches into the namespace #4454

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

mitchellwrosen
Copy link
Member

Overview

Fixes #4438

Implementation notes

update no longer tries to put all terms found in a Unison file into the namespace: just those that either don't have a watch kind, or those whose watch kind is "test".

Test coverage

Transcript included.

Loose ends

The same bug still exists in add and update.old. Fixing it in update unfortunately didn't fix it over there for free.

goTerm (_, r, Nothing, tm, tp) = putTerm c r tm tp
goTerm (_, r, Just WK.TestWatch, tm, tp) = putTerm c r tm tp
goTerm _ = pure ()
goTerm (_, r, wk, tm, tp) = when (WK.watchKindShouldBeStoredInDatabase wk) (putTerm c r tm tp)
Copy link
Member Author

Choose a reason for hiding this comment

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

refactor, no change in behavior

in [ BranchUtil.makeAnnihilateTermName split,
BranchUtil.makeAddTermName split (Referent.fromTermReferenceId ref) Map.empty
]
& foldMap \(var, (_, ref, wk, _, _)) ->
Copy link
Member Author

Choose a reason for hiding this comment

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

this is the bugfix. before, we didn't look at wk. now, we do.

where
terms = keysToNames $ UF.hashTermsId tuf
terms =
UF.hashTermsId tuf
Copy link
Member Author

Choose a reason for hiding this comment

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

there was a similar issue here in just extracting type/term names; I'm not sure if it directly contributed to the crash, but we simply don't want watches that aren't "test" watches here, either.

@mitchellwrosen mitchellwrosen marked this pull request as ready for review November 30, 2023 21:40
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.

Nice!

@aryairani aryairani merged commit 3345055 into trunk Nov 30, 2023
@aryairani aryairani deleted the 23-11-30-fix-watch-update-bug branch November 30, 2023 22:27
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.

SqliteQueryException in UCM when running 'update' with only watch expressions in scratch.u
2 participants