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

Remove all conditional logic around App Management being disabled #5004

Conversation

amcaplan
Copy link
Contributor

@amcaplan amcaplan commented Dec 1, 2024

WHY are these changes introduced?

Completes https://github.com/Shopify/develop-app-inner-loop/issues/2343

Removes the App Management feature flag and makes it a default part of the CLI's functionality. This should be merged when App Management is ready to be rolled out to all eligible organizations.

WHAT is this pull request doing?

  • Removes the USE_APP_MANAGEMENT_API environment variable and related checks
  • Removes most behavior implementing a special case where App Management is disabled
    • ... with the exception of when using a Partners CLI token, in which case we need to access only Partners and not App Management

How to test your changes?

  1. Deploy an app using shopify app deploy --reset (or you can start all the way back from app init)
  2. Verify organizations are fetched from both Partners and App Management APIs
  3. Test app creation and management workflows to ensure they work without the feature flag

Checklist

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

Copy link
Contributor Author

amcaplan commented Dec 1, 2024

@amcaplan amcaplan changed the title Remove all conditional logic around App Management being disabled DO NOT MERGE: Remove all conditional logic around App Management being disabled Dec 1, 2024
@amcaplan amcaplan marked this pull request as ready for review December 1, 2024 22:52
@amcaplan amcaplan requested a review from a team as a code owner December 1, 2024 22:52
Copy link
Contributor

github-actions bot commented Dec 1, 2024

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 amcaplan marked this pull request as draft December 1, 2024 22:53
Base automatically changed from centralize-app-management-gating to main December 2, 2024 11:41
@amcaplan amcaplan force-pushed the 12-02-remove_all_conditional_logic_around_app_management_being_disabled branch 2 times, most recently from 5215a55 to ec98d8c Compare December 2, 2024 12:20
Copy link
Contributor

github-actions bot commented Jan 2, 2025

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.

@amcaplan
Copy link
Contributor Author

amcaplan commented Jan 2, 2025

still relevant

@amcaplan amcaplan force-pushed the 12-02-remove_all_conditional_logic_around_app_management_being_disabled branch 3 times, most recently from 81cc960 to 9ecb7d4 Compare January 2, 2025 15:51
@amcaplan amcaplan force-pushed the 12-02-remove_all_conditional_logic_around_app_management_being_disabled branch from 9ecb7d4 to 8efb2c3 Compare January 14, 2025 14:16
Copy link
Contributor

github-actions bot commented Jan 14, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.24% (+0.06% 🔼)
8880/11802
🟡 Branches
70.42% (+0.11% 🔼)
4328/6146
🟡 Functions
75.06% (+0% 🔼)
2326/3099
🟡 Lines
75.8% (+0.08% 🔼)
8394/11074
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / bundle.ts
100%
50% (-10% 🔻)
100% 100%
🟡
... / ui.tsx
70.59% (-11.55% 🔻)
60% (-12.22% 🔻)
100%
73.33% (-11.28% 🔻)
🟢
... / urls.ts
82.57%
77.5% (-0.81% 🔻)
75% 84.47%
🟢
... / app-event-watcher.ts
93.83% (-1.23% 🔻)
86.49% (-2.7% 🔻)
90.48% 98.61%
🟢
... / session.ts
89.6% (+6.59% 🔼)
77.17% (+4.45% 🔼)
91.67% (-1.19% 🔻)
88.98% (+6.22% 🔼)
🟡
... / exchange.ts
76.36% (-0.42% 🔻)
62.96% 77.78%
75.93% (-0.44% 🔻)
🟢
... / scopes.ts
95.65%
82.35% (-0.98% 🔻)
100% 95.45%
🟡
... / local.ts
62.96%
52% (-0.94% 🔻)
47.83% 62.96%

Test suite run success

2002 tests passing in 904 suites.

Report generated by 🧪jest coverage report action from de4d15e

@amcaplan amcaplan marked this pull request as ready for review January 15, 2025 21:19
@amcaplan amcaplan changed the title DO NOT MERGE: Remove all conditional logic around App Management being disabled Remove all conditional logic around App Management being disabled Jan 15, 2025
@amcaplan amcaplan force-pushed the 12-02-remove_all_conditional_logic_around_app_management_being_disabled branch 2 times, most recently from c110640 to ca92bf3 Compare January 15, 2025 21:54
Copy link
Contributor

@gonzaloriestra gonzaloriestra left a comment

Choose a reason for hiding this comment

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

What happens if a Partners organization has already been migrated to BP? The CLI would show it twice in the list of orgs? For that reason, I was merging them here.

Then, if duplicated, we should choose which one to use depending on the app migration status.

