Encourage scope granting in GraphiQL
WHY are these changes introduced?
When a developer changes the access scopes for their app, and wants to continue to prototype and build, they almost certainly will need the merchant of their dev store -- themselves! -- to grant said access. For the app home, a refresh will do the job with declarative scopes. But lots of building now happens in GraphiQL, and this doesn't have the same behaviour.
WHAT is this pull request doing?
Firstly the token used by GraphiQL is refreshed often now, so its scopes should always be up to date with those granted by the dev store.
This PR adds a couple of helpful nudges:
- if the access scopes in the in-use app toml don't match those that GraphiQL's access token is attempting to use, this is a sign that the developer has changed them. we show a message in the top-bar of GraphiQL encouraging the dev to run
shopify app deploy - after running
shopify app deploy, if the developer has changed their access scopes within their newly released app version, we show a next step about granting these new access scopes in their dev store
How to test your changes?
- Run
shopify app dev, and launch GraphiQL - Leaving dev running, go to your app toml, and add a new scope, save the file
- The banner shown above should appear. If you change the scopes back, it will disappear.
- With changed scopes, run
shopify app deploy. Choose to create and release a new version - The confirmation message should mention going to your dev store, as per the above
Post-release steps
n/a
Measuring impact
How do we know this change was effective? Please choose one:
- [x] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
- [ ] 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
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** 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.
Coverage report
St.:grey_question: |
Category | Percentage | Covered / Total |
|---|---|---|---|
| π‘ | Statements | 72.37% (-0.26% π») |
7486/10344 |
| π‘ | Branches | 69.11% (-0.13% π») |
3683/5329 |
| π‘ | Functions | 71.4% (-0.23% π») |
1977/2769 |
| π‘ | Lines | 72.72% (-0.25% π») |
7072/9725 |
Show files with reduced coverage π»
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π‘ | ... / app.ts |
78.85% (-7.39% π») |
69.14% (-2.29% π») |
85.42% (-5.49% π») |
79.29% (-8.42% π») |
| π’ | ... / deploy.ts |
82.93% (-3.92% π») |
76% (-9% π») |
87.5% | 84.62% (-4.27% π») |
| π’ | ... / identifiers.ts |
100% | 80% (-20% π») |
100% | 100% |
| π΄ | ... / server.ts |
1% (-0.3% π») |
0% | 0% | 1.08% (-0.29% π») |
| π΄ | ... / graphiql.tsx |
50% (-10% π») |
16.67% (-8.33% π») |
0% | 50% (-10% π») |
Test suite run success
1721 tests passing in 794 suites.
Report generated by π§ͺjest coverage report action from eba437644b00a537d8fa740dec8ae87d1ded721e
Is it possible to show a different message in GraphiQL when the granted scopes are out of sync with the deployed scopes?
Is it possible to show a different message in GraphiQL when the granted scopes are out of sync with the deployed scopes?
I'm not sure -- we should be able to get at https://shopify.dev/docs/api/admin-graphql/2023-10/objects/App . If requested/available scopes represent the granted and deployed scopes then maybe it's possible?
Is it possible to show a different message in GraphiQL when the granted scopes are out of sync with the deployed scopes?
I'm not sure -- we should be able to get at https://shopify.dev/docs/api/admin-graphql/2023-10/objects/App . If requested/available scopes represent the granted and deployed scopes then maybe it's possible?
Confirmed a comparison to requested might do it. Will look
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.