cli icon indicating copy to clipboard operation
cli copied to clipboard

Record retryable requests to monorail for theme commands

Open EvilGenius13 opened this issue 2 months ago β€’ 2 comments

WHY are these changes introduced?

Follow up to: https://github.com/Shopify/cli/pull/6451

Now that we will be getting data for failed commands, we should also gather data during retryable network events.

We want to record retries for:

  • Transient level retries
  • HTTP level retries (429, 401..)

WHAT is this pull request doing?

Add an optional property in NetworkRetryBehaviour that will record these kinds of events only if they are theme commands. App command logging will remain the same as it currently is.

How to test your changes?

Running the tests is the easiest. pnpm vitest run packages/cli-kit/src/private/node/api.test.ts

Post-release steps

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

EvilGenius13 avatar Oct 01 '25 17:10 EvilGenius13

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
79.24% (+0.01% πŸ”Ό)
13604/17169
🟑 Branches
73.13% (+0.02% πŸ”Ό)
6640/9080
🟑 Functions
79.37% (-0% πŸ”»)
3508/4420
🟑 Lines
79.59% (+0.01% πŸ”Ό)
12849/16144
Show new covered files 🐣
St.:grey_question:
File Statements Branches Functions Lines
🟒
... / bulk-operation-run-query.ts
100% 100% 100% 100%
🟒
... / execute-bulk-operation.ts
100% 83.33% 100% 100%
🟒
... / run-query.ts
100% 100% 100% 100%
Show files with reduced coverage πŸ”»
St.:grey_question:
File Statements Branches Functions Lines
🟒
... / api.ts
87.07% (-0.43% πŸ”»)
76.71% (-0.1% πŸ”»)
100%
86.49% (-0.43% πŸ”»)

Test suite run success

3363 tests passing in 1376 suites.

Report generated by πŸ§ͺjest coverage report action from 7aa5bbb79d4cdf4af562d7065c00ab4f15817240

github-actions[bot] avatar Oct 01 '25 17:10 github-actions[bot]

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/api.d.ts
@@ -4,8 +4,10 @@ export declare const allAPIs: API[];
 export type NetworkRetryBehaviour = {
     useNetworkLevelRetry: true;
     maxRetryTimeMs: number;
+    recordThemeCommandRetries?: boolean;
 } | {
     useNetworkLevelRetry: false;
+    recordThemeCommandRetries?: boolean;
 };
 type RequestOptions<T> = {
     request: () => Promise<T>;

github-actions[bot] avatar Nov 17 '25 18:11 github-actions[bot]