Commit 04b97d2
committed
fix(telemetry): extend error classifier + stamp category/fatal on failed audits
B-007 addressed the two root causes that made the admin "Top error classes"
panel useless for triage:
1) `classifyError()` had no pattern for `ERR_INVALID_ARG_TYPE` /
`fileURLToPath(undefined)` — every B-006 failure collapsed into `unknown`.
All 16 failed audits in the last 30 days on prod landed in the same
opaque bucket, impossible to distinguish from unrelated regressions.
2) `audit_complete` with `outcome="failed"` never set `category` or `fatal`,
so failed audits did not hit the (category, error_class) composite index
on the backend. They showed up with NULL category on the dashboard.
Vocabulary changes (src/telemetry.ts):
- Add specific node codes: `node_invalid_arg`, `module_not_found`,
`spawn_error`, `out_of_memory`. These match BEFORE the generic
fallbacks below so B-006-class failures keep their triage signal.
- Add generic JS kinds as last resort before `unknown`:
`type_error`, `reference_error` — dispatched via `err.name` rather
than message text, so a bare `TypeError: x is not a function` at
least lands in a non-empty bucket.
- Drop the `msg.includes("enoent") → transcript_not_found` shortcut;
a bare ENOENT is a generic missing-file hit, not a transcript issue.
Kept `transcript not found` literal as the transcript-specific matcher
and generic ENOENT now falls through to `transcript_not_found` only
after `spawn ENOENT` is checked.
- Network: `econnreset` added alongside `econnrefused`.
- Doc-comment the load-bearing match order.
audit_complete event (src/session-cleanup.ts):
- When `outcome === "failed"`, stamp `category: "audit"` and
`fatal: false`. Audit failures are non-fatal — the session still
closes and the user's work is unaffected; only background extraction
is lost until the next attempt. Setting these fields lets the
existing backend index surface failed audits in the same panel as
other categorized errors.
Tests (test/telemetry.test.ts):
- B-006 reproducer: exact TypeError message from the audit-worker-logs
→ `node_invalid_arg`.
- Order guard: the same message through the `TypeError` path must NOT
degrade into the generic `type_error` fallback.
- One test per new class (module_not_found, spawn_error, out_of_memory,
type_error, reference_error fallback).
Verified:
- 481/481 unit tests pass (6 new cases; full suite was 478 before)
- `tsc --noEmit` clean
- `npm run build` clean
- `grep` in `dist/cli.mjs` shows all 6 new slugs present in the bundle
Follow-up for v0.2.8 release: re-query
SELECT error_class, COUNT(*)
FROM telemetry_events
WHERE event='audit_complete' AND outcome='failed'
GROUP BY error_class
ORDER BY COUNT(*) DESC
`unknown` should drop from 100% to a small minority; `node_invalid_arg`
should be 0 on v0.2.8 (B-006 fixed in PR #105).
Fixes B-007.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> #!axme pr=none repo=AxmeAI/axme-code1 parent e05de98 commit 04b97d2
3 files changed
Lines changed: 141 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
817 | 817 | | |
818 | 818 | | |
819 | 819 | | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
820 | 827 | | |
821 | 828 | | |
822 | 829 | | |
| |||
828 | 835 | | |
829 | 836 | | |
830 | 837 | | |
| 838 | + | |
831 | 839 | | |
832 | 840 | | |
833 | 841 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
75 | 83 | | |
76 | 84 | | |
77 | 85 | | |
| |||
84 | 92 | | |
85 | 93 | | |
86 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
87 | 104 | | |
88 | 105 | | |
89 | 106 | | |
| |||
399 | 416 | | |
400 | 417 | | |
401 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
402 | 423 | | |
403 | 424 | | |
404 | 425 | | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
405 | 431 | | |
406 | 432 | | |
407 | 433 | | |
408 | 434 | | |
409 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
410 | 461 | | |
411 | 462 | | |
412 | | - | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
413 | 469 | | |
| 470 | + | |
| 471 | + | |
414 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
415 | 480 | | |
416 | 481 | | |
417 | 482 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 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 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
223 | 288 | | |
224 | 289 | | |
225 | 290 | | |
| |||
0 commit comments