go-session/TODO.md
Snider f40caaa593 test: add comprehensive Phase 0 test suite — 67 tests, 90.9% coverage
Add parser_test.go (22 tests), search_test.go (9 tests), html_test.go (6 tests),
video_test.go (12 tests), and bench_test.go (4 benchmarks) covering all Phase 0
TODO items:

- ParseTranscript: minimal JSONL, all 7 tool types, errors, truncated/malformed
  input, large sessions (1100+ events), nested array/map results, mixed content
- ListSessions: empty dir, single/multi sorted, non-JSONL ignored, modtime fallback
- extractToolInput: all tool types plus nil, invalid JSON, unknown tool fallback
- extractResultContent: string, array, map, and other types
- Search: empty dir, no matches, multi-match, case insensitive, output matching
- RenderHTML: basic, empty, errors, XSS escaping, label types, invalid path
- generateTape/extractCommand: all event types, empty/failed commands, truncation
- Benchmarks: 2.2MB and 11MB ParseTranscript, ListSessions, Search with b.Loop()

go vet ./... clean, go test -race ./... clean.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 05:01:28 +00:00

2.2 KiB

TODO.md — go-session

Dispatched from core/go orchestration. Pick up tasks in order.


Phase 0: Hardening & Test Coverage

  • Add parser tests — Test ParseTranscript() with: minimal valid JSONL (1 user + 1 assistant message), tool call events (Bash, Read, Edit, Write, Grep, Glob, Task), truncated JSONL (incomplete last line), empty file, malformed JSON lines (should skip gracefully), very large session (1000+ events), nested tool results with arrays and maps. Also added HTML, video, and search tests. 67 tests, 90.9% coverage.
  • Add ListSessions tests — Test with: empty directory, single session, multiple sessions sorted by date, non-.jsonl files ignored, malformed JSONL fallback to modtime.
  • Tool extraction coverage — Test extractToolInput() for each supported tool type (Bash, Read, Edit, Write, Grep, Glob, Task) plus nil input, invalid JSON, and unknown tool fallback.
  • Benchmark parsingBenchmarkParseTranscript with 2.2MB (5K tools) and 11MB (25K tools) JSONL files. Plus BenchmarkListSessions and BenchmarkSearch. Uses b.Loop() (Go 1.25+).
  • go vet ./... clean — Verified clean, no warnings.

Phase 1: Parser Robustness

  • Handle truncated JSONL (incomplete final line, missing closing brace)
  • Handle very large sessions (streaming parse, avoid loading entire file into memory)
  • Handle non-standard tool formats (custom MCP tools, unknown tool names)
  • Add graceful error recovery — skip malformed lines, log warnings

Phase 2: Analytics

  • Session duration stats (start time, end time, wall clock, active time)
  • Tool usage frequency (count per tool type, percentage breakdown)
  • Error rate tracking (failed tool calls, retries, panics)
  • Token usage estimation from assistant message lengths

Phase 3: Timeline UI

  • Feed parsed events into go-html for visual session timeline
  • Colour-code events by type (tool call, assistant message, user message)
  • Add collapsible detail panels for long tool outputs
  • Export timeline as standalone HTML file

Workflow

  1. Virgil in core/go writes tasks here after research
  2. This repo's dedicated session picks up tasks in phase order
  3. Mark [x] when done, note commit hash