Collect previous history for artifact prerequisites
This commit is contained in:
@@ -423,7 +423,7 @@ func collectPreparePreviousRequirements(cfg *config.Config, effective artifacts.
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return artifacts.CollectPreviousArtifactRequirements(cfg.ConcreteArtifacts(), effective), nil
|
||||
return artifacts.CollectPreviousArtifactRequirements(cfg.ConcreteArtifacts(), effective)
|
||||
}
|
||||
|
||||
func clearManagedPreviousState(paths artifacts.SessionPaths) error {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package stage
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/config"
|
||||
@@ -46,6 +47,40 @@ func TestPrepareSemanticConfigSensitivity(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestPrepareSemanticConfigIncludesPrerequisiteHistory(t *testing.T) {
|
||||
env := initialSemanticEnv()
|
||||
definitions := map[string]config.ScriptoriumArtifactConfig{
|
||||
"child": {Enabled: true, DependsOn: []string{"parent"}},
|
||||
"parent": {}, "other": {},
|
||||
}
|
||||
env.Config.Pipeline.Scriptorium = &config.ScriptoriumConfig{Artifacts: definitions}
|
||||
env.Config.ArtifactCatalog = &config.ArtifactCatalog{Artifacts: definitions}
|
||||
before, err := buildPrepareSemanticConfig(env)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
parent := definitions["parent"]
|
||||
parent.Inputs = map[string]config.ScriptoriumInputConfig{"history": {Source: "narratio.previous_session.artifact.history", Required: true}}
|
||||
definitions["parent"] = parent
|
||||
after, err := buildPrepareSemanticConfig(env)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if reflect.DeepEqual(before, after) {
|
||||
t.Fatal("reachable history did not change preparation evidence")
|
||||
}
|
||||
other := definitions["other"]
|
||||
other.Inputs = map[string]config.ScriptoriumInputConfig{"history": {Source: "narratio.previous_session.artifact.other", Required: true}}
|
||||
definitions["other"] = other
|
||||
unrelated, err := buildPrepareSemanticConfig(env)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(after, unrelated) {
|
||||
t.Fatal("unrelated history changed preparation evidence")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrepareSemanticConfigRecordsCanonicalProjectionVersion(t *testing.T) {
|
||||
env := initialSemanticEnv()
|
||||
payload, err := buildPrepareSemanticConfig(env)
|
||||
|
||||
Reference in New Issue
Block a user