Commit ba6435f
authored
feat(packaged): attach crash-scene evidence to packaged_runtime_failed (#5224)
* feat(packaged): attach crash-scene evidence to packaged_runtime_failed
The pre-daemon startup crash class (`packaged_runtime_failed`, #4696) reports
only structured buckets today: failure_kind, exit_code, error_name, and a
log-tail-parsed error_code/missing_module. That is enough to see THAT startup
failed, but not WHY on a given machine:
- The mac `daemon-start` failures are better-sqlite3 ERR_MODULE_NOT_FOUND, yet
the shipped 0.13.0 DMG's `better_sqlite3.node` is verified present, arm64,
signed, notarized and resolvable — so this is a machine-side subset, not a
build defect, and we have no per-machine signal to explain the subset.
- The Windows `unknown` bucket (the single largest slice) carries no exit code
and no daemon log to parse, so today it is a dead end.
Enrich the event with on-machine crash evidence: the scrubbed + truncated
top-level error message/stack (the only signal the `unknown` bucket has), and a
best-effort probe of the daemon's better-sqlite3 binding on THIS machine
(present + size), which separates "file missing" from "file present but
unloadable" (arch mismatch / quarantine / AV). All paths and free-form text are
run through the existing `scrubUserPaths` and length-capped before send.
- startup-telemetry.ts: add `error_message`, `error_stack`,
`native_module_present/size/path`; new `nativeModulePath` arg + injectable
`statNativeModule` dep.
- index.ts: pass the packaged binding path
(`getAppPath()/node_modules/better-sqlite3/build/Release/better_sqlite3.node`,
layout verified against the shipped DMG) through the fatal-exit report.
- contracts: extend `PackagedRuntimeFailedProps` with the optional fields.
- tests: red-spec first — assert scrubbed message/stack and the native probe
(present/missing) via the injected `statNativeModule`.
* fix(packaged): scrub full Windows profile segment even with spaces
Review (PerishCode/Looper): the new free-form error_message/error_stack fields
run through scrubUserPaths, but its Windows branch matched `[^\\\s]+` — it
stopped at the first whitespace. A Windows profile dir can contain a space
("C:\Users\John Doe\..."), so it produced "C:\Users\<redacted> Doe\..." and
leaked the rest of the segment, breaking this PR's stated privacy bound.
Consume the whole segment up to the next backslash (`[^\\]+`). POSIX home
segments cannot contain spaces and file:// URLs percent-encode them, so only
this backslash form needs the whitespace-tolerant boundary. Add fixture
coverage for the spaced profile — both standalone and embedded in a crash
message — asserting the surname never survives.
* fix(packaged): make Windows-home scrub separator-agnostic
Review round 2 (PerishCode/Looper): the prior fix covered the backslash form,
but slash-normalized Windows paths ("C:/Users/John Doe/...", which JS/Electron/
Node diagnostics commonly emit) still leaked the surname — the POSIX "/Users/"
rule matched them and stopped at the first space, producing
"C:/Users/<redacted> Doe/...".
Replace the backslash-only Windows rule with a separator-agnostic one that
matches `<drive>:[\\/]Users[\\/]` and consumes the whole segment up to the next
slash OR backslash (spaces allowed), running before the POSIX rule. The `\r\n`
in the class keeps it from running across lines in a multi-line stack. POSIX
segments can't contain spaces, so that rule is left with its whitespace
boundary. Fixtures added for the slash form (standalone + embedded) and a
multi-line no-over-redaction case.1 parent 1eb3898 commit ba6435f
4 files changed
Lines changed: 220 additions & 5 deletions
File tree
- apps/packaged
- src
- tests
- packages/contracts/src/analytics/events
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
132 | 145 | | |
133 | 146 | | |
134 | 147 | | |
| |||
284 | 297 | | |
285 | 298 | | |
286 | 299 | | |
| 300 | + | |
287 | 301 | | |
288 | 302 | | |
289 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | | - | |
| 33 | + | |
28 | 34 | | |
29 | 35 | | |
30 | 36 | | |
| |||
146 | 152 | | |
147 | 153 | | |
148 | 154 | | |
149 | | - | |
150 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
151 | 168 | | |
152 | 169 | | |
153 | 170 | | |
| |||
196 | 213 | | |
197 | 214 | | |
198 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
199 | 238 | | |
200 | 239 | | |
201 | 240 | | |
| |||
277 | 316 | | |
278 | 317 | | |
279 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
280 | 323 | | |
281 | 324 | | |
282 | 325 | | |
283 | 326 | | |
| 327 | + | |
284 | 328 | | |
285 | 329 | | |
286 | 330 | | |
| |||
302 | 346 | | |
303 | 347 | | |
304 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
305 | 371 | | |
306 | 372 | | |
307 | 373 | | |
308 | 374 | | |
309 | 375 | | |
310 | 376 | | |
311 | 377 | | |
312 | | - | |
313 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
314 | 391 | | |
315 | 392 | | |
316 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 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 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
106 | 147 | | |
107 | 148 | | |
108 | 149 | | |
| |||
292 | 333 | | |
293 | 334 | | |
294 | 335 | | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
295 | 405 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
666 | 680 | | |
667 | 681 | | |
668 | 682 | | |
| |||
0 commit comments