Commit 4faf11b
authored
fix: improve Sentry issue grouping to eliminate duplicate issues (#1028)
## Problem
The CLI's Sentry project had 300+ unresolved issues with ~30 duplicate
groups caused by gaps in the fingerprinting system:
1. **Missing `cli_error.kind` tags** — `CliError` (base),
`HostScopeError`, and `WizardError` had no grouping key, so every unique
error message created a separate Sentry issue
2. **Non-CliError exceptions** (TypeError, Error, WizardCancelledError)
only got `cli_error.class` with no kind tag
3. **`extractResourceKind()`** didn't strip bare slugs (`in my-org`) or
entity-name prefixed slugs (`Organization my-company`)
4. **EBADF noise** (~2,867 events across 3 duplicate issues) from stdin
reopen fd errors
5. **No API endpoint normalization** for sub-grouping ApiError by
endpoint shape
## Solution
### Code changes (2 source files)
**`src/lib/error-reporting.ts`:**
- Extract `deriveErrorKind()` from `setGroupingTags()` to reduce
cognitive complexity
- Add `cli_error.kind` for `HostScopeError` (`host_scope`),
`WizardError` (`wizard`), and base `CliError` (4-word message prefix)
- Add `normalizeEndpoint()` — parameterizes variable API path segments,
sets `cli_error.api_endpoint` tag
- Expand `extractResourceKind()` — strip `in <slug>` (not just `in
org/project`), strip hyphenated slugs after entity names
- Enrich `enrichEventWithGroupingTags()` — set `cli_error.kind` from
message prefix for non-CliError exceptions
**`src/lib/telemetry.ts`:**
- Add `isEbadfError()` — detects EBADF errors (bad file descriptor from
stdin reopen)
- Drop EBADF events in `beforeSend` (same class of OS noise as EPIPE)
### Sentry project housekeeping (already done)
- **Merged 18 duplicate groups** (~50 issues merged into canonical
issues)
- **Resolved 4 issues** as `resolved in next release` (EBADF ×3,
replaceAll TypeError ×1)
### Tests
- 34 new tests (unit + property) covering all new grouping logic
- All 7258 existing tests continue to pass
## Expected Impact
| Metric | Before | After |
|--------|--------|-------|
| Error classes without `cli_error.kind` | 5 + all non-CliError | 0 |
| EBADF events/week | ~2,867 | 0 (dropped) |
| Duplicate issue groups | ~30 | 0 (merged + prevented) |1 parent d7440ff commit 4faf11b
6 files changed
Lines changed: 511 additions & 46 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
104 | 144 | | |
105 | 145 | | |
106 | 146 | | |
| |||
111 | 151 | | |
112 | 152 | | |
113 | 153 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
122 | 172 | | |
123 | 173 | | |
124 | 174 | | |
| |||
140 | 190 | | |
141 | 191 | | |
142 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
143 | 251 | | |
144 | 252 | | |
145 | 253 | | |
| |||
149 | 257 | | |
150 | 258 | | |
151 | 259 | | |
| 260 | + | |
152 | 261 | | |
153 | 262 | | |
154 | 263 | | |
| |||
157 | 266 | | |
158 | 267 | | |
159 | 268 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
178 | 275 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
190 | 279 | | |
191 | 280 | | |
192 | 281 | | |
| |||
273 | 362 | | |
274 | 363 | | |
275 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
276 | 372 | | |
277 | 373 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
316 | 345 | | |
317 | 346 | | |
318 | 347 | | |
| |||
612 | 641 | | |
613 | 642 | | |
614 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
615 | 651 | | |
616 | 652 | | |
617 | 653 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
133 | 177 | | |
0 commit comments