Skip to content

Fix issues #59, #60: Claude Code v2.1.118/v2.1.119 compat fixes#62

Merged
delexw merged 5 commits intomainfrom
fix/issue-batch-2026-04-26_12_14_28
Apr 26, 2026
Merged

Fix issues #59, #60: Claude Code v2.1.118/v2.1.119 compat fixes#62
delexw merged 5 commits intomainfrom
fix/issue-batch-2026-04-26_12_14_28

Conversation

@delexw
Copy link
Copy Markdown
Owner

@delexw delexw commented Apr 26, 2026

Summary

Compatibility fixes for Claude Code v2.1.118 and v2.1.119 JSONL format changes.

Fixes

Changes

File What changed
src-tauri/src/parser/classify.rs Add fork-pointer to noise types
src-tauri/src/parser/entry.rs Add fork fields to Entry; extend parse_entry empty-type guard
src-tauri/src/parser/session.rs Tests for forked session parsing

Tests

All 355 Rust tests and 345 frontend tests pass. New tests added for each fix:

  • parse_entry_forked_from_field_is_captured
  • parse_entry_without_forked_from_is_not_inherited
  • classify_drops_fork_pointer_entry
  • classify_drops_fork_pointer_even_when_role_present
  • parse_entry_with_uuid_but_empty_type_returns_none
  • parse_entry_completely_empty_object_returns_none

delexw added 5 commits April 26, 2026 12:17
v2.1.118 changed /fork to write a compact pointer entry (type:
"fork-pointer") instead of duplicating the full parent conversation
into the forked session JSONL file.

- Add "fork-pointer" to NOISE_ENTRY_TYPES in classify.rs so the pointer
  entry is silently dropped before it reaches the conversation display.
- Add parentSessionId (parent_session_id) and forkSource (fork_source)
  fields to Entry struct to capture pointer data for future parent-session
  linking.
- Add tests covering field capture, uuid-guard, and noise-filter paths.

Closes #60
Before Claude Code v2.1.119, async PostToolUse hooks could write malformed
JSONL entries that have a uuid but no type field (or are completely empty).
parse_entry already guarded against missing uuid/leafUuid, but did not check
for a missing type, so those entries would pass through and potentially cause
unexpected behaviour downstream.

Add entry_type.is_empty() to the existing guard so any entry without a type
is discarded, matching the existing 'entry discarded if broken' policy.

Closes #59
The four test helpers forked_user_line, forked_assistant_line,
new_user_line, and new_assistant_line were building JSONL fixtures
via manual format!() string concatenation with escaped braces.
Rewrite them to use serde_json::json!() + serde_json::to_string(),
consistent with how every other parametric JSONL fixture in the
parser test suite is constructed.
The four forked_*_line / new_*_line helpers existed only to build test
fixtures; they obscured which fields actually trigger the is_inherited
branch and smuggled in irrelevant values (model name, parentUuid,
isSidechain, timestamp) that no fork test asserts on.

Replace with inline raw JSONL strings in each test, keeping only the
fields the branch under test reads:
- forkedFrom present/absent for the is_inherited=true/false split
- usage + requestId for token tests
- timestamp for duration test
- parentUuid chain for the live-chain filter in conversation_view test

Also removes the now-unused 'use serde_json::json;' import.
…nspection

Binary inspection of Claude Code v2.1.119 reveals the original implementation
used invented names:

  fork-pointer      → does not exist; actual type is fork-context-ref
  forkSource        → does not exist; actual pointer fields are
                      forkedSessionId and upToMessageId
  parentSessionId   → exists in binary but belongs to team/subagent context,
                      not fork-context-ref entries

Fixes:
- classify.rs: NOISE_ENTRY_TYPES: replace fork-pointer with fork-context-ref
- entry.rs: replace parent_session_id (parentSessionId) and fork_source
  (forkSource) fields with forked_session_id (forkedSessionId) and
  up_to_message_id (upToMessageId)
- classify.rs tests: update classify_drops_fork_pointer_* to use
  fork-context-ref type
- entry.rs tests: update parse_entry_captures_fork_pointer_fields and
  parse_entry_fork_pointer_without_uuid_returns_none to use fork-context-ref,
  forkedSessionId, and upToMessageId

The forkedFrom field (for pre-v2.1.118 forked sessions) was already correct.
@delexw delexw merged commit 42627a7 into main Apr 26, 2026
1 check passed
@delexw delexw deleted the fix/issue-batch-2026-04-26_12_14_28 branch April 26, 2026 03:54
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.

1 participant