Tighten Seriatim input validation

This commit is contained in:
2026-07-03 23:14:33 +00:00
parent 91bec3ae52
commit 39fcfba605
3 changed files with 73 additions and 11 deletions

View File

@@ -209,7 +209,7 @@ func TestParseRejectsInvalidInput(t *testing.T) {
{
name: "non-numeric end",
raw: validJSONWithSegment(`"id":"s1","start":0,"end":"late","speaker":"Narrator","text":"Synthetic text."`),
wantErr: []string{"segments", "json"},
wantErr: []string{"segment[0]", "end", "number"},
},
{
name: "non-finite timestamp",
@@ -221,6 +221,11 @@ func TestParseRejectsInvalidInput(t *testing.T) {
raw: validJSONWithSegment(`"id":"s1","start":2,"end":1,"speaker":"Narrator","text":"Synthetic text."`),
wantErr: []string{"end", "start"},
},
{
name: "end before start beyond float precision",
raw: validJSONWithSegment(`"id":"s1","start":9007199254740993,"end":9007199254740992,"speaker":"Narrator","text":"Synthetic text."`),
wantErr: []string{"end", "start"},
},
}
for _, tt := range tests {