You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(packaged): attach crash-scene evidence to packaged_runtime_failed (nexu-io#5224)
* feat(packaged): attach crash-scene evidence to packaged_runtime_failed
The pre-daemon startup crash class (`packaged_runtime_failed`, nexu-io#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.
0 commit comments