Remove retired cleanup manifest state

This commit is contained in:
2026-09-05 15:30:31 +00:00
parent adc60aa588
commit 078f661e3a
10 changed files with 84 additions and 74 deletions

View File

@@ -6,6 +6,7 @@ import (
"errors"
"os"
"path/filepath"
"reflect"
"strings"
"testing"
"time"
@@ -256,6 +257,33 @@ func TestLoadRejectsInvalidManifest(t *testing.T) {
}
}
func TestLocalStoreRejectsRetiredCleanupFieldAndRoundTripsCanonicalV1(t *testing.T) {
store := &LocalStore{}
canonical := `{"schema_version":"narratio.session-manifest.v1","session_id":"2026-05-03","created_at":"2026-05-03T10:00:00Z","updated_at":"2026-05-03T10:01:00Z","stages":{}}`
loaded, err := store.LoadReader(context.Background(), strings.NewReader(canonical))
if err != nil {
t.Fatalf("load canonical manifest: %v", err)
}
encoded, err := json.Marshal(loaded)
if err != nil {
t.Fatalf("marshal canonical manifest: %v", err)
}
roundTripped, err := store.LoadReader(context.Background(), strings.NewReader(string(encoded)))
if err != nil {
t.Fatalf("reload canonical manifest: %v", err)
}
if !reflect.DeepEqual(roundTripped, loaded) {
t.Fatalf("round-tripped manifest = %#v, want %#v", roundTripped, loaded)
}
retired := strings.TrimSuffix(canonical, "}") + `,"post_publish_cleanup":{"committed_run_id":"20260905T010203Z-a1b2c3d4"}}`
_, err = store.LoadReader(context.Background(), strings.NewReader(retired))
if err == nil || !strings.Contains(err.Error(), `unknown field "post_publish_cleanup"`) {
t.Fatalf("load retired cleanup field error = %v, want strict unknown-field rejection", err)
}
}
func TestLocalStoreRejectsUnsupportedSchemaVersions(t *testing.T) {
store := &LocalStore{}
now := time.Date(2026, 5, 3, 10, 0, 0, 0, time.UTC)