Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter app results by title #4630

Merged
merged 4 commits into from
Nov 24, 2024
Merged

Filter app results by title #4630

merged 4 commits into from
Nov 24, 2024

Conversation

amcaplan
Copy link
Contributor

@amcaplan amcaplan commented Oct 10, 2024

WHY are these changes introduced?

Fixes https://github.com/Shopify/develop-app-inner-loop/issues/1861

Pairs with https://github.com/Shopify/shopify/pull/539421 to enable filtering by app title in the new API.

Note this should NOT be merged until that PR is merged.

WHAT is this pull request doing?

Updates the format of the request to work with the new paginated field, and passes in the search term as a query for app title.

Screenshot 2024-10-09 at 20 26 55 Screenshot 2024-10-09 at 20 27 18

Note that each token is considered an independent search term, so we're searching for an app title that includes all mentioned tokens.

Screenshot 2024-10-09 at 20 28 01

How to test your changes?

  1. Point the new API to the filter-using-pagination-system branch (update as of 2024-11-14: this works on main or dd as well)
  2. Create several apps with different names so you can see the search working (not necessary if pointing to production)
  3. Run USE_APP_MANAGEMENT_API=1 bin/spin pnpm shopify app config link --path /PATH/TO/YOUR/APP
  4. Select the option to connect to an existing app, and search for different app titles.

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
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

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

@amcaplan amcaplan requested a review from a team as a code owner October 10, 2024 12:11
@amcaplan amcaplan requested review from gordonhirsch and alexanderMontague and removed request for a team October 10, 2024 12:11
Copy link
Contributor

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.

Copy link
Contributor

github-actions bot commented Oct 10, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.44% (+0.07% 🔼)
8663/11484
🟡 Branches
70.79% (+0.05% 🔼)
4215/5954
🟡 Functions
74.98% (+0.08% 🔼)
2272/3030
🟡 Lines
75.99% (+0.08% 🔼)
8192/10781

Test suite run success

1961 tests passing in 890 suites.

Report generated by 🧪jest coverage report action from c55df5d

@MitchDickinson
Copy link
Contributor

CC @amcaplan

Note that as part of https://github.com/Shopify/shopify/pull/539421, I introduced the connection API but I also preserved the old apps field on the GraphQL schema. So now we have two ways to access apps:

  • appsConnection
  • apps
    I did not want to have time pressure to ship this CLI PR while the CLI was in a broken state, so I took the safe path.

This PR is probably broken if it's using apps and assuming it's getting back a connection. I think the work outstanding here is going to be (in order to never break the latest CLI):

  1. Ship this PR targeting appsConnection
  2. If you want to rename appsConnection
  • Update apps to also be a connection type
  • Update CLI to use apps
  • Remove appsConnection from server

Or if you feel comfortable moving fast and breaking things, go ahead. I'm not opposed to that with good comms around it in our project channel. I just didn't want to take that on myself :)

@MitchDickinson
Copy link
Contributor

@amcaplan should we aim to get this shipped?

@amcaplan amcaplan force-pushed the filter-app-results-on-app-title branch from 378d9d0 to 33a3c20 Compare November 14, 2024 15:43
Copy link
Contributor

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.

@amcaplan
Copy link
Contributor Author

I think this is ready to go. Currently it points to appsConnection. We can choose to leave it as is, or update apps to be a connection as well and then port this over.

pnpm-lock.yaml Outdated
@@ -279,7 +279,7 @@ importers:
version: link:../app
'@shopify/cli-hydrogen':
specifier: 9.0.2
version: 9.0.2(react-dom@18.2.0)(react@18.2.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this file should have changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly have no idea sometimes why these things change... maybe my local version of pnpm is slightly off? But I'm on 8.15.7 so 🤷‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like a rebase eliminated this change. Looks like this snuck in inside someone else's PR...

appModules {
...ReleasedAppModule
query listApps($query: String) {
appsConnection(query: $query, first: 50) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check -- we're going from all (presumably -- ignore if not) to 50. How does that match up to partners? Do we have sane ordering for these (e.g. most recent first)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. first is required, so we need to pass some kind of value here.
  2. 50 seems reasonable, I don't think we should have users scrolling manually beyond that.
  3. I thought I recalled Partners using 50 as the max, but I can't seem to find it at the moment... That said, client-side we limit it to 25 here. So it's the same order of magnitude. Maybe worth checking, but it's easily changed and not a reason to hold up the PR at the moment IMO.
  4. Order is the default dictated by the server, currently the most recently updated. It will match what they see in the dashboard; it feels like consistency is good.

})
}

test('passes in a blank search if none is provided', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a case where a parameterised test would be best - https://vitest.dev/api/#test-each

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, neat! I wasn't aware of how to do this.

}

test('passes in a blank search if none is provided', async () => {
await appSearchTest({query: undefined, queryVariable: ''})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the default behaviour is term = '' can we get a test asserting that query stays empty in that case.

}
const result = await appManagementRequestDoc(organizationId, query, await this.token(), variables)
if (!result.appsConnection) {
throw new AbortError('Server failed to retrieve apps')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a BugError. Things are pretty broken if this happens

@amcaplan amcaplan force-pushed the filter-app-results-on-app-title branch from 4de2e9f to 08bd462 Compare November 24, 2024 12:51
@amcaplan amcaplan force-pushed the filter-app-results-on-app-title branch from 08bd462 to c55df5d Compare November 24, 2024 12:53
@amcaplan amcaplan added this pull request to the merge queue Nov 24, 2024
Merged via the queue into main with commit e56fad4 Nov 24, 2024
27 checks passed
@amcaplan amcaplan deleted the filter-app-results-on-app-title branch November 24, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants