Remove legacy manifest provenance decoding
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
This commit is contained in:
@@ -75,18 +75,19 @@ func TestLocalStoreCreateSaveLoadRoundTrip(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLocalStoreLoadsManifestWithHistoricalSelectionProvenance(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "manifest.json")
|
||||
data := `{"schema_version":"narratio.session-manifest.v1","session_id":"2026-05-03","created_at":"2026-05-03T10:00:00Z","updated_at":"2026-05-03T10:00:00Z","effective_config":{"selected_profile":{"name":"testing","source":"explicit"},"effective_config_digest":"001122"},"stages":{}}`
|
||||
if err := os.WriteFile(path, []byte(data), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
loaded, err := (&LocalStore{}).Load(context.Background(), path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if loaded.EffectiveConfig == nil || loaded.EffectiveConfig.EffectiveConfigDigest != "001122" || loaded.EffectiveConfig.SelectedOverlay != nil {
|
||||
t.Fatalf("historical informational provenance = %#v", loaded.EffectiveConfig)
|
||||
func TestLocalStoreRejectsUnknownProvenanceFields(t *testing.T) {
|
||||
for _, tc := range []struct{ name, provenance, field string }{
|
||||
{"retired selection", `{"selected_profile":{"name":"testing","source":"explicit"}}`, "selected_profile"},
|
||||
{"unknown provenance", `{"unexpected":true}`, "unexpected"},
|
||||
{"unknown selection field", `{"selected_overlay":{"name":"testing","source":"explicit","unexpected":true}}`, "unexpected"},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
data := `{"schema_version":"narratio.session-manifest.v1","session_id":"2026-05-03","created_at":"2026-05-03T10:00:00Z","updated_at":"2026-05-03T10:00:00Z","effective_config":` + tc.provenance + `,"stages":{}}`
|
||||
_, err := (&LocalStore{}).LoadReader(context.Background(), strings.NewReader(data))
|
||||
if err == nil || !strings.Contains(err.Error(), tc.field) {
|
||||
t.Fatalf("expected rejection identifying %q, got %v", tc.field, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user