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

Silence sorbet warning when booting with spring #328

Merged
merged 1 commit into from
Mar 8, 2023

Conversation

gmcgibbon
Copy link
Member

@gmcgibbon gmcgibbon commented Mar 8, 2023

What are you trying to accomplish?

Silence warning when booting with Sorbet.

Before:

% bin/packwerk check
Running via Spring preloader in process 904969
Packwerk couldn't disable Sorbet. Please ensure it isn't being used before Packwerk is loaded.
📦 Packwerk is inspecting <n> files

After:

% bin/packwerk check
Running via Spring preloader in process 904969
📦 Packwerk is inspecting <n> files

What approach did you choose and why?

use defined?(Spring)

When booting the Rails app with Spring and the app uses Sorbet, Sorbet cannot be disabled because the app has likely already invoked a typed method.

What should reviewers focus on?

For now, this silences the error when disabling sorbet while using a spring booted server. It would be nice if we could look at disabling at at the right time in a safer way, but I have no idea how to do that yet reading spring. Maybe we need to boot our own version of a test mode spring server with typechecking disabled. See #327

Type of Change

  • Bugfix
  • New feature
  • Non-breaking change (a change that doesn't alter functionality - i.e., code refactor, configs, etc.)

Additional Release Notes

  • Breaking change (fix or feature that would cause existing functionality to change)

Include any notes here to include in the release description. For example, if you selected "breaking change" above, leave notes on how users can transition to this version.

If no additional notes are necessary, delete this section or leave it unchanged.

Checklist

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • It is safe to rollback this change.

When booting the Rails app with Spring and the app uses Sorbet, Sorbet
cannot be disabled because the app has likely already invoked a typed method.
@gmcgibbon gmcgibbon requested a review from a team as a code owner March 8, 2023 06:38
@gmcgibbon
Copy link
Member Author

gmcgibbon commented Mar 8, 2023

I'll run a release after this if we agree this an acceptable measure to take in the interim.

@gmcgibbon gmcgibbon merged commit 96fd623 into main Mar 8, 2023
@gmcgibbon gmcgibbon deleted the silence_disable_fail_with_spring branch March 8, 2023 21:15
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems March 9, 2023 00:42 Inactive
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.

2 participants