Skip to content

Conversation

@nickwesselman
Copy link
Contributor

@nickwesselman nickwesselman commented Dec 9, 2025

WHY are these changes introduced?

This PR improves API version handling and error presentation in bulk operations to provide a more consistent and user-friendly experience.

WHAT is this pull request doing?

  • Introduces a minimum API version constant for bulk operations
  • Replaces hardcoded API version with dynamic version resolution
  • Improves error handling in bulk operations by:
    • Changing from renderWarning to renderError to better reflect severity
    • Formatting error messages as a structured list for better readability
    • Removing unnecessary prefixes when no field is present
    • Using a more descriptive headline ("Error creating bulk operation")
  • Adds a new resolveApiVersion function that intelligently selects the appropriate API version based on:
    • User-provided version flag
    • Minimum required version
    • Latest supported version from the API
  • Adds comprehensive tests for the new version resolution logic

How to test your changes?

  1. Run a bulk operation with intentional errors
  2. Verify that error messages are displayed properly with the new format
  3. Test with different API version flags to ensure proper version resolution
  4. Confirm that operations use the minimum required version when appropriate

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

@nickwesselman nickwesselman marked this pull request as ready for review December 9, 2025 17:17
@nickwesselman nickwesselman requested a review from a team as a code owner December 9, 2025 17:17
@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 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 Dec 9, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
79.5% (+0.27% 🔼)
14174/17829
🟡 Branches
73.54% (+0.44% 🔼)
6950/9450
🟡 Functions
79.66% (+0.29% 🔼)
3638/4567
🟡 Lines
79.87% (+0.29% 🔼)
13399/16776
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / admin-as-app.ts
100% 100% 100% 100%
🟢
... / metafield_definitions.ts
100% 100% 100% 100%
🟢
... / metaobject_definitions.ts
100% 100% 100% 100%
🟢
... / bulk-operation-run-mutation.ts
100% 100% 100% 100%
🟢
... / bulk-operation-run-query.ts
100% 100% 100% 100%
🟢
... / get-bulk-operation-by-id.ts
100% 100% 100% 100%
🟢
... / list-bulk-operations.ts
100% 100% 100% 100%
🟢
... / staged-uploads-create.ts
100% 100% 100% 100%
🔴
... / execute.ts
0% 0% 0% 0%
🔴
... / status.ts
0% 0% 0% 0%
🔴
... / pull.ts
0% 100% 0% 0%
🟢
... / execute-operation.ts
92.59% 75% 100% 92.31%
🔴
... / pull.ts
0% 0% 0% 0%
🟢
... / bulk-operation-status.ts
96.55% 92.11% 100% 100%
🟢
... / constants.ts
100% 100% 100% 100%
🟢
... / download-bulk-operation-results.ts
100% 100% 100% 100%
🟢
... / execute-bulk-operation.ts
92.65% 86.67% 100% 93.94%
🟢
... / format-bulk-operation-status.ts
100% 100% 100% 100%
🟢
... / run-mutation.ts
100% 100% 100% 100%
🟢
... / run-query.ts
100% 100% 100% 100%
🟡
... / stage-file.ts
73.53% 62.5% 85.71% 72.73%
🟢
... / watch-bulk-operation.ts
100% 94.74% 100% 100%
🟢
... / declarative-definitions.ts
98.54% 93.18% 100% 98.51%
🟢
... / common.ts
97.22% 93.75% 100% 96.55%
🟢
... / execute-command-helpers.ts
100% 100% 100% 100%
🔴
... / promiseWithResolvers.ts
33.33% 50% 50% 33.33%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / execute.ts
0%
0% (-100% 🔻)
0% 0%
🟢
... / extension-instance.ts
84.8% (+0.23% 🔼)
77.6% (-0.91% 🔻)
92.06% (+0.13% 🔼)
85.11% (+0.24% 🔼)
🟡
... / specification.ts
69.09%
75.61% (+2.44% 🔼)
76.47% (-1.31% 🔻)
68.75%
🟢
... / ui_extension.ts
85.38% (-9.44% 🔻)
72.34% (-8.91% 🔻)
84% (-16% 🔻)
88% (-8.46% 🔻)
🟢
... / developer-platform-client.ts
84.62% (-1.5% 🔻)
71.43% (+0.84% 🔼)
81.82% (+1.82% 🔼)
93.75% (+0.42% 🔼)
🟢
... / api.ts
87.07% (-0.43% 🔻)
76.71% (-0.1% 🔻)
100%
86.49% (-0.43% 🔻)
🟢
... / ConcurrentOutput.tsx
98.36% (-1.64% 🔻)
92% (-4% 🔻)
100%
98.33% (-1.67% 🔻)
🟢
... / SingleTask.tsx
84.21% (-15.79% 🔻)
50% (-50% 🔻)
80% (-20% 🔻)
84.21% (-15.79% 🔻)
🔴
... / environment.ts
35% (-5% 🔻)
41.18%
40% (-10% 🔻)
36.84% (-5.26% 🔻)
🔴
... / ui.tsx
50.82% (-0.79% 🔻)
42.86% (-5.53% 🔻)
54.55% (+1.42% 🔼)
50% (-0.82% 🔻)
🟢
... / console.ts
81.82% (+15.15% 🔼)
75% (-25% 🔻)
100% (+33.33% 🔼)
81.82% (+15.15% 🔼)
🔴
... / dev.ts
14.29% (+0.95% 🔼)
3.13% (+0.18% 🔼)
50% (-7.14% 🔻)
14.29% (+0.95% 🔼)
🟢
... / init.ts
88% (-0.89% 🔻)
71.43% (+4.76% 🔼)
86.67% (+4.85% 🔼)
88% (-0.89% 🔻)
🟢
... / storefront-renderer.ts
90.2% (-0.54% 🔻)
78.95%
81.82% (-1.52% 🔻)
90.2% (-0.54% 🔻)
🟡
... / theme-polling.ts
67.12% (-0.93% 🔻)
68.75% 78.57%
66.67% (-0.98% 🔻)

