Review normalize command architecture
All checks were successful
ci/woodpecker/tag/release Pipeline was successful

This commit is contained in:
2026-05-09 12:38:06 +00:00
parent 3591041fa8
commit 6dbb7ab17e
3 changed files with 27 additions and 2 deletions

View File

@@ -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":[]}`)

View File

@@ -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,

View File

@@ -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 {