Clarify remote manifest recovery

This commit is contained in:
2026-09-02 14:37:36 +00:00
parent ccbd7ee820
commit c8bae3a4a3
3 changed files with 16 additions and 3 deletions

View File

@@ -147,7 +147,7 @@ func readCurrentStateControlObject(ctx context.Context, store storage.ObjectStor
func decodeCommittedManifest(ctx context.Context, data []byte) (*manifest.Manifest, error) {
m, err := (&manifest.LocalStore{}).LoadReader(ctx, bytes.NewReader(data))
if err != nil {
return nil, fmt.Errorf("committed session manifest decode failed: %w", err)
return nil, fmt.Errorf("committed session manifest decode failed: %w; republish this session to replace unsupported remote state", err)
}
return m, nil
}

View File

@@ -92,6 +92,19 @@ func TestLoadCurrentStateUsesMetadataFromOpenedObjectVersion(t *testing.T) {
}
}
func TestDecodeCommittedManifestGuidesRemoteRecovery(t *testing.T) {
_, err := decodeCommittedManifest(context.Background(), []byte(`{"session_id":"2026-05-03"}`))
if err == nil {
t.Fatal("decodeCommittedManifest() error = nil, want unsupported schema failure")
}
if !strings.Contains(err.Error(), "schema_version is required") || !strings.Contains(err.Error(), "republish this session") {
t.Fatalf("decodeCommittedManifest() error = %v, want schema and republish guidance", err)
}
if strings.Contains(err.Error(), "local state") {
t.Fatalf("decodeCommittedManifest() error = %v, must not describe remote state as local", err)
}
}
func TestLoadCurrentStateRejectsPointerCommitIdentityMismatch(t *testing.T) {
store := &storage.FakeBackend{}
prefix := testCurrentSessionPrefix()