Record retryable requests to monorail for theme commands
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
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
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
mainyou might see odd diffs, rebasemaininto 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>;