aboutsummaryrefslogtreecommitdiff
path: root/internal/journal/read_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/journal/read_test.go')
-rw-r--r--internal/journal/read_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/journal/read_test.go b/internal/journal/read_test.go
index fb6f77f..676b2bd 100644
--- a/internal/journal/read_test.go
+++ b/internal/journal/read_test.go
@@ -702,3 +702,32 @@ func TestReversedStepsCountsEveryUndoOfARun(t *testing.T) {
}
}
}
+
+// TestEntriesRefusesALineCutInsideItsRunColumn: a crash that cuts the last
+// line inside its run column leaves a prefix of some run's ID - it cannot
+// be called another run's line, so inside this run's window it refuses the
+// run (plan 10 re-check R2).
+func TestEntriesRefusesALineCutInsideItsRunColumn(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "krino.log")
+ w, _ := Open(path)
+ at := time.Date(2026, 9, 11, 10, 2, 3, 0, time.UTC)
+ run := "20260911T100203-ab12"
+ for _, e := range []Entry{
+ {Time: at, Run: run, Action: "run-start", Status: "ok"},
+ {Time: at, Run: run, Dir: "dl", File: "x.pdf", Step: 1, Action: "copy", Status: "ok", Src: "/a/x.pdf", Dst: "/b/x.pdf"},
+ } {
+ if err := w.Append(e); err != nil {
+ t.Fatal(err)
+ }
+ }
+ w.Close()
+ f, err := os.OpenFile(path, os.O_APPEND|os.O_WRONLY, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ f.WriteString("2026-09-11T10:02:04Z\t20260911T10")
+ f.Close()
+ if got, err := Entries(path, run); err == nil {
+ t.Errorf("Entries = %+v, no error; a line cut inside its run column must refuse the run", got)
+ }
+}