Bugfixes and documentation cleanup for v1.0 release.
All checks were successful
ci/woodpecker/tag/release Pipeline was successful
All checks were successful
ci/woodpecker/tag/release Pipeline was successful
This commit is contained in:
@@ -114,7 +114,8 @@ func TestMergeWritesMergedOutputAndReport(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMergeWritesDefaultOutputSchema(t *testing.T) {
|
||||
func TestMergeWritesIntermediateOutputSchema(t *testing.T) {
|
||||
t.Setenv(config.OutputSchemaEnv, "")
|
||||
dir := t.TempDir()
|
||||
input := writeJSONFile(t, dir, "input.json", `{
|
||||
"segments": [
|
||||
@@ -131,10 +132,10 @@ func TestMergeWritesDefaultOutputSchema(t *testing.T) {
|
||||
t.Fatalf("merge failed: %v", err)
|
||||
}
|
||||
|
||||
var transcript schema.DefaultTranscript
|
||||
var transcript schema.IntermediateTranscript
|
||||
readJSON(t, output, &transcript)
|
||||
if transcript.Metadata.OutputSchema != config.OutputSchemaDefault {
|
||||
t.Fatalf("output_schema = %q, want default", transcript.Metadata.OutputSchema)
|
||||
if transcript.Metadata.OutputSchema != config.OutputSchemaIntermediate {
|
||||
t.Fatalf("output_schema = %q, want %q", transcript.Metadata.OutputSchema, config.OutputSchemaIntermediate)
|
||||
}
|
||||
if len(transcript.Segments) != 1 {
|
||||
t.Fatalf("segment count = %d, want 1", len(transcript.Segments))
|
||||
@@ -149,12 +150,12 @@ func TestMergeWritesDefaultOutputSchema(t *testing.T) {
|
||||
}
|
||||
for _, forbidden := range []string{"overlap_groups", "source", "derived_from", "words"} {
|
||||
if strings.Contains(string(outputBytes), forbidden) {
|
||||
t.Fatalf("default output contains %q:\n%s", forbidden, outputBytes)
|
||||
t.Fatalf("intermediate output contains %q:\n%s", forbidden, outputBytes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMergeWritesSeriatimOutputSchema(t *testing.T) {
|
||||
func TestMergeWritesFullOutputSchema(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
input := writeJSONFile(t, dir, "input.json", `{
|
||||
"segments": [
|
||||
@@ -166,7 +167,7 @@ func TestMergeWritesSeriatimOutputSchema(t *testing.T) {
|
||||
err := executeMergeRaw(
|
||||
"--input-file", input,
|
||||
"--output-file", output,
|
||||
"--output-schema", "seriatim",
|
||||
"--output-schema", config.OutputSchemaFull,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("merge failed: %v", err)
|
||||
@@ -203,7 +204,7 @@ func TestMergeWritesMinimalOutputSchema(t *testing.T) {
|
||||
err := executeMerge(
|
||||
"--input-file", input,
|
||||
"--output-file", output,
|
||||
"--output-schema", "minimal",
|
||||
"--output-schema", config.OutputSchemaMinimal,
|
||||
"--report-file", reportPath,
|
||||
)
|
||||
if err != nil {
|
||||
@@ -215,8 +216,8 @@ func TestMergeWritesMinimalOutputSchema(t *testing.T) {
|
||||
if transcript.Metadata.Application != "seriatim" {
|
||||
t.Fatalf("application = %q, want seriatim", transcript.Metadata.Application)
|
||||
}
|
||||
if transcript.Metadata.OutputSchema != "minimal" {
|
||||
t.Fatalf("output_schema = %q, want minimal", transcript.Metadata.OutputSchema)
|
||||
if transcript.Metadata.OutputSchema != config.OutputSchemaMinimal {
|
||||
t.Fatalf("output_schema = %q, want %q", transcript.Metadata.OutputSchema, config.OutputSchemaMinimal)
|
||||
}
|
||||
if got, want := len(transcript.Segments), 2; got != want {
|
||||
t.Fatalf("segment count = %d, want %d", got, want)
|
||||
@@ -330,7 +331,7 @@ func TestMergeValidateMinimalOutputBeforeAssignIDsFails(t *testing.T) {
|
||||
err := executeMerge(
|
||||
"--input-file", input,
|
||||
"--output-file", output,
|
||||
"--output-schema", "minimal",
|
||||
"--output-schema", config.OutputSchemaMinimal,
|
||||
"--postprocessing-modules", "validate-output,assign-ids",
|
||||
)
|
||||
if err == nil {
|
||||
@@ -472,16 +473,16 @@ func TestMergeResolvesOverlapGroupsWithWordRuns(t *testing.T) {
|
||||
|
||||
var transcript model.FinalTranscript
|
||||
readJSON(t, output, &transcript)
|
||||
if len(transcript.OverlapGroups) != 0 {
|
||||
t.Fatalf("overlap groups = %#v, want none", transcript.OverlapGroups)
|
||||
if got, want := len(transcript.OverlapGroups), 1; got != want {
|
||||
t.Fatalf("overlap group count = %d, want %d (%#v)", got, want, transcript.OverlapGroups)
|
||||
}
|
||||
if got, want := len(transcript.Segments), 3; got != want {
|
||||
if got, want := len(transcript.Segments), 2; got != want {
|
||||
t.Fatalf("segment count = %d, want %d", got, want)
|
||||
}
|
||||
|
||||
wantTexts := []string{"outside hello there", "bob reply", "later"}
|
||||
wantSpeakers := []string{"Alice", "Bob", "Alice"}
|
||||
wantRefs := []string{"word-run:1:1:1", "word-run:1:2:1", "word-run:1:1:2"}
|
||||
wantTexts := []string{"outside hello there later", "bob reply"}
|
||||
wantSpeakers := []string{"Alice", "Bob"}
|
||||
wantRefs := []string{"word-run:1:1:1", "word-run:1:2:1"}
|
||||
for index, segment := range transcript.Segments {
|
||||
if segment.ID != index+1 {
|
||||
t.Fatalf("segment %d id = %d, want %d", index, segment.ID, index+1)
|
||||
@@ -498,8 +499,8 @@ func TestMergeResolvesOverlapGroupsWithWordRuns(t *testing.T) {
|
||||
if segment.SourceSegmentIndex != nil {
|
||||
t.Fatalf("segment %d source_segment_index = %d, want nil", index, *segment.SourceSegmentIndex)
|
||||
}
|
||||
if segment.OverlapGroupID != 0 {
|
||||
t.Fatalf("segment %d overlap_group_id = %d, want 0", index, segment.OverlapGroupID)
|
||||
if segment.OverlapGroupID != 1 {
|
||||
t.Fatalf("segment %d overlap_group_id = %d, want 1", index, segment.OverlapGroupID)
|
||||
}
|
||||
}
|
||||
if !equalStrings(transcript.Segments[0].DerivedFrom, []string{inputA + "#0"}) {
|
||||
@@ -516,7 +517,7 @@ func TestMergeResolvesOverlapGroupsWithWordRuns(t *testing.T) {
|
||||
|
||||
var rpt report.Report
|
||||
readJSON(t, reportPath, &rpt)
|
||||
if !hasReportEvent(rpt, "postprocessing", "resolve-overlaps", "processed 1 overlap group(s); changed 1; removed 2 original segment(s); created 3 replacement segment(s)") {
|
||||
if !hasReportEvent(rpt, "postprocessing", "resolve-overlaps", "processed 1 overlap group(s); changed 1; removed 2 original segment(s); created 2 replacement segment(s)") {
|
||||
t.Fatal("expected resolve-overlaps summary report event")
|
||||
}
|
||||
}
|
||||
@@ -1927,7 +1928,7 @@ func TestMergeResolveOverlapsPreservesAbsorbedContextPrefix(t *testing.T) {
|
||||
"--input-file", inputA,
|
||||
"--input-file", inputB,
|
||||
"--speakers", speakers,
|
||||
"--output-schema", "minimal",
|
||||
"--output-schema", config.OutputSchemaMinimal,
|
||||
"--output-file", output,
|
||||
)
|
||||
if err != nil {
|
||||
@@ -1994,7 +1995,7 @@ func executeMerge(args ...string) error {
|
||||
if !hasOutputSchemaFlag(args) {
|
||||
// Most integration tests were written against the full envelope; keep
|
||||
// that behavior unless the caller explicitly asks for another schema.
|
||||
args = append(args, "--output-schema", config.OutputSchemaSeriatim)
|
||||
args = append(args, "--output-schema", config.OutputSchemaFull)
|
||||
}
|
||||
return executeMergeRaw(args...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user