Skip to content

test: comprehensive session-parser test suite (20 tests) - #266

Open
TerminalGravity wants to merge 1 commit into
mainfrom
feat/session-parser-tests
Open

test: comprehensive session-parser test suite (20 tests)#266
TerminalGravity wants to merge 1 commit into
mainfrom
feat/session-parser-tests

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

Adds full test coverage for src/lib/session-parser.ts — one of the core modules with zero tests until now.

20 tests covering:

  • Sync + async parsing parity
  • All event types: prompts, assistant responses, tool calls, sub-agent spawns, errors, compactions
  • Correction detection (user correcting after assistant response)
  • Summary record metadata extraction (branch, sessionId)
  • Edge cases: malformed JSON, empty files, empty content, epoch timestamps
  • findSessionFiles including subagent directory discovery
  • parseAllSessions timestamp sorting and date filtering

All passing ✅

Covers:
- Sync and async parsing parity
- User prompts, assistant responses, tool calls
- Sub-agent spawn detection (Task/dispatch_agent)
- Error tool result capture
- Compaction event detection
- Correction detection after assistant messages
- Summary record branch/sessionId extraction
- Malformed JSON line resilience
- Epoch timestamp normalization
- Empty content/file handling
- findSessionFiles including subagent directories
- parseAllSessions sorting and date filtering
@TerminalGravity

Copy link
Copy Markdown
Collaborator Author

Heads up — this looks like it overlaps with #261 (same title, same test count). Is this a v2 that supersedes #261? If so, we should close #261 to keep the PR list clean.

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