From b9a1298fdbd76316eb495dedd5e95c94471bf5ca Mon Sep 17 00:00:00 2001 From: Adam Shiervani Date: Mon, 27 Apr 2026 19:21:48 +0200 Subject: [PATCH] test: accept both SKU-incompat 404 messages in compare-releases The release API used to emit "Version X predates SKU support..." for every SKU-incompat 404. Upcoming changes route this through getDefaultRelease and emit "No default release available for SKU..." instead. Both 404s mean the same thing to the device, so accept either wording in the diff tolerator. --- scripts/compare-releases.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/compare-releases.sh b/scripts/compare-releases.sh index bb2b95c..d4dc7f1 100755 --- a/scripts/compare-releases.sh +++ b/scripts/compare-releases.sh @@ -254,17 +254,24 @@ right_keys = set(right.keys()) if left_keys != {"name", "message"} or right_keys != {"name", "message"}: raise SystemExit(1) -version_pattern = re.compile( - r'^(Version )(.+?)( predates SKU support and cannot serve SKU "[^"]+")$' -) +# Both messages mean "no release compatible with this SKU is available"; +# the wording differs across deploys but the device sees the same 404. +no_compat_patterns = [ + re.compile(r'^Version .+ predates SKU support and cannot serve SKU "([^"]+)"$'), + re.compile(r'^No default (?:app|system) release available for SKU "([^"]+)"$'), +] + +def canonicalize(message): + for pattern in no_compat_patterns: + match = pattern.match(message) + if match: + return f'' + return message left_message = left.get("message", "") right_message = right.get("message", "") -left_normalized = version_pattern.sub(r"\1\3", left_message) -right_normalized = version_pattern.sub(r"\1\3", right_message) - -if left_normalized == right_normalized: +if canonicalize(left_message) == canonicalize(right_message): raise SystemExit(0) raise SystemExit(1)