Skip to content

Commit 8cb70ec

Browse files
ryancbahanclaude
andcommitted
Fix configSource in getAppConfigurationState to distinguish default fallback
The old code computed configSource before cache resolution, so when neither a flag nor a cached config was set, the default shopify.app.toml fallback was mislabeled as 'cached' instead of 'default'. Move the source determination after resolution to match the three-way logic already used by selectActiveConfig. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8964add commit 8cb70ec

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

packages/app/src/cli/models/app/loader.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,10 +2620,10 @@ describe('load', () => {
26202620
cmd_app_all_configs_clients: JSON.stringify({'shopify.app.toml': '1234567890'}),
26212621
cmd_app_linked_config_name: 'shopify.app.toml',
26222622
cmd_app_linked_config_git_tracked: true,
2623-
cmd_app_linked_config_source: 'cached',
2623+
cmd_app_linked_config_source: 'default',
26242624
cmd_app_warning_api_key_deprecation_displayed: false,
26252625
app_extensions_any: false,
2626-
app_extensions_breakdown: {},
2626+
app_extensions_breakdown: JSON.stringify({}),
26272627
app_extensions_count: 0,
26282628
app_extensions_custom_layout: false,
26292629
app_extensions_function_any: false,

packages/app/src/cli/models/app/loader.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,6 @@ export async function getAppConfigurationState(
906906
let configName = userProvidedConfigName
907907

908908
const appDirectory = await getAppDirectory(workingDirectory)
909-
const configSource: LinkedConfigurationSource = configName ? 'flag' : 'cached'
910909

911910
const cachedCurrentConfigName = getCachedAppInfo(appDirectory)?.configFile
912911
const cachedCurrentConfigPath = cachedCurrentConfigName ? joinPath(appDirectory, cachedCurrentConfigName) : null
@@ -922,6 +921,16 @@ export async function getAppConfigurationState(
922921

923922
configName = configName ?? cachedCurrentConfigName
924923

924+
// Determine source after resolution so it reflects the actual selection path
925+
let configSource: LinkedConfigurationSource
926+
if (userProvidedConfigName) {
927+
configSource = 'flag'
928+
} else if (configName) {
929+
configSource = 'cached'
930+
} else {
931+
configSource = 'default'
932+
}
933+
925934
const {configurationPath, configurationFileName} = await getConfigurationPath(appDirectory, configName)
926935
const file = await loadConfigurationFileContent(configurationPath)
927936

0 commit comments

Comments
 (0)