Clean up pipeline test naming
This commit is contained in:
@@ -129,8 +129,8 @@ func TestRunManifestIncludesPipelineAndArtifactLaneFields(t *testing.T) {
|
||||
PipelineDigest: "sha256:abc123",
|
||||
ArtifactLanes: []ArtifactLaneManifest{
|
||||
{
|
||||
ID: "spells",
|
||||
Extractor: "spell-extractor",
|
||||
ID: "events",
|
||||
Extractor: "event-extractor",
|
||||
Merger: "appendorder",
|
||||
Normalizer: "noop",
|
||||
Validators: []string{"grounded"},
|
||||
|
||||
@@ -15,7 +15,7 @@ func TestResolvePipelineWithExplicitModules(t *testing.T) {
|
||||
catalog := newProfileCatalog(t)
|
||||
registerProfileSpecs(t, catalog,
|
||||
ModuleSpec{Key: "window", Stage: StageChunk, Requires: []string{"source"}, Provides: []string{"chunk"}},
|
||||
ModuleSpec{Key: "npc-extractor", Stage: StageExtract, Requires: []string{"chunk"}, Provides: []string{"candidate"}},
|
||||
ModuleSpec{Key: "record-extractor", Stage: StageExtract, Requires: []string{"chunk"}, Provides: []string{"candidate"}},
|
||||
ModuleSpec{Key: "dedupe", Stage: StageMerge, Requires: []string{"candidate"}, Provides: []string{"merged"}},
|
||||
ModuleSpec{Key: "canonical", Stage: StageNormalize, Requires: []string{"merged"}, Provides: []string{"normalized"}},
|
||||
ModuleSpec{Key: "schema-check", Stage: StageValidate, Requires: []string{"normalized"}, Provides: []string{"validated"}},
|
||||
@@ -29,8 +29,8 @@ func TestResolvePipelineWithExplicitModules(t *testing.T) {
|
||||
"size": 10,
|
||||
}},
|
||||
Artifacts: map[string]ArtifactLaneProfile{
|
||||
" npcs ": {
|
||||
Extract: ModuleBinding{Module: " npc-extractor ", LLMProfile: " careful "},
|
||||
" records ": {
|
||||
Extract: ModuleBinding{Module: " record-extractor ", LLMProfile: " careful "},
|
||||
Merge: Binding(" dedupe "),
|
||||
Normalize: Binding(" canonical "),
|
||||
Validators: []ModuleBinding{Binding(" schema-check ")},
|
||||
@@ -58,10 +58,10 @@ func TestResolvePipelineWithExplicitModules(t *testing.T) {
|
||||
t.Fatalf("len(ArtifactLanes) = %d, want 1", len(resolved.ArtifactLanes))
|
||||
}
|
||||
lane := resolved.ArtifactLanes[0]
|
||||
if lane.ID != "npcs" {
|
||||
t.Fatalf("lane.ID = %q, want npcs", lane.ID)
|
||||
if lane.ID != "records" {
|
||||
t.Fatalf("lane.ID = %q, want records", lane.ID)
|
||||
}
|
||||
if !reflect.DeepEqual(lane.Extract, ModuleBinding{Module: "npc-extractor", LLMProfile: "careful"}) {
|
||||
if !reflect.DeepEqual(lane.Extract, ModuleBinding{Module: "record-extractor", LLMProfile: "careful"}) {
|
||||
t.Fatalf("lane.Extract = %#v, want explicit extractor", lane.Extract)
|
||||
}
|
||||
if lane.Merge.Module != "dedupe" || lane.Normalize.Module != "canonical" {
|
||||
@@ -83,7 +83,7 @@ func TestResolvePipelineAppliesDefaults(t *testing.T) {
|
||||
ID: "defaulted",
|
||||
Input: Binding("text"),
|
||||
Artifacts: map[string]ArtifactLaneProfile{
|
||||
"spells": {Extract: Binding("spell-extractor")},
|
||||
"events": {Extract: Binding("event-extractor")},
|
||||
},
|
||||
}, ResolveOptions{}, newProfileCatalog(t))
|
||||
if err != nil {
|
||||
@@ -113,13 +113,13 @@ func TestResolvePipelineAppliesDefaults(t *testing.T) {
|
||||
|
||||
func TestResolvePipelineSelectsOnlyRequestedLanes(t *testing.T) {
|
||||
profile := multiLaneProfile()
|
||||
resolved, err := ResolvePipeline(profile, ResolveOptions{Only: []string{" treasure ", "spells", "treasure"}}, newProfileCatalog(t))
|
||||
resolved, err := ResolvePipeline(profile, ResolveOptions{Only: []string{" summaries ", "events", "summaries"}}, newProfileCatalog(t))
|
||||
if err != nil {
|
||||
t.Fatalf("ResolvePipeline() error = %v, want nil", err)
|
||||
}
|
||||
|
||||
got := laneIDs(resolved.ArtifactLanes)
|
||||
want := []string{"spells", "treasure"}
|
||||
want := []string{"events", "summaries"}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("lane IDs = %#v, want %#v", got, want)
|
||||
}
|
||||
@@ -158,7 +158,7 @@ func TestResolvePipelineRejectsEmptyPipelineID(t *testing.T) {
|
||||
ID: " ",
|
||||
Input: Binding("text"),
|
||||
Artifacts: map[string]ArtifactLaneProfile{
|
||||
"spells": {Extract: Binding("spell-extractor")},
|
||||
"events": {Extract: Binding("event-extractor")},
|
||||
},
|
||||
}, ResolveOptions{}, newProfileCatalog(t))
|
||||
if err == nil {
|
||||
@@ -171,7 +171,7 @@ func TestResolvePipelineRejectsMissingInput(t *testing.T) {
|
||||
_, err := ResolvePipeline(PipelineProfile{
|
||||
ID: "missing-input",
|
||||
Artifacts: map[string]ArtifactLaneProfile{
|
||||
"spells": {Extract: Binding("spell-extractor")},
|
||||
"events": {Extract: Binding("event-extractor")},
|
||||
},
|
||||
}, ResolveOptions{}, newProfileCatalog(t))
|
||||
if err == nil {
|
||||
@@ -192,7 +192,7 @@ func TestResolvePipelineRejectsUnknownModuleKeys(t *testing.T) {
|
||||
ID: "unknown-input",
|
||||
Input: Binding("missing-input"),
|
||||
Artifacts: map[string]ArtifactLaneProfile{
|
||||
"spells": {Extract: Binding("spell-extractor")},
|
||||
"events": {Extract: Binding("event-extractor")},
|
||||
},
|
||||
},
|
||||
want: []string{"unknown-input", "input", "missing-input"},
|
||||
@@ -208,42 +208,42 @@ func TestResolvePipelineRejectsUnknownModuleKeys(t *testing.T) {
|
||||
{
|
||||
name: "extract",
|
||||
profile: withProfileChange(func(profile PipelineProfile) PipelineProfile {
|
||||
lane := profile.Artifacts["spells"]
|
||||
lane := profile.Artifacts["events"]
|
||||
lane.Extract = Binding("missing-extractor")
|
||||
profile.Artifacts["spells"] = lane
|
||||
profile.Artifacts["events"] = lane
|
||||
return profile
|
||||
}),
|
||||
want: []string{"baseline", "spells", "extract", "missing-extractor"},
|
||||
want: []string{"baseline", "events", "extract", "missing-extractor"},
|
||||
},
|
||||
{
|
||||
name: "merge",
|
||||
profile: withProfileChange(func(profile PipelineProfile) PipelineProfile {
|
||||
lane := profile.Artifacts["spells"]
|
||||
lane := profile.Artifacts["events"]
|
||||
lane.Merge = Binding("missing-merge")
|
||||
profile.Artifacts["spells"] = lane
|
||||
profile.Artifacts["events"] = lane
|
||||
return profile
|
||||
}),
|
||||
want: []string{"baseline", "spells", "merge", "missing-merge"},
|
||||
want: []string{"baseline", "events", "merge", "missing-merge"},
|
||||
},
|
||||
{
|
||||
name: "normalize",
|
||||
profile: withProfileChange(func(profile PipelineProfile) PipelineProfile {
|
||||
lane := profile.Artifacts["spells"]
|
||||
lane := profile.Artifacts["events"]
|
||||
lane.Normalize = Binding("missing-normalize")
|
||||
profile.Artifacts["spells"] = lane
|
||||
profile.Artifacts["events"] = lane
|
||||
return profile
|
||||
}),
|
||||
want: []string{"baseline", "spells", "normalize", "missing-normalize"},
|
||||
want: []string{"baseline", "events", "normalize", "missing-normalize"},
|
||||
},
|
||||
{
|
||||
name: "validate",
|
||||
profile: withProfileChange(func(profile PipelineProfile) PipelineProfile {
|
||||
lane := profile.Artifacts["spells"]
|
||||
lane := profile.Artifacts["events"]
|
||||
lane.Validators = []ModuleBinding{Binding("missing-validator")}
|
||||
profile.Artifacts["spells"] = lane
|
||||
profile.Artifacts["events"] = lane
|
||||
return profile
|
||||
}),
|
||||
want: []string{"baseline", "spells", "validate", "missing-validator"},
|
||||
want: []string{"baseline", "events", "validate", "missing-validator"},
|
||||
},
|
||||
{
|
||||
name: "output",
|
||||
@@ -284,23 +284,23 @@ func TestResolvePipelineRejectsMissingCapabilities(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "extract",
|
||||
spec: ModuleSpec{Key: "spell-extractor", Stage: StageExtract, Requires: []string{"missing"}},
|
||||
want: []string{"baseline", "spells", "extract", "spell-extractor", "missing"},
|
||||
spec: ModuleSpec{Key: "event-extractor", Stage: StageExtract, Requires: []string{"missing"}},
|
||||
want: []string{"baseline", "events", "extract", "event-extractor", "missing"},
|
||||
},
|
||||
{
|
||||
name: "merge",
|
||||
spec: ModuleSpec{Key: "appendorder", Stage: StageMerge, Requires: []string{"missing"}},
|
||||
want: []string{"baseline", "spells", "merge", "appendorder", "missing"},
|
||||
want: []string{"baseline", "events", "merge", "appendorder", "missing"},
|
||||
},
|
||||
{
|
||||
name: "normalize",
|
||||
spec: ModuleSpec{Key: "noop", Stage: StageNormalize, Requires: []string{"missing"}},
|
||||
want: []string{"baseline", "spells", "normalize", "noop", "missing"},
|
||||
want: []string{"baseline", "events", "normalize", "noop", "missing"},
|
||||
},
|
||||
{
|
||||
name: "validate",
|
||||
spec: ModuleSpec{Key: "grounded", Stage: StageValidate, Requires: []string{"missing"}},
|
||||
want: []string{"baseline", "spells", "validate", "grounded", "missing"},
|
||||
want: []string{"baseline", "events", "validate", "grounded", "missing"},
|
||||
},
|
||||
{
|
||||
name: "output",
|
||||
@@ -313,9 +313,9 @@ func TestResolvePipelineRejectsMissingCapabilities(t *testing.T) {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
catalog := newProfileCatalogWithOverride(t, test.spec)
|
||||
profile := baselineProfile()
|
||||
lane := profile.Artifacts["spells"]
|
||||
lane := profile.Artifacts["events"]
|
||||
lane.Validators = []ModuleBinding{Binding("grounded")}
|
||||
profile.Artifacts["spells"] = lane
|
||||
profile.Artifacts["events"] = lane
|
||||
|
||||
_, err := ResolvePipeline(profile, ResolveOptions{}, catalog)
|
||||
if err == nil {
|
||||
@@ -333,7 +333,7 @@ func TestResolvePipelineOrdersLanesDeterministically(t *testing.T) {
|
||||
}
|
||||
|
||||
got := laneIDs(resolved.ArtifactLanes)
|
||||
want := []string{"items", "spells", "treasure"}
|
||||
want := []string{"events", "notes", "summaries"}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("lane IDs = %#v, want %#v", got, want)
|
||||
}
|
||||
@@ -346,8 +346,8 @@ func TestResolvePipelineDigestIsDeterministicForEquivalentMaps(t *testing.T) {
|
||||
Output: Binding("json"),
|
||||
Chunk: ModuleBinding{Module: "generic", Options: map[string]any{"b": 2, "a": 1}},
|
||||
Artifacts: map[string]ArtifactLaneProfile{
|
||||
"spells": {Extract: Binding("spell-extractor")},
|
||||
"items": {Extract: Binding("item-extractor")},
|
||||
"events": {Extract: Binding("event-extractor")},
|
||||
"notes": {Extract: Binding("note-extractor")},
|
||||
},
|
||||
}
|
||||
right := PipelineProfile{
|
||||
@@ -356,8 +356,8 @@ func TestResolvePipelineDigestIsDeterministicForEquivalentMaps(t *testing.T) {
|
||||
Output: Binding("json"),
|
||||
Chunk: ModuleBinding{Module: "generic", Options: map[string]any{"a": 1, "b": 2}},
|
||||
Artifacts: map[string]ArtifactLaneProfile{
|
||||
"items": {Extract: Binding("item-extractor")},
|
||||
"spells": {Extract: Binding("spell-extractor")},
|
||||
"notes": {Extract: Binding("note-extractor")},
|
||||
"events": {Extract: Binding("event-extractor")},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ func baselineProfile() PipelineProfile {
|
||||
ID: "baseline",
|
||||
Input: Binding("text"),
|
||||
Artifacts: map[string]ArtifactLaneProfile{
|
||||
"spells": {Extract: Binding("spell-extractor")},
|
||||
"events": {Extract: Binding("event-extractor")},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -444,9 +444,9 @@ func multiLaneProfile() PipelineProfile {
|
||||
profile := baselineProfile()
|
||||
profile.ID = "multi"
|
||||
profile.Artifacts = map[string]ArtifactLaneProfile{
|
||||
"treasure": {Extract: Binding("item-extractor")},
|
||||
"spells": {Extract: Binding("spell-extractor")},
|
||||
"items": {Extract: Binding("item-extractor")},
|
||||
"summaries": {Extract: Binding("note-extractor")},
|
||||
"events": {Extract: Binding("event-extractor")},
|
||||
"notes": {Extract: Binding("note-extractor")},
|
||||
}
|
||||
return profile
|
||||
}
|
||||
@@ -517,8 +517,8 @@ func defaultProfileSpecs() []ModuleSpec {
|
||||
return []ModuleSpec{
|
||||
ModuleSpec{Key: "text", Stage: StageInput, Provides: []string{"source"}},
|
||||
ModuleSpec{Key: "generic", Stage: StageChunk, Requires: []string{"source"}, Provides: []string{"chunk"}},
|
||||
ModuleSpec{Key: "spell-extractor", Stage: StageExtract, Requires: []string{"chunk"}, Provides: []string{"candidate"}},
|
||||
ModuleSpec{Key: "item-extractor", Stage: StageExtract, Requires: []string{"chunk"}, Provides: []string{"candidate"}},
|
||||
ModuleSpec{Key: "event-extractor", Stage: StageExtract, Requires: []string{"chunk"}, Provides: []string{"candidate"}},
|
||||
ModuleSpec{Key: "note-extractor", Stage: StageExtract, Requires: []string{"chunk"}, Provides: []string{"candidate"}},
|
||||
ModuleSpec{Key: "appendorder", Stage: StageMerge, Requires: []string{"candidate"}, Provides: []string{"merged"}},
|
||||
ModuleSpec{Key: "noop", Stage: StageNormalize, Requires: []string{"merged"}, Provides: []string{"normalized"}},
|
||||
ModuleSpec{Key: "grounded", Stage: StageValidate, Requires: []string{"normalized"}, Provides: []string{"validated"}},
|
||||
|
||||
Reference in New Issue
Block a user