.github/workflows/shopify-cli.yml Show resolved Hide resolved
packages/cli-kit/src/private/node/session.ts Show resolved Hide resolved
@amcaplan
Copy link
Contributor Author

What happens if a Partners organization has already been migrated to BP? The CLI would show it twice in the list of orgs? For that reason, I was merging them here.

Then, if duplicated, we should choose which one to use depending on the app migration status.

This is a great question. I don't think it's relevant to this PR, though, as that behavior is unaffected. It would be worth checking why that deduplication was dropped.


// When
const got = isAppManagementEnabled(env)
const got = isAppManagementDisabled()

// Then
expect(got).toBe(true)
})

test('returns false when USE_APP_MANAGEMENT_API is falsy', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's worth renaming this test to not reference USE_APP_MANAGEMENT_API.

packages/cli-kit/src/private/node/session.ts Show resolved Hide resolved
@amcaplan amcaplan force-pushed the 12-02-remove_all_conditional_logic_around_app_management_being_disabled branch from ca92bf3 to de4d15e Compare January 16, 2025 17:29
Copy link
Contributor

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/private/node/constants.d.ts
@@ -31,7 +31,6 @@ export declare const environmentVariables: {
     otelURL: string;
     themeKitAccessDomain: string;
     json: string;
-    useAppManagement: string;
 };
 export declare const defaultThemeKitAccessDomain = "theme-kit-access.shopifyapps.com";
 export declare const systemEnvironmentVariables: {
packages/cli-kit/dist/private/node/api/headers.d.ts
@@ -1,6 +1,6 @@
 import { ExtendableError } from '../../../public/node/error.js';
 import https from 'https';
-export declare class RequestClientError extends ExtendableError {
+declare class RequestClientError extends ExtendableError {
     statusCode: number;
     constructor(message: string, statusCode: number);
 }
@@ -25,4 +25,5 @@ export declare function buildHeaders(token?: string): {
  * if the service is running in a Spin environment, the attribute "rejectUnauthorized" is
  * set to false
  */
-export declare function httpsAgent(): Promise<https.Agent>;
\ No newline at end of file
+export declare function httpsAgent(): Promise<https.Agent>;
+export {};
\ No newline at end of file
packages/cli-kit/dist/private/node/session/scopes.d.ts
@@ -5,7 +5,7 @@ import { API } from '../api.js';
  * @param extraScopes - custom user-defined scopes
  * @returns Array of scopes
  */
-export declare function allDefaultScopes(extraScopes?: string[], systemEnvironment?: NodeJS.ProcessEnv): string[];
+export declare function allDefaultScopes(extraScopes?: string[]): string[];
 /**
  * Generate a flat array with the default scopes for the given API plus
  * any custom scope defined by the user
@@ -13,4 +13,4 @@ export declare function allDefaultScopes(extraScopes?: string[], systemEnvironme
  * @param extraScopes - custom user-defined scopes
  * @returns Array of scopes
  */
-export declare function apiScopes(api: API, extraScopes?: string[], systemEnvironment?: NodeJS.ProcessEnv): string[];
\ No newline at end of file
+export declare function apiScopes(api: API, extraScopes?: string[]): string[];
\ No newline at end of file
packages/cli-kit/dist/public/node/context/local.d.ts
@@ -26,12 +26,12 @@ export declare function isDevelopment(env?: NodeJS.ProcessEnv): boolean;
  */
 export declare function isVerbose(env?: NodeJS.ProcessEnv): boolean;
 /**
- * It returns true if the App Management API is available.
+ * It returns true if the App Management API is disabled.
+ * This should only be relevant when using a Partners token.
  *
- * @param env - The environment variables from the environment of the current process.
- * @returns True if the App Management API is available.
+ * @returns True if the App Management API is disabled.
  */
-export declare function isAppManagementEnabled(env?: NodeJS.ProcessEnv): boolean;
+export declare function isAppManagementDisabled(): boolean;
 /**
  * Returns true if the environment in which the CLI is running is either
  * a local environment (where dev is present) or a cloud environment (spin).

Copy link
Contributor Author

amcaplan commented Jan 16, 2025

Merge activity

  • Jan 16, 12:57 PM EST: A user started a stack merge that includes this pull request via Graphite.
  • Jan 16, 12:57 PM EST: A user added this pull request to the GitHub merge queue with Graphite.

@amcaplan amcaplan added this pull request to the merge queue Jan 16, 2025
Merged via the queue into main with commit 4126f48 Jan 16, 2025
28 checks passed
@amcaplan amcaplan deleted the 12-02-remove_all_conditional_logic_around_app_management_being_disabled branch January 16, 2025 18:04
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