Skip to content

[#117]: Document and test MessageDisplay hook event compat (v2.1.152)#120

Merged
delexw merged 1 commit into
mainfrom
fix-issue-117
Jun 3, 2026
Merged

[#117]: Document and test MessageDisplay hook event compat (v2.1.152)#120
delexw merged 1 commit into
mainfrom
fix-issue-117

Conversation

@delexw
Copy link
Copy Markdown
Owner

@delexw delexw commented May 31, 2026

Summary

Claude Code v2.1.152 introduces a new MessageDisplay hook event. This PR confirms that the parser already handles it correctly and adds explicit documentation and tests to prove it.

Root cause analysis

  • hook_event in Entry is stored as a plain String (not an enum), so new hook event names are captured without rejection or a code change.
  • All classify paths in classify.rs rescue hook entries based on the presence of a hookEvent field, not an exhaustive match — so MessageDisplay flows through as a ClassifiedMsg::Hook automatically.
  • UUID gaps from hidden messages (if a MessageDisplay hook omits an entry from JSONL entirely) are handled gracefully by the _ => break arm in resolve_live_chain_uuids, which terminates the backward chain walk without panicking.

Changes

src-tauri/src/parser/entry.rs

  • Added a comment on the hook_event field documenting that it is stored as a plain String for forward compatibility (v2.1.152+ MessageDisplay included).
  • Added 2 new tests: parse_entry_captures_message_display_hook_event_as_string and parse_entry_message_display_as_attachment_is_captured.

src-tauri/src/parser/classify.rs

  • Added 3 new tests covering MessageDisplay in all three entry shapes:
    • classify_message_display_progress_entry_produces_hook_msg
    • classify_message_display_system_hook_progress_entry_produces_hook_msg
    • classify_message_display_attachment_entry_produces_hook_msg

src-tauri/src/parser/session.rs

  • Added a comment in resolve_live_chain_uuids explaining the uuid gap assumption for MessageDisplay-hidden entries and how the _ => break arm handles it gracefully.

specs/01-parser-pipeline.md

  • Added a MessageDisplay row to the Version-Compatibility Normalisations table.

Test results

  • vitest: 349 tests passed
  • cargo test: 375 tests passed (includes 5 new tests)
  • cargo clippy -- -D warnings: clean

Fixes #117

Claude Code v2.1.152 adds a new MessageDisplay hook event. The parser
already handles it correctly — hook_event is a plain String, not an
enum, so unknown event names are captured without rejection, and all
classify paths use presence-of-hookEvent checks rather than exhaustive
matching.

This commit:
- Adds a comment on the hook_event field in entry.rs documenting the
  String storage rationale for forward compatibility
- Adds 5 new tests covering MessageDisplay as progress, system/
  hook_progress, and attachment entries
- Adds a comment in session.rs explaining the uuid gap assumption when
  a MessageDisplay hook hides a message entirely: the backward chain
  walk terminates gracefully at the gap via the existing _ => break arm
- Updates specs/01-parser-pipeline.md with a MessageDisplay entry in
  the version-compatibility normalisations table

Fixes #117
@delexw delexw merged commit 4b7290b into main Jun 3, 2026
1 check passed
@delexw delexw deleted the fix-issue-117 branch June 3, 2026 06:46
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.

[Compat] Claude Code v2.1.152: New MessageDisplay hook event may surface in JSONL and modify persisted message text

1 participant