From 6dbb7ab17e0b4a2b88ffe2a9fe7a7f9a397f0c36 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sat, 9 May 2026 12:38:06 +0000 Subject: [PATCH] Review normalize command architecture --- internal/cli/normalize_test.go | 25 +++++++++++++++++++++++++ internal/cli/root.go | 2 +- internal/normalize/parse_test.go | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/internal/cli/normalize_test.go b/internal/cli/normalize_test.go index f54cc58..c0b0218 100644 --- a/internal/cli/normalize_test.go +++ b/internal/cli/normalize_test.go @@ -349,6 +349,31 @@ func TestNormalizeReportIncludesBareArrayShape(t *testing.T) { } } +func TestNormalizeReportDoesNotIncludeTranscriptText(t *testing.T) { + dir := t.TempDir() + const segmentText = "normalize-report-secret-text" + input := writeJSONFile(t, dir, "input.json", `[{"start":1,"end":2,"speaker":"A","text":"`+segmentText+`"}]`) + output := filepath.Join(dir, "normalized.json") + reportPath := filepath.Join(dir, "report.json") + + err := executeNormalize( + "--input-file", input, + "--output-file", output, + "--report-file", reportPath, + ) + if err != nil { + t.Fatalf("normalize failed: %v", err) + } + + var rpt report.Report + readJSON(t, reportPath, &rpt) + for _, event := range rpt.Events { + if strings.Contains(event.Message, segmentText) { + t.Fatalf("report unexpectedly contained transcript text in event %#v", event) + } + } +} + func TestNormalizeReportEmptyInputEmitsWarning(t *testing.T) { dir := t.TempDir() input := writeJSONFile(t, dir, "input.json", `{"segments":[]}`) diff --git a/internal/cli/root.go b/internal/cli/root.go index 9afeaf1..306525d 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -10,7 +10,7 @@ import ( func NewRootCommand() *cobra.Command { cmd := &cobra.Command{ Use: "seriatim", - Short: "Merge per-speaker transcripts into a chronological transcript", + Short: "Merge, trim, and normalize transcript artifacts", Version: buildinfo.Version, SilenceErrors: true, SilenceUsage: true, diff --git a/internal/normalize/parse_test.go b/internal/normalize/parse_test.go index 3a3bb1a..6662cff 100644 --- a/internal/normalize/parse_test.go +++ b/internal/normalize/parse_test.go @@ -80,7 +80,7 @@ func TestParseReaderSegmentsNotArrayFails(t *testing.T) { } func TestParseReaderTopLevelScalarShapesFail(t *testing.T) { - tests := []string{`"text"`, `42`, `null`} + tests := []string{`"text"`, `42`, `null`, `true`} for _, input := range tests { _, err := ParseReader(strings.NewReader(input)) if err == nil {