-
Notifications
You must be signed in to change notification settings - Fork 103
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
[Ruby CLIKIT] - Prevent from prompting for analytics in CI #3906
Conversation
Thanks for your contribution! Depending on what you are working on, you may want to request a review from a Shopify team:
|
Coverage report
Test suite run success1649 tests passing in 766 suites. Report generated by 🧪jest coverage report action from f2abb5a |
…rors are found in CLI
50aaa60
to
f2abb5a
Compare
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏🏻 a review from someone with more context on this older code would be good too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@@ -64,6 +64,7 @@ def self.report?(context:) | |||
|
|||
def self.report_error?(context:) | |||
return false if Environment.development? | |||
return false unless Environment.interactive? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For readers - Defaulting to false right now to favour simplicity - given the nature of this code (living in ruby land and out of the critical path), if we see issues with this again we should consider dropping the feature altogether
WHY are these changes introduced?
shopify theme push
shows interactive "send error report" prompt even with SHOPIFY_CLI_TTY=0 #1573WHAT is this pull request doing?
This is a patch that disables prompting for Analytics when exceptions occur in non-interactive terminal environments. This only applies to commands backed by the Ruby CLI (AFAIK the
themes
space is the last area we have left to migrate), so the impact surface is quite limited.We will default to
false
in these environments so we don't opt-in users to send analytics without explicit consent.How to test your changes?
Simulate an error raised from the Theme Access API
raise
to the first line of thecreate
method here.Run
SHOPIFY_CLI_STACKTRACE=1 SHOPIFY_CLI_TTY=0 SHOPIFY_CLI_THEME_TOKEN=<your_password> SHOPIFY_FLAG_STORE=<your_shop> pnpm shopify theme push --path <path to theme> --stable -u -t "name"
The program should exit automatically rather than prompting whether you want to send analytics
Before
After - The stacktrace comes from SHOPIFY_CLI_STACKTRACE=1 and is rendered in the Before after a prompt option is selected
Measuring impact
How do we know this change was effective? Please choose one:
Checklist
dev
ordeploy
have been reflected in the internal flowchart.