Skip to content

Commit ed55fc7

Browse files
authored
Merge pull request #5171 from Shopify/skip-uid-update-on-report-mode
[Fix] Skip UID update when in unsafe report mode
2 parents 3a658c7 + 33999f3 commit ed55fc7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/app/src/cli/services/app-context.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {linkedAppContext} from './app-context.js'
22
import {fetchSpecifications} from './generate/fetch-extension-specifications.js'
3+
import {addUidToTomlsIfNecessary} from './app/add-uid-to-extension-toml.js'
34
import link from './app/config/link.js'
45
import {appFromIdentifiers} from './context.js'
56

@@ -259,6 +260,7 @@ describe('linkedAppContext', () => {
259260
})
260261

261262
// Then
263+
expect(vi.mocked(addUidToTomlsIfNecessary)).not.toHaveBeenCalled()
262264
expect(loadSpy).toHaveBeenCalledWith(expect.any(Object), expect.objectContaining({mode: 'report'}))
263265
loadSpy.mockRestore()
264266
})
@@ -280,6 +282,7 @@ describe('linkedAppContext', () => {
280282
})
281283

282284
// Then
285+
expect(vi.mocked(addUidToTomlsIfNecessary)).toHaveBeenCalled()
283286
expect(loadSpy).toHaveBeenCalledWith(expect.any(Object), expect.objectContaining({mode: 'strict'}))
284287
loadSpy.mockRestore()
285288
})

packages/app/src/cli/services/app-context.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ export async function linkedAppContext({
101101
await logMetadata(remoteApp, organization, forceRelink)
102102

103103
// Add UIDs to extension TOML files if using app-management.
104-
await addUidToTomlsIfNecessary(localApp.allExtensions, developerPlatformClient)
104+
// If in unsafe report mode, it is possible the UIDs are not loaded in memory
105+
// even if they are present in the file, so we can't be sure whether or not
106+
// it's necessary.
107+
if (!unsafeReportMode) {
108+
await addUidToTomlsIfNecessary(localApp.allExtensions, developerPlatformClient)
109+
}
105110

106111
return {app: localApp, remoteApp, developerPlatformClient, specifications, organization}
107112
}

0 commit comments

Comments
 (0)