cli icon indicating copy to clipboard operation
cli copied to clipboard

Ensure user access to selected dev stores

Open gordonhirsch opened this issue 9 months ago β€’ 5 comments

WHY are these changes introduced?

Fixes https://github.com/Shopify/core-issues/issues/88829 for the CLI

Calls BP to ensure that a user has the ability to login to any store that is selected via app dev. This will become necessary when the list of selectable stores includes stores that:

  • are created by other users, and
  • have never been logged into by the current user

WHAT is this pull request doing?

Adds a new function to DeveloperPlatformClient to ensure user access to a store.

  • implemented as a no-op in PartnersClient
  • implemented as a call to BP's organizationUserProvisionShopAccess mutation in ApiManagementClient.

Calls the new function from storeContext. The call is made unconditionally because we currently don't have the ability to determine accessibility ahead of time. If we wanted to change this (i.e. add accessibility info to retrieved store information, we'd likely have to stop calling BP directly and instead call an API in core)

If the user already has access, the mutationl is a no-op on the BP side.

How to test your changes?

The entire PR stack can be tophatted using the instructions here.

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • [ ] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • [x] Existing analytics will cater for this addition
  • [ ] PR includes analytics changes to measure impact

Checklist

  • [x] I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • [x] I've considered possible documentation changes

gordonhirsch avatar Mar 16 '25 00:03 gordonhirsch

[!WARNING] This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite. Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

gordonhirsch avatar Mar 16 '25 00:03 gordonhirsch

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
78.03% (+0.02% πŸ”Ό)
12474/15987
🟑 Branches
72.19% (+0.01% πŸ”Ό)
6042/8370
🟑 Functions
78.26% (-0.02% πŸ”»)
3275/4185
🟑 Lines
78.46% (+0.02% πŸ”Ό)
11801/15041
Show files with reduced coverage πŸ”»
St.:grey_question:
File Statements Branches Functions Lines
🟒
... / app.test-data.ts
92.04% (-0.46% πŸ”»)
93.75%
82.56% (-0.97% πŸ”»)
91.44% (-0.49% πŸ”»)
πŸ”΄
... / partners-client.ts
26.14% 31.58%
16.67% (-0.28% πŸ”»)
25.85%

Test suite run success

2869 tests passing in 1254 suites.

Report generated by πŸ§ͺjest coverage report action from 1b3d85af644861224416bb4a97b6c25009f1c3bd

github-actions[bot] avatar Mar 28 '25 01:03 github-actions[bot]

We detected some changes at packages/*/src and there are no updates in the .changeset. If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

github-actions[bot] avatar Apr 01 '25 22:04 github-actions[bot]

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/api/business-platform.d.ts
@@ -40,6 +40,6 @@ export declare function businessPlatformOrganizationsRequest<T>(query: string, t
  * @param variables - GraphQL variables to pass to the query.
  * @returns The response of the query of generic type <T>.
  */
-export declare function businessPlatformOrganizationsRequestDoc<TResult>(query: TypedDocumentNode<TResult, GraphQLVariables> | TypedDocumentNode<TResult, Exact<{
+export declare function businessPlatformOrganizationsRequestDoc<TResult, TVariables extends Variables>(query: TypedDocumentNode<TResult, TVariables> | TypedDocumentNode<TResult, Exact<{
     [key: string]: never;
-}>>, token: string, organizationId: string, variables?: GraphQLVariables): Promise<TResult>;
\ No newline at end of file
+}>>, token: string, organizationId: string, variables?: TVariables): Promise<TResult>;
\ No newline at end of file

github-actions[bot] avatar Apr 22 '25 18:04 github-actions[bot]

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/api/business-platform.d.ts
@@ -40,6 +40,6 @@ export declare function businessPlatformOrganizationsRequest<T>(query: string, t
  * @param variables - GraphQL variables to pass to the query.
  * @returns The response of the query of generic type <T>.
  */
-export declare function businessPlatformOrganizationsRequestDoc<TResult>(query: TypedDocumentNode<TResult, GraphQLVariables> | TypedDocumentNode<TResult, Exact<{
+export declare function businessPlatformOrganizationsRequestDoc<TResult, TVariables extends Variables>(query: TypedDocumentNode<TResult, TVariables> | TypedDocumentNode<TResult, Exact<{
     [key: string]: never;
-}>>, token: string, organizationId: string, variables?: GraphQLVariables): Promise<TResult>;
\ No newline at end of file
+}>>, token: string, organizationId: string, variables?: TVariables): Promise<TResult>;
\ No newline at end of file

github-actions[bot] avatar Apr 22 '25 18:04 github-actions[bot]

This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. β†’ If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

github-actions[bot] avatar May 26 '25 03:05 github-actions[bot]

We detected some changes at packages/*/src and there are no updates in the .changeset. If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

[!CAUTION] DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

github-actions[bot] avatar Jun 03 '25 16:06 github-actions[bot]