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
Mneme fails to find the assertion AST node when performing an update #53
Comments
This happens when, for some reason, Mneme isn't able to find the node that it needs to replace in the AST for an update. I have a hunch that it may be a race condition relating to the file changing while, for instance, Mneme is paused waiting for a prompt in another file. I'll test this theory a bit later and will fix if that's the case, but I'll minimally catch this exception and print a better error with some extra debugging information for later! |
That could be it. The weird thing though is that it happened at least 2 times today while I've never had this in the past? |
Hmm... Could definitely be something that changed between v0.4.0 and v0.4.1. There was a lot of code touched, but very few (I thought) behavioral changes -- I started using elixir-styler. Would you be able to share the test that the error occurred during? This one:
|
The good news is that I was just able to recreate it while doing this:
I'll work on a fix. |
Should be fixed in v0.4.2. Note that the test run will still fail in these cases -- Mneme needs to be really conservative when the test file changes and just bail out -- but it'll now skip those tests and show a nice error at the end that looks like this:
|
@zachallaun something definitely changed in the latest version. I've got this error again, but as far as I know, I didn't change the file, but I've used both linux and mac |
@tcoopman Just to confirm -- You're still seeing the error on 0.4.2? Or you're seeing the new error message, but it still seems like something new that's happened since 0.4.0 is causing it to trigger a lot more frequently? |
It looks like something that's happening more frequently since 0.4.0 |
I have a reproduction. Notice the bad formatting: test "1" do
events =
{:ok,
[
%DomainModelling.Event{
payload: %DomainModelling.ExerciseEventsTest.QuestionAnsweredCorrectly{
id: "1",
answer: "answer",
block_id: %DomainModelling.BlockId{block: 1, page: 0}
},
type: "QuestionAnsweredCorrectly",
created_at: ~U[2023-11-01 19:46:32.254112Z],
event_id: "018b8c6c-56be-7b5b-b088-ef15c487b0ac"
}
]}
auto_assert events
end
test "2" do
events =
{:ok,
[
%DomainModelling.Event{
payload: %DomainModelling.ExerciseEventsTest.QuestionAnsweredCorrectly{
id: "1",
answer: "answer",
block_id: %DomainModelling.BlockId{block: 1, page: 0}
},
type: "QuestionAnsweredCorrectly",
created_at: ~U[2023-11-01 19:46:32.254112Z],
event_id: "018b8c6c-56be-7b5b-b088-ef15c487b0ac"
}
]}
auto_assert {:ok,
[
%Event{
payload: %QuestionAnsweredCorrectly{
block_id:
%BlockId{page: 0, block: 5},
}
}
]} <- events
end When test "1" is evaluated first, you press |
Legend! I'll look into it and get it fixed up.
|
@tcoopman Thank you so much for the reproduction. That make it very easy to track down (and hopefully fix) the issue. Before I cut a new release, would you mind trying out this latest commit on |
@zachallaun I can confirm that main fixes the bug. I'll use it for now :) |
Thank you for double-checking! I'm going to look into the aliases thing and see if I can get a fix in for that before cutting a new release. |
cool, I hope you find something for the aliases, but having read into it a bit, I think it might not be easy (hopefully I'm wrong) |
trying to create a reproduction. Unsuccessful so far.
The text was updated successfully, but these errors were encountered: