Skip to content

Conversation

@isaacroldan
Copy link
Contributor

@isaacroldan isaacroldan commented Oct 3, 2025

WHY are these changes introduced?

We have many reports of "Maximum call stack size exceeded" from the Conf dependency.
This an attempt of capturing those and identify the source.

WHAT is this pull request doing?

Capture all possible errors thrown by Conf, show a more useful message. If it's a permissions error, report it as handled​ and show a useful message to users.

If the error is not a permissions one, re-throw a BugError instead.

Captura de pantalla 2025-10-06 a las 16.53.16.png

How to test your changes?

  1. Change the ownership or permissions of ~/Library/Preferences/shopify-cli-app-nodejs
  2. Verify that the error message includes the path to the config file and a description of the operation that failed

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

Checklist

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

Copy link
Contributor Author

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

@isaacroldan isaacroldan marked this pull request as ready for review October 3, 2025 08:21
@isaacroldan isaacroldan requested a review from a team as a code owner October 3, 2025 08:21
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

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
Copy link
Contributor

github-actions bot commented Oct 3, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
78.98% (+0% 🔼)
13346/16897
🟡 Branches
72.67% (+0.01% 🔼)
6514/8964
🟡 Functions
79.18% (-0.02% 🔻)
3445/4351
🟡 Lines
79.34% (+0.01% 🔼)
12607/15889
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / developer-platform-client.ts
85.71% (-0.4% 🔻)
64.29% (-6.3% 🔻)
80%
93.1% (-0.23% 🔻)
🔴
... / app-management-client.ts
53.29% (-0.55% 🔻)
46.45% (-1.02% 🔻)
49.54% (-0.91% 🔻)
52.09% (-0.61% 🔻)
🔴
... / partners-client.ts
24.7% (-1.77% 🔻)
26.09% (-3.08% 🔻)
17.74% (-2.57% 🔻)
24.53% (-1.85% 🔻)
🟡
... / exchange.ts
80% (-6.67% 🔻)
70.37% (-7.41% 🔻)
84.62% (-7.69% 🔻)
79.31% (-6.9% 🔻)
🟢
... / fs.ts
87.83% (-0.41% 🔻)
92.31% (-2.69% 🔻)
85.42% (+0.63% 🔼)
88.29% (+0.29% 🔼)
🟢
... / session.ts
94.23% (-0.21% 🔻)
95.12%
87.5% (-2.5% 🔻)
94.23% (-0.21% 🔻)

Test suite run success

3243 tests passing in 1340 suites.

Report generated by 🧪jest coverage report action from 33b6549

Copy link
Contributor

@MitchDickinson MitchDickinson left a comment

Choose a reason for hiding this comment

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

A few comments/questions

Also I'm very curious how this fixes the maximum stack exceeded error. What kind of expected user error could trigger that? Is it a bug in a dependency we use or something?

@isaacroldan isaacroldan force-pushed the 10-03-capture_conf_update_errors branch 3 times, most recently from 00700f7 to 8decdbe Compare October 7, 2025 08:02
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.

Have you tested it on Linux/Windows?

Copy link
Contributor

@MitchDickinson MitchDickinson left a comment

Choose a reason for hiding this comment

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

This looks great. Really nice change

@isaacroldan isaacroldan force-pushed the 10-03-capture_conf_update_errors branch 3 times, most recently from 20cd9b9 to 96fa7d5 Compare October 9, 2025 10:43
@isaacroldan isaacroldan force-pushed the 10-03-capture_conf_update_errors branch from 96fa7d5 to 33b6549 Compare October 9, 2025 10:56
@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2025

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/fs.d.ts
@@ -239,6 +239,8 @@ export declare function chmod(path: string, mode: number | string): Promise<void
  * @param path - Path to the file whose permissions will be checked.
  */
 export declare function fileHasExecutablePermissions(path: string): Promise<boolean>;
+export declare function fileHasWritePermissions(path: string): boolean;
+export declare function unixFileIsOwnedByCurrentUser(path: string): boolean | undefined;
 /**
  * Returns true if a file or directory exists.
  *
packages/cli-kit/dist/public/node/local-storage.d.ts
@@ -15,6 +15,8 @@ export declare class LocalStorage<T extends {
      *
      * @param key - The key to get.
      * @returns The value.
+     * @throws AbortError if a permission error occurs.
+     * @throws BugError if an unexpected error occurs.
      */
     get<TKey extends keyof T>(key: TKey): T[TKey] | undefined;
     /**
@@ -22,16 +24,36 @@ export declare class LocalStorage<T extends {
      *
      * @param key - The key to set.
      * @param value - The value to set.
+     * @throws AbortError if a permission error occurs.
+     * @throws BugError if an unexpected error occurs.
      */
     set<TKey extends keyof T>(key: TKey, value?: T[TKey]): void;
     /**
      * Delete a value from the local storage.
      *
      * @param key - The key to delete.
+     * @throws AbortError if a permission error occurs.
+     * @throws BugError if an unexpected error occurs.
      */
     delete<TKey extends keyof T>(key: TKey): void;
     /**
      * Clear the local storage (delete all values).
+     *
+     * @throws AbortError if a permission error occurs.
+     * @throws BugError if an unexpected error occurs.
      */
     clear(): void;
+    /**
+     * Handle errors from config operations.
+     * If the error is permission-related, throw an AbortError with helpful hints.
+     * Otherwise, throw a BugError.
+     *
+     * @param error - The error that occurred.
+     * @param operation - The operation that failed.
+     * @throws AbortError if the error is permission-related.
+     * @throws BugError if the error is not permission-related.
+     */
+    private handleError;
+    private isPermissionError;
+    private tryMessage;
 }
\ No newline at end of file

@isaacroldan isaacroldan added this pull request to the merge queue Oct 9, 2025
Merged via the queue into main with commit bdb504d Oct 9, 2025
2 checks passed
@isaacroldan isaacroldan deleted the 10-03-capture_conf_update_errors branch October 9, 2025 11:10
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