Skip to content

[Performance] Memoize isShopify environment check#7606

Draft
gonzaloriestra wants to merge 1 commit into
mainfrom
jules-performance-memoize-is-shopify-1733951532173800447
Draft

[Performance] Memoize isShopify environment check#7606
gonzaloriestra wants to merge 1 commit into
mainfrom
jules-performance-memoize-is-shopify-1733951532173800447

Conversation

@gonzaloriestra
Copy link
Copy Markdown
Contributor

Description

This PR implements memoization for the isShopify function in @shopify/cli-kit. This function determines if the CLI is running in a Shopify internal development environment by checking environment variables and performing a file existence check for the /opt/dev/bin/dev executable.

Since isShopify is called multiple times during a CLI command's lifecycle (e.g., in analytics reporting), caching the result promise prevents redundant disk I/O. The memoization is restricted to calls using the default process.env and is bypassed during unit tests to ensure test isolation.

How to test your changes?

CI

Checklist

  • I've added a changeset (if applicable)
  • I've added tests for my changes.
  • I've extended the documentation (if applicable)
  • I've made sure that my changes are accessible to all users.

PR created automatically by Jules for task 1733951532173800447 started by @gonzaloriestra

Memoize the result promise of isShopify when using the default
process.env. This avoids redundant filesystem checks for the
/opt/dev/bin/dev executable, which is particularly beneficial
in hot paths like analytics reporting. The cache is bypassed
during unit tests to maintain isolation.
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant