Commit ddfc7b3
committed
Stop reporting expected Admin API failures from store execute as CLI bugs
Two error shapes from the Admin API were being misclassified as
`BugError` and reported to Observe (issue shop/issues#32996):
- HTTP 402 "Unavailable Shop" \u2014 the shop is frozen / on hold; this is a
store-state issue, not a CLI bug.
- "The user aborted a request." \u2014 surfaces from node-fetch when an
AbortController signal fires (CLI-side fetch timeout or user cancel).
Both were getting wrapped by `fetchApiVersions`'s "unknown error" catch
in cli-kit, which destroys the original error type. To classify them
locally without reaching past the public API, `store execute` now drives
its API-version lookup directly via `graphqlRequest` against an inline
`publicApiVersions` query \u2014 the same primitive `admin-transport.ts` uses
for the user's query. Both phases now see raw `ClientError` /
`Error` shapes and share a single classifier in `admin-errors.ts`.
Other commands that hit the Admin API on startup are unaffected; cli-kit
is untouched.
- `packages/store/.../execute/admin-errors.ts` (new): structural
`ClientError` shape check, abort detection, and `classifyAdminApiError`
that maps known non-bug shapes to user-facing `AbortError`s.
- `packages/store/.../execute/admin-context.ts`: drives the version
lookup via `graphqlRequest` directly. 401/404 still trigger the
re-auth path (now via structural status check rather than parsing
message strings); 402 and aborts go through the shared classifier.
- `packages/store/.../execute/admin-transport.ts`: same shared
classifier covers aborts on the execute-phase request.
New `admin-errors.test.ts` covers the classifier; existing context and
transport tests updated to mock `graphqlRequest` directly.1 parent 2e14345 commit ddfc7b3
5 files changed
Lines changed: 511 additions & 77 deletions
File tree
- packages/store/src/cli/services/store/execute
Lines changed: 28 additions & 46 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
20 | 14 | | |
21 | 15 | | |
22 | 16 | | |
| |||
32 | 26 | | |
33 | 27 | | |
34 | 28 | | |
35 | | - | |
| 29 | + | |
36 | 30 | | |
37 | 31 | | |
38 | 32 | | |
39 | | - | |
| 33 | + | |
40 | 34 | | |
41 | 35 | | |
42 | 36 | | |
43 | 37 | | |
44 | 38 | | |
45 | 39 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
49 | 43 | | |
50 | 44 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 45 | + | |
55 | 46 | | |
56 | 47 | | |
57 | 48 | | |
| |||
68 | 59 | | |
69 | 60 | | |
70 | 61 | | |
71 | | - | |
72 | | - | |
73 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
74 | 65 | | |
75 | 66 | | |
76 | 67 | | |
| |||
82 | 73 | | |
83 | 74 | | |
84 | 75 | | |
85 | | - | |
| 76 | + | |
86 | 77 | | |
87 | 78 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
101 | 84 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 85 | + | |
110 | 86 | | |
111 | 87 | | |
112 | 88 | | |
113 | 89 | | |
114 | 90 | | |
115 | 91 | | |
116 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
117 | 99 | | |
Lines changed: 2 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
3 | 2 | | |
4 | | - | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
| |||
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 22 | + | |
43 | 23 | | |
44 | 24 | | |
45 | 25 | | |
| |||
0 commit comments