Parser, HTML renderer, video/tape generator, and search function tests with table-driven subtests and inline JSONL fixtures. Adds testify for assertions. go vet clean. Co-Authored-By: Charon <developers@lethean.io>
1.9 KiB
1.9 KiB
FINDINGS.md -- go-session
2026-02-19: Split from core/go (Virgil)
Origin
Extracted from forge.lthn.ai/core/go pkg/session/ on 19 Feb 2026.
Architecture
- Parses Claude Code JSONL transcripts into an
Eventarray - Each event has type, timestamp, content, and optional tool metadata
- Supported tool types: Bash, Read, Edit, Write, Grep, Glob, Task
Dependencies
- Zero external dependencies at runtime -- standard library only (
encoding/json,bufio,os) - Test dependency:
github.com/stretchr/testify(assert/require)
Tests
- Test coverage for JSONL parsing and event type detection
2026-02-20: Phase 0 Hardening (Charon)
Test Coverage
- 51 tests across 4 test files, 90.9% statement coverage
parser_test.go— 13 tests + 12 extractToolInput subtests + 5 extractResultContent subtests + 5 truncate subtests + 5 ListSessions tests + benchmarkhtml_test.go— 7 RenderHTML tests + 4 shortID subtests + 6 formatDuration subtestssearch_test.go— 9 Search tests covering cross-session matching, case insensitivity, empty dirs, malformed sessionsvideo_test.go— 8 generateTape tests + 1 RenderMP4 error test + 5 extractCommand subtests
Observations
extractCommand()naively splits on first#— commands containing literal#(e.g. inside quotes) get truncated. Documented in test, not a bug per se since the parser always constructscommand + " # " + description.RenderMP4()is untestable without the externalvhsbinary. Tests covergenerateTape()(the pure logic) and verifyRenderMP4returns a clear error when vhs is absent.extractResultContent()handles string,[]interface{}, andmap[string]interface{}content types. All three paths plus nil are tested.ListSessionsfalls back to file mod time when no valid timestamps are found in a JSONL file.go vet ./...was clean from the start — no fixes needed.