fix(T-994): Preserve real session timestamps when resolving file-backed transcripts#154
Conversation
Code Review — PR #154: Preserve real session timestamps when resolving file-backed transcriptsOverviewThis PR fixes a consistency gap between The change is well-scoped, clearly motivated, and the tests are properly structured. IssuesInaccurate comment on The doc comment says:
This is incorrect. Only Claude seeks
The switch covers
For Test CoverageTests are well-written and follow the project's testing guidelines:
Suggestions for additional tests (non-blocking):
Minor
SummaryThe fix is correct and the approach is sound. The main actionable item is updating the misleading comment ("For Claude and Codex" → "For Claude"). The Kiro IDE gap is worth a comment or explicit case so future contributors don't have to reconstruct this reasoning. Everything else is minor. |
Code Review: fix(T-994) — Preserve real session timestamps in file-backed resolverOverviewGood, focused fix for a real bug: What works well
Issues and suggestions1. Tests ignore The new subtests use // Current (new tests):
data, _ := json.Marshal(entry)
// Should be (consistent with mustMarshal helper already in file):
data := mustMarshal(t, entry)This matters because a silently malformed fixture won't produce the right transcript content, causing the test to pass for the wrong reason (falling back to 2. Missing test: fallback-to-modTime path There's no test verifying that when source-specific resolution fails (e.g., a Claude file with no parseable timestamp), t.Run("claude_fallback_to_modtime", func(t *testing.T) {
// Write a JSONL file with no timestamp field
// Set mtime to a known time
// Assert resolved.Metadata.CreatedAt == mtime
})3. Minor: seek error is silently discarded _, _ = f.Seek(0, io.SeekStart)Discarding seek errors is a common and usually acceptable pattern for in-process files, but if the seek fails, the subsequent transcript read will return garbled data. A SummaryThe core fix is correct and well-structured. The main actionable items are:
Everything else is clean and ready to merge after those two items are addressed. |
…eatedAt - Fix inaccurate comment: only Claude seeks the file back, not Codex - Add explicit SourceKiroCLI/SourceKiroIDE switch cases with explanatory comment documenting why they fall through to modTime
24a5d84 to
dbf2cc9
Compare
Code Review: PR #154 — Preserve real session timestamps for file-backed transcriptsOverviewThis PR fixes T-994: What's Good
Suggestions / Minor Concerns1. Kiro IDE timestamp not extracted (known limitation, but worth tracking) The comment says: // Kiro IDE embeds startTime in JSON but requires full parsing; fall
// through to modTime for now.This is fine as a pragmatic choice, but it means Kiro IDE sessions resolved by file path will still show incorrect timestamps. Consider opening a follow-up ticket so it doesn't get forgotten. 2. Seek errors silently dropped _, _ = f.Seek(0, io.SeekStart)For a regular file this is safe and the pattern is common in this codebase, so it's not a blocking concern. A log line at debug level would help diagnose edge cases on networked or virtual filesystems, but this is a very minor nit. 3. No test for the modTime fallback The three subtests prove the happy paths. There's no test verifying that when transcript parsing fails (e.g. empty or corrupt file), t.Run("claude_fallback_to_modtime", func(t *testing.T) {
// write an empty or non-JSONL file, set a known mtime
// resolve and assert CreatedAt == known mtime
})4. Copilot test drives through The test goes through the full SummaryThis is a well-scoped, low-risk bug fix with good test coverage of the primary code paths. The implementation is consistent with existing patterns and the fallback behaviour is correct. The only meaningful gap is the Kiro IDE path, which is explicitly acknowledged. Happy to approve once a follow-up ticket is filed for the Kiro IDE case.
|
Fixes Transit ticket T-994: Preserve real session timestamps when resolving file-backed transcripts