Track Audita v2 selections in polish resume evidence
This commit is contained in:
@@ -373,7 +373,7 @@ func TestAssembledSplitBundleProfileSwitchRecordsProvenanceAndLimitsReuse(t *tes
|
||||
if err != nil {
|
||||
t.Fatalf("switch to testing profile: %v", err)
|
||||
}
|
||||
if got, want := testingRuns, []int{0, 0, 0, 0, 0, 0, 0}; !reflect.DeepEqual(got, want) {
|
||||
if got, want := testingRuns, []int{0, 0, 0, 1, 1, 1, 1}; !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("testing profile runs = %v, want %v", got, want)
|
||||
}
|
||||
assertAssembledProvenance(t, store, testingSummary, "testing", config.EffectivePipelineDigest(testingCfg.Pipeline))
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -424,6 +425,69 @@ func TestRefinementSemanticChangesRespectDependencyBranches(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestOldPolishSemanticEvidenceIsReconsideredOnlyWhenSelected(t *testing.T) {
|
||||
cfg := testConfig(t)
|
||||
names := []string{"prepare", "transcribe", "merge", "polish", "normalize", "trim", "render"}
|
||||
seed := manifest.New(cfg.Session.SessionID, time.Now().UTC())
|
||||
for _, candidate := range stage.All() {
|
||||
seed.MarkStageSucceeded(candidate.Name(), time.Now().UTC(), nil)
|
||||
}
|
||||
providers := make([]stage.SemanticConfigFingerprinter, len(names))
|
||||
runs := make([]int, len(names))
|
||||
selected := make([]stage.Stage, 0, len(names))
|
||||
for index, name := range names {
|
||||
providers[index] = canonicalSemanticProvider(t, name)
|
||||
fingerprint, err := providers[index].SemanticConfigFingerprint(&stage.Env{Config: cfg})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if name == "polish" {
|
||||
fingerprint.Version--
|
||||
}
|
||||
seed.Stages[name].SemanticConfig = &fingerprint
|
||||
selected = append(selected, semanticContractRunStub{name: name, provider: providers[index], runs: &runs[index]})
|
||||
}
|
||||
store := &manifest.LocalStore{}
|
||||
if err := store.Save(context.Background(), manifestPathFor(cfg), seed); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := executeStages(context.Background(), cfg, selected[len(selected)-1:], RunOptions{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if runs[3] != 0 {
|
||||
t.Fatal("downstream-only execution invoked polish")
|
||||
}
|
||||
loaded, err := store.Load(context.Background(), manifestPathFor(cfg))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if loaded.Stages["polish"].SemanticConfig.Version != seed.Stages["polish"].SemanticConfig.Version {
|
||||
t.Fatal("downstream-only execution rewrote unselected polish evidence")
|
||||
}
|
||||
if _, err := executeStages(context.Background(), cfg, selected, RunOptions{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if want := []int{0, 0, 0, 1, 1, 1, 1}; !reflect.DeepEqual(runs, want) {
|
||||
t.Fatalf("runs = %v, want %v", runs, want)
|
||||
}
|
||||
loaded, err = store.Load(context.Background(), manifestPathFor(cfg))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if loaded.Stages["polish"].SemanticConfig.Version != 2 || loaded.Stages["extract"].Status != manifest.StatusStale {
|
||||
t.Fatalf("old evidence was not replaced with normal dependent invalidation: polish=%#v extract=%#v", loaded.Stages["polish"], loaded.Stages["extract"])
|
||||
}
|
||||
for index := range runs {
|
||||
runs[index] = 0
|
||||
}
|
||||
if _, err := executeStages(context.Background(), cfg, selected, RunOptions{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(runs, make([]int, len(names))) {
|
||||
t.Fatalf("unchanged new evidence reran stages: %v", runs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeliverySemanticChangesInvalidateOnlyTheirFixedDependents(t *testing.T) {
|
||||
t.Run("extract contract", func(t *testing.T) {
|
||||
cfg := testConfig(t)
|
||||
|
||||
Reference in New Issue
Block a user