Skip to content

Commit 74b48d3

Browse files
committed
fix: order platform saga query by version for deterministic migration
loadPlatformSagas queries all platform_saga_definition rows and stores them in a map keyed by name. When multiple versions exist (e.g., stripe_payment v1/v2/v3), the last row scanned overwrites the entry. Without ORDER BY version, the winning version was non-deterministic, causing migration tests to fail when an older version won and the similarity check against the tenant's latest-version script dropped below threshold (69% vs required 95%).
1 parent 765be40 commit 74b48d3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

services/reference-data/saga/override_api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ func (s *OverrideService) loadPlatformSagas(ctx context.Context) (map[string]Pla
412412
rows, err := s.pool.Query(ctx, `
413413
SELECT id, name, version, script, display_name, description
414414
FROM public.platform_saga_definition
415-
ORDER BY name`)
415+
ORDER BY name, version`)
416416
if err != nil {
417417
return nil, fmt.Errorf("query platform sagas: %w", err)
418418
}

0 commit comments

Comments
 (0)