Skip to content

feat: group identical consecutive console messages in list_console_messages#1939

Merged
OrKoN merged 1 commit intoChromeDevTools:mainfrom
masamaru0513:feat/group-identical-console-messages
Apr 23, 2026
Merged

feat: group identical consecutive console messages in list_console_messages#1939
OrKoN merged 1 commit intoChromeDevTools:mainfrom
masamaru0513:feat/group-identical-console-messages

Conversation

@masamaru0513
Copy link
Copy Markdown
Contributor

@masamaru0513 masamaru0513 commented Apr 22, 2026

Summary

Group consecutive identical console messages in list_console_messages, similar to Chrome DevTools' console grouping behavior.

Fixes #904

Changes

  • Introduce GroupedConsoleFormatter subclass that extends ConsoleFormatter and overrides toString() / toJSON() for count-aware formatting
  • Add ConsoleFormatter.groupConsecutive() static method that groups consecutive messages with the same type, text, and argument count
  • Apply grouping before pagination so grouped counts are accurate and page sizes reflect the collapsed view
  • Add unit tests for grouping logic, string formatting, and JSON output

Key design decisions

Output example

msgid=1 [log] hello world (1 args) [5 times]

Testing

  • Unit tests in tests/formatters/ConsoleFormatterGrouping.test.ts
  • Manual verification: identical messages (×5), mixed pattern (A,A,B,A,A → A×2, B×1, A×2)

@masamaru0513 masamaru0513 force-pushed the feat/group-identical-console-messages branch 2 times, most recently from 46d187b to 65c63d8 Compare April 22, 2026 13:40
Comment thread src/formatters/ConsoleFormatter.ts Outdated
@masamaru0513 masamaru0513 force-pushed the feat/group-identical-console-messages branch from 65c63d8 to 6e3d0de Compare April 22, 2026 14:00
@masamaru0513
Copy link
Copy Markdown
Contributor Author

masamaru0513 commented Apr 22, 2026

@OrKoN
Refactored as suggested, here's a summary of the changes:

  • Introduced GroupedConsoleFormatter subclass that overrides toString() / toJSON()
  • Dropped lastId; only the first message's ID is used
  • No new methods added to the formatter interface
  • ConsoleFormatter and GroupedConsoleFormatter are interchangeable via the same interface

Ready for another look when you get a chance. Thanks!

@OrKoN
Copy link
Copy Markdown
Collaborator

OrKoN commented Apr 22, 2026

Please update the PR description accordingly.

@OrKoN OrKoN self-requested a review April 22, 2026 14:07
@masamaru0513
Copy link
Copy Markdown
Contributor Author

masamaru0513 commented Apr 22, 2026

@OrKoN
Updated the PR description. Sorry about that.

…ssages

Group consecutive console messages with the same type, text, and argument
count into a single entry with a count indicator (e.g. [5 times]).

Introduces GroupedConsoleFormatter subclass that extends ConsoleFormatter
to handle grouped message display.
@OrKoN OrKoN force-pushed the feat/group-identical-console-messages branch from 6e3d0de to 4c95f28 Compare April 23, 2026 09:42
Copy link
Copy Markdown
Collaborator

@OrKoN OrKoN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@OrKoN OrKoN added this pull request to the merge queue Apr 23, 2026
Merged via the queue into ChromeDevTools:main with commit dbddb2e Apr 23, 2026
17 checks passed
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.

Identical console messages should be grouped together in the list_console_messages tool

2 participants