Skip to content

Catch sorbet segfaults#106

Merged
Morriar merged 2 commits intomasterfrom
at-segfault
Oct 27, 2021
Merged

Catch sorbet segfaults#106
Morriar merged 2 commits intomasterfrom
at-segfault

Conversation

@Morriar
Copy link
Contributor

@Morriar Morriar commented Oct 26, 2021

Ensure sorbet doesn't segfault when we run it with

  • spoom tc
  • spoom bump

And display a meaningful message to the user to avoid confusion.

@Morriar Morriar requested a review from a team October 26, 2021 22:33
@Morriar Morriar self-assigned this Oct 26, 2021
It means one of the file bumped to `typed: #{to}` made Sorbet crash.
Run `spoom bump -f` locally followed by `bundle exec srb tc` to investigate the problem.
ERR
undo_changes(files_to_bump, from)
Copy link
Member

@paracycle paracycle Oct 26, 2021

Choose a reason for hiding this comment

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

I notice we have a lot of undo_changes in this method. I think a great refactor would be to move those to an ensure block so that they run whatever the exit code is.

Something like:

def foo
  files_to_undo = []
  change_some_files

  files_to_undo = files_to_bump

  # lot of complex code that could exit early
  
  # if in dry mode, we want to undo all files
  files_to_undo = files_with_errors unless dry

  # some other output code

  exit(files_changed.empty?)
ensure
  undo_changes(files_to_undo, from)
end

Copy link
Contributor Author

@Morriar Morriar Oct 27, 2021

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar merged commit 85b97bb into master Oct 27, 2021
@Morriar Morriar deleted the at-segfault branch October 27, 2021 16:50
@shopify-shipit shopify-shipit bot temporarily deployed to production December 8, 2021 21:43 Inactive
@Morriar Morriar added the enhancement New feature or request label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants