Skip to content

fix(debugger): restore camelCase console levels when reading the log file - #1374

Closed
latekvo wants to merge 4 commits into
mainfrom
fix/log-level-camelcase-roundtrip
Closed

latekvo wants to merge 4 commits into
mainfrom
fix/log-level-camelcase-roundtrip

Conversation

@latekvo

@latekvo latekvo commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Closes #1143

LogFileWriter stores the level uppercased, and parseFlatLine lowercased it back. So startGroup, startGroupCollapsed, endGroup, profileEnd and timeEnd came back all-lowercase from readAll()/readFiltered(). The parser now maps those 5 CDP types back to their canonical spelling. The on-disk format is unchanged. A test in log-file-writer-level.test.ts pins all 5 through readAll() and readFiltered() (fails with the fix reverted).

The impact today is limited to the contract. readAll()'s only production caller is the console socket's backlog replay, and nothing has read consoleSocketUrl since #66 (filed as #1575). readFiltered() has only test callers.

No docs update needed.

Verification

Two throwaway vitest probes, neither committed:

  1. All 18 Runtime.consoleAPICalled types written through the real LogFileWriter, then compared with what readAll() and readFiltered({ level }) return.
  2. The real Chromium JS-runtime-debugger blueprint on a fake CDP. It emits all 18 types, connects a WebSocket to consoleSocketUrl, emits them again, and compares backlog levels with live levels.
cd packages/tool-server && npx vitest run test/debugger/zz-i1143-repro.test.ts test/zz-i1143-verify.test.ts --silent=false

Before (fix reverted):

MISMATCHES: [["startGroup","startgroup"],["startGroupCollapsed","startgroupcollapsed"],["endGroup","endgroup"],["profileEnd","profileend"],["timeEnd","timeend"]]
filter startGroup total: 0
filter timeEnd total: 0
BACKLOG: [...,"startgroup","startgroupcollapsed","endgroup",...,"profileend","count","timeend"]
LIVE:    [...,"startGroup","startGroupCollapsed","endGroup",...,"profileEnd","count","timeEnd"]
Tests  2 failed (2)

After: Tests 2 passed (2). Backlog levels equal live levels for all 18 types.

Checks:

  • npx tsc --build: exit 0
  • vitest run test/debugger test/*js-runtime-debugger*.test.ts: 23 files / 252 tests passed
  • prettier and eslint on the touched file: clean

…file

The flat log stores the level uppercased and parseFlatLine lowercased it
back, so startGroup, startGroupCollapsed, endGroup, profileEnd and timeEnd
came back as startgroup etc. from readAll()/readFiltered(), unlike the live
stream. Map those five CDP types back to their canonical spelling.

Fixes #1143
@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The header and describe title covered only length truncation, and two
comments pointed at a LEVEL_DISPLAY map that no longer exists.
@latekvo

latekvo commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Folded into #1753 as b8750c5, to review together with the other capture fixes.

@latekvo latekvo closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LogFileWriter lowercases camelCase CDP console levels, so console.group/time/profile entries do not round-trip

1 participant