Test suite run success

3553 tests passing in 1415 suites.

Report generated by 🧪jest coverage report action from a96993e

@nickwesselman nickwesselman changed the title Improve error messaging for failures on bulk operation creation Use minimum API version for bulk operations Dec 9, 2025
Copy link
Contributor

@jordanverasamy jordanverasamy left a comment

Choose a reason for hiding this comment

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

thank you for putting this together <3

@nickwesselman nickwesselman force-pushed the poll_bulk_operations_faster branch from a694179 to d894b0c Compare December 9, 2025 20:20
@nickwesselman nickwesselman force-pushed the bulk_operation_error_message branch from 0fbeaaa to 687de29 Compare December 9, 2025 20:20
Copy link
Contributor Author

/snapit

Copy link
Contributor Author

/snapit

2 similar comments
@gonzaloriestra
Copy link
Contributor

/snapit

@gonzaloriestra
Copy link
Contributor

/snapit

@nickwesselman nickwesselman force-pushed the poll_bulk_operations_faster branch from d894b0c to 544183d Compare December 10, 2025 14:14
@nickwesselman nickwesselman requested a review from a team as a code owner December 10, 2025 14:14
@nickwesselman nickwesselman force-pushed the bulk_operation_error_message branch from 847e0d3 to 8cffe52 Compare December 10, 2025 14:14
@nickwesselman nickwesselman force-pushed the poll_bulk_operations_faster branch from 544183d to 9d4706e Compare December 10, 2025 16:10
@nickwesselman nickwesselman force-pushed the bulk_operation_error_message branch from 8cffe52 to 28408ea Compare December 10, 2025 16:10
Copy link
Contributor

/snapit

Base automatically changed from poll_bulk_operations_faster to main December 11, 2025 14:24
Copy link
Contributor

/snapit

@nickwesselman nickwesselman force-pushed the bulk_operation_error_message branch from 29170fd to b7caf67 Compare December 12, 2025 20:17
Copy link
Contributor Author

/snapit

@github-actions
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/public/node/api/admin.d.ts
@@ -41,6 +41,14 @@ export declare function adminRequestDoc<TResult, TVariables extends Variables>(o
  * @returns - An array of supported API versions.
  */
 export declare function supportedApiVersions(session: AdminSession, preferredBehaviour?: RequestModeInput): Promise<string[]>;
+/**
+ * GraphQL query to retrieve all API versions.
+ *
+ * @param session - Shopify admin session including token and Store FQDN.
+ * @param preferredBehaviour - Custom request behaviour for retries and timeouts.
+ * @returns - An array of supported and unsupported API versions.
+ */
+export declare function fetchApiVersions(session: AdminSession, preferredBehaviour?: RequestModeInput): Promise<ApiVersion[]>;
 /**
  * Returns the Admin API URL for the given store and version.
  *
@@ -50,6 +58,10 @@ export declare function supportedApiVersions(session: AdminSession, preferredBeh
  * @returns - Admin API URL.
  */
 export declare function adminUrl(store: string, version: string | undefined, session?: AdminSession): string;
+interface ApiVersion {
+    handle: string;
+    supported: boolean;
+}
 /**
  * Executes a REST request against the Admin API.
  *
@@ -82,4 +94,5 @@ export interface RestResponse {
     headers: {
         [key: string]: string[];
     };
-}
\ No newline at end of file
+}
+export {};
\ No newline at end of file

@nickwesselman nickwesselman added this pull request to the merge queue Dec 12, 2025
Merged via the queue into main with commit aa19356 Dec 12, 2025
42 of 45 checks passed
@nickwesselman nickwesselman deleted the bulk_operation_error_message branch December 12, 2025 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants