Repository navigation
fix(host): keep the diagnostics report when a log line is unusable - #2594
Conversation
The reader of logs/diagnostics.jsonl keeps a line on a numeric time and a string text alone, but entryLine trusted level, source and time as well. One hand-edited line without a level, or with "time":1e400 (JSON parses it as Infinity), threw inside reportMarkdown(), so the Diagnostics panel's report and the downloaded log were both lost. Default the parts the reader does not guarantee - level to `error`, source to `host` - and leave out a timestamp that is not a finite number, the way the browser-entry reader already defaults a missing level. Fixes #2591 Docs-not-needed: a render-side guard on an existing log line; no subsystem behaviour changes
|
Verdict: PASS at d60c1b6 Ran at this tip: Red first, at this tip: with only Scope: the compare The fix defaults the level to Check-runs at this tip are all terminal: |
Written-by: Dev
Fixes #2591
Owner: Dev
Reviewer: Reviewer
Tip SHA: d60c1b6
Base: 8126953
What changed
entryLinerendered a line withentry.level.toUpperCase()andnew Date(entry.time).toISOString(), while the reader oflogs/diagnostics.jsonlkeeps a line on a numerictimeand a stringtextalone. One hand-edited line without a level — or"time":1e400, which JSON parses asInfinity— threw insidereportMarkdown(), so the Diagnostics report and the downloaded log were both lost. The renderer now defaults what the reader does not guarantee (level →error, source →host) and leaves the time out when it is not a finite number, the way the browser-entry reader already defaults a missing level.Reproduction
core/test/diagnostics-corrupt-line.test.jsboots the diagnostics host over a home whose log holds such a line. Atmainit fails withCannot read properties of undefined (reading 'toUpperCase')andRangeError: Invalid time value; at this tip both cases pass, and revertingcore/src/host/diagnostics.jstomainmakes them red again.Ran at d60c1b6
node --import ./test/harness-resolve.mjs --test test/diagnostics-corrupt-line.test.js— 2/2 passnode --import ./test/harness-resolve.mjs --test test/diagnostics.test.js test/diagnostics-clear-endpoint.test.js— 64/64 passtest/*.test.js,--test-concurrency=6) — 3006 of 3009; the three failures are this box, not this change:usage-fieldsspawnspython3(absent here), andcheck-arch-docs's two git tests need an executable/tmp(this container mounts/tmpnoexec)TZ=UTC npm --prefix core run lint— 0 errors,arch-docs: OKnode scripts/lint-plugins.mjs— 0 errorsnode core/scripts/build-client.mjs --check— cleannode scripts/ds-bot-patches.mjs check—ok core/ equals ds-bot/ + patches/ds-bot/node .github/scripts/changelog.mjs check— 5 fragments well formedNot run here:
npm run verifyas one process — its test runner's default concurrency spawns 191 node processes on this shared box and dies withspawn EAGAIN; the commands above are the same steps run with bounded concurrency. CI runs the real verify on a machine without those limits.dev/bench.sh smoke …) — it needs a DeepSeek Harness checkout that this box does not have; the change is a pure render guard and CI'slive · ubuntu · Node 24job is green at this tipGenerated files
patches/ds-bot/0001-core-fixes.patchandpatches/ds-bot/files/test/diagnostics-corrupt-line.test.jsare regenerated withnode scripts/ds-bot-patches.mjs generate, not hand-edited. Base proven:git diff origin/main...HEAD --statlists exactly the five files below.Docs-not-needed: a render-side guard on an existing log line; no subsystem behaviour changes
Checkpoint
{ "pr": 2594, "claim": "Dev", "issue": 2591, "summary": "One corrupt line in logs/diagnostics.jsonl no longer costs the whole Diagnostics report. entryLine now defaults the level and source the log reader does not guarantee, and leaves out a timestamp that is not a finite number. The new test boots the host over a log holding such a line and covers both the missing-level and the 1e400 case.", "files": [ "core/src/host/diagnostics.js", "core/test/diagnostics-corrupt-line.test.js" ], "checks": { "ran": "node --import ./test/harness-resolve.mjs --test test/diagnostics-corrupt-line.test.js test/diagnostics.test.js test/diagnostics-clear-endpoint.test.js; TZ=UTC npm --prefix core run lint; node scripts/lint-plugins.mjs; node core/scripts/build-client.mjs --check; node scripts/ds-bot-patches.mjs check; node .github/scripts/changelog.mjs check", "result": "green", "at": "d60c1b6adb2afae93995a12b0d346d484cf853ee" }, "next": "none — ready for review" }