Fix --reset flag regression: skip spurious TOML selection prompt before link flow#7238
Fix --reset flag regression: skip spurious TOML selection prompt before link flow#7238timothytenzin20 wants to merge 7 commits intomainfrom
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
/snapit |
|
🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm. Test the snapshot by installing your package globally: npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260410122533Caution After installing, validate the version by running |
gonzaloriestra
left a comment
There was a problem hiding this comment.
Thanks for the PR! The fix makes sense, but I think something is not working. I'm still getting the config prompt when running pnpm shopify app info --reset after deleting the current TOML and having multiple ones.
I think what's missing is to avoid it from link. In 04-08-fix_reset_spurious_toml_selection_prompt_2 I added the missing pieces. Still have to review and test more, but it seems to work. Feel free to add here the changes from there if you want.
|
/snapit |
|
🫰✨ Thanks @timothytenzin20! Your snapshot has been published to npm. Test the snapshot by installing your package globally: npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260410185310Caution After installing, validate the version by running |
|
@gonzaloriestra thanks for the feedback, i made the changes and added tophatting results/steps |
|
@timothytenzin20 would you mind having a look at https://community.shopify.dev/t/shopify-app-config-link-client-id-prompts-for-config-name/33039? It's very related, but this PR doesn't fix that. Now that you have context, maybe it's an easy change to add here 🙏 A quick way to test it:
|
|
TODO: look into
|
0d0c247 to
8ffd3ba
Compare
|
/snapit |
|
🫰✨ Thanks @timothytenzin20! Your snapshot has been published to npm. Test the snapshot by installing your package globally: npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260413221738Caution After installing, validate the version by running |
|
@gonzaloriestra the change was made for running |
gonzaloriestra
left a comment
There was a problem hiding this comment.
Thanks for taking care of the other issue as well! It works as expected 👌
|
Investigation: Cloudflare tunnel not used after (Posted by Claude on behalf of @timothy.khan) cc @kbav for visibility During testing, we noticed that after running Root cause: Why this is correct behavior:
Expected workflow:
This separation of concerns is correct - no changes needed. |
|
@timothytenzin20 This bit:
So do you think you had answered "no" on this ? Is that why it wasn't working on your machine? |
Yea I believe so. I recall having pressed it one of my many iterations. That probably was just the most recent one when we tried to |
a75fc9f to
1370036
Compare
…re link flow When running `shopify app dev --reset`, `getAppConfigurationContext()` was called unconditionally before checking `forceRelink`. If the cached config file didn't exist on disk, this triggered `selectConfigFile()`, prompting the user to pick a TOML file that would be immediately discarded by `link()`. Regression introduced by #6612 ("Remove legacy app schema", commit 1f8dcce) which merged the forceRelink and !isLinked branches back together, undoing the prior fix from #5676. Fix: separate the two paths so forceRelink skips `getAppConfigurationContext()` entirely and calls `link()` directly. Fixes shop/issues-develop#22531
Addresses https://community.shopify.dev/t/shopify-app-config-link-client-id-prompts-for-config-name/33039 When running `shopify app config link --client-id=x` with no existing TOML files, the CLI was prompting for a config name (or throwing an error in non-interactive mode). Now it uses the default shopify.app.toml.
1370036 to
45117ed
Compare

Bug
Bug 1:
shopify app dev --resetspuriously prompts TOML file selection before the reset flow (org → app → config name). The selected TOML is immediately discarded.Bug 2:
shopify app config link --client-id=xprompts for a config name when no TOML files exist, instead of using the defaultshopify.app.toml.Fixes shop/issues-develop#22531 and https://community.shopify.dev/t/shopify-app-config-link-client-id-prompts-for-config-name/33039
Root Cause
Bug 1 (--reset)
Regression introduced by #6612 ("Remove legacy app schema", merged Mar 2026). Commit
1f8dcceaec("Simplify code") merged theforceRelinkand!isLinkedbranches back together, undoing a prior fix from #5676 (Apr 2025) which fixed #5653 by separating theforceRelinkpath so it skips config state loading.getAppConfigurationContext()is called unconditionally before checkingforceRelink. When the cached config file doesn't exist on disk, it callsselectConfigFile(), prompting the user to pick a TOML — even thoughforceRelinkwill discard the result.Bug 2 (config link --client-id)
In
loadConfigurationFileName(), when no existing TOML matches the remote app's API key, the code falls through toselectConfigName()which prompts the user — even when there are zero TOML files and the obvious default isshopify.app.toml.Fix
app-context.ts— Separate theforceRelinkand!isLinkedpaths soforceRelinkskipsgetAppConfigurationContext()entirely and callslink()directly.link.ts/loader.ts/active-config.ts— Thread askipPromptsoption throughlink()→loadApp()/loadOpaqueApp()→getAppConfigurationContext()→selectActiveConfig()so that the stale-cache prompt is also skipped when called from inside the link flow.link.ts— When no TOML files exist at all, use the defaultshopify.app.tomlwithout prompting.Test
getAppConfigurationContextis only called afterlink()whenforceRelinkis true (usinginvocationCallOrdertracking).selectConfigNameis not called when no TOML files exist.All 24 tests pass ✅
🎩
Expected Results:
shopify app dev --resetUsing latest:
Using snapshot (0.0.0-snapshot-20260413221738):
shopify app config link --client-id=<your-client-id>Using latest:
Using snapshot (0.0.0-snapshot-20260413221738):
Setup
Navigate to any Shopify app directory that has multiple
shopify.app.*.tomlfiles, then delete the currently cached/active TOML so the stale-cache path is triggered.Warning
Make sure to double check the version change is working by using
which shopify && shopify versionIf the version is not changing use these commands:
pnpm remove -g @shopify/clipnpm add -g @shopify/cli@[version]which shopify && shopify version1. Reproduce the --reset bug (
@latest)Expected (broken): You get prompted to select a TOML file before the org → app → config name flow. The selection is immediately discarded.
2. Reproduce the config link bug (
@latest)Expected (broken): You get prompted for "Configuration file name:" (or an error in non-interactive mode).
3. Verify both fixes (snapshot)
Expected (fixed):
--resetgoes straight into the org → app → config name flow with no spurious TOML selection prompt.config link --client-idcreatesshopify.app.tomlwithout prompting for a name.