Xbox Cloud Gaming app for PS5 Homebrew
C
ci: triage and auto-close unsupported v1.4.7 PS4 port issues
Rafael Abud Ferreiradacde9c607a3
diff --git a/.github/triage/test_triage.py b/.github/triage/test_triage.pyindex 2613b85..dae585b 100644--- a/.github/triage/test_triage.py+++ b/.github/triage/test_triage.py@@ -23,6 +23,10 @@ LOG = "10:00:00 [I] === PSBox Cloud Gaming starting ===\n"class Triage(unittest.TestCase):def run_triage(self, body, title="A problem", latest="1.3.2"):+ labels, comment, _ = triage.triage({"title": title, "body": body}, RULES, latest)+ return labels, comment++ def run_triage_full(self, body, title="A problem", latest="1.3.2"):return triage.triage({"title": title, "body": body}, RULES, latest)def test_known_error_fixed_in_newer_release(self):@@ -125,6 +129,54 @@ class Triage(unittest.TestCase):self.assertIn("Triagem automática", comment)self.assertIn("DNS bloqueado", comment)+ def test_unsupported_147_english(self):+ labels, comment, close = self.run_triage_full(+ form("It crashed", "1.4.7", "Ps4", LOG),+ title="Problem on 1.4.7",+ latest="1.5.4"+ )+ self.assertEqual(labels, ["unsupported-platform"])+ self.assertTrue(close)+ self.assertIn("Automatic triage", comment)+ self.assertIn("Unsupported version (v1.4.7 / unofficial PS4 port)", comment)+ self.assertIn("PlayStation 5", comment)+ self.assertNotIn("needs-info", labels)+ self.assertNotIn("outdated-version", labels)++ def test_unsupported_147_portuguese(self):+ labels, comment, close = self.run_triage_full(+ form("Não consigo entrar no jogo", "1.4.7", "13.00", LOG + "10:00:01 [I] settings: language pt-BR\n"),+ title="Erro ao logar na conta",+ latest="1.5.4"+ )+ self.assertEqual(labels, ["unsupported-platform"])+ self.assertTrue(close)+ self.assertIn("Triagem automática", comment)+ self.assertIn("Versão não suportada (v1.4.7 / port não-oficial de PS4)", comment)+ self.assertIn("não-oficial para PS4 desenvolvida por terceiros", comment)+ self.assertIn("não foi feita pelo mantenedor", comment)++ def test_unsupported_147_spanish(self):+ labels, comment, close = self.run_triage_full(+ form("No puedo iniciar sesión en el juego", "1.4.7", "13.00", LOG),+ title="Error al iniciar sesión",+ latest="1.5.4"+ )+ self.assertEqual(labels, ["unsupported-platform"])+ self.assertTrue(close)+ self.assertIn("Triaje automático", comment)+ self.assertIn("Versión no admitida (v1.4.7 / port no oficial de PS4)", comment)++ def test_unsupported_147_free_text(self):+ labels, comment, close = self.run_triage_full(+ "Estou usando a 1.4.7 e deu erro",+ title="Ajuda com 1.4.7",+ latest="1.5.4"+ )+ self.assertEqual(labels, ["unsupported-platform"])+ self.assertTrue(close)+ self.assertIn("Versão não suportada", comment)+def test_rules_are_valid(self):import refor rule in RULES:diff --git a/.github/triage/triage.py b/.github/triage/triage.pyindex 1a80958..ec78e85 100644--- a/.github/triage/triage.py+++ b/.github/triage/triage.py@@ -33,6 +33,7 @@ LABEL_COLOURS = {"needs-info": "fbca04","outdated-version": "c5def5","crash": "b60205",+ "unsupported-platform": "d93f0b",}AREA_COLOUR = "1d76db"FIRMWARE_COLOUR = "ededed"@@ -45,6 +46,15 @@ STRINGS = {"- This was reported on v{current}; the latest is **v{latest}** ""(the app offers it after sign-in, or Settings > Updates). Does it still happen there?"),+ "unsupported_147": (+ "- **Unsupported version (v1.4.7 / unofficial PS4 port)**: Version 1.4.7 is an unofficial "+ "port for PS4 created by a third party. This repository develops and supports exclusively "+ "the official **PlayStation 5** application (PPSA99810). Official support cannot be provided "+ "for this PS4 build as it was not created or maintained by the author of this repository.\n\n"+ "This issue is being closed as an unsupported version/platform.\n\n"+ "*(Tip: If you are having issues claiming games or managing your account, visit https://www.xbox.com/play "+ "in a PC or mobile browser to manage your account and claim titles directly).*"+ ),"ask_release": "the **app release** (Settings > Updates shows it, e.g. v1.3.2)","ask_log": ("the **xcloud.log** (`/data/psbox/xcloud.log` over FTP; before v0.9.7 in `/data/homebrew/PPSA99810/`, "@@ -60,6 +70,16 @@ STRINGS = {"- Este relato foi enviado na v{current}; a versão mais recente é a **v{latest}** ""(o app oferece a atualização após o login ou em Configurações > Atualizações). O problema ainda ocorre nela?"),+ "unsupported_147": (+ "- **Versão não suportada (v1.4.7 / port não-oficial de PS4)**: A versão 1.4.7 é uma modificação/port "+ "não-oficial para PS4 desenvolvida por terceiros. Este repositório desenvolve e oferece suporte "+ "exclusivamente para a versão oficial de **PlayStation 5** (PPSA99810). Não é possível oferecer suporte "+ "técnico, investigar problemas ou realizar correções para essa versão de PS4, pois ela não foi feita "+ "pelo mantenedor deste projeto.\n\n"+ "Esta issue está sendo encerrada por se tratar de uma versão/plataforma não suportada.\n\n"+ "*(Dica: Se estiver com problemas para resgatar jogos gratuitos ou gerenciar sua conta, acesse https://www.xbox.com/play "+ "pelo navegador de um computador ou celular para resgatar os títulos diretamente na sua conta Xbox).*"+ ),"ask_release": "a **versão do app** (mostrada em Configurações > Atualizações, ex.: v1.3.2)","ask_log": ("o **xcloud.log** (`/data/psbox/xcloud.log` via FTP, ou use *Relatar um problema* "@@ -75,6 +95,16 @@ STRINGS = {"- Este reporte fue enviado en la v{current}; la versión más reciente es la **v{latest}** ""(la app ofrece actualizar tras iniciar sesión o en Configuración > Actualizaciones). ¿Sigue ocurriendo ahí?"),+ "unsupported_147": (+ "- **Versión no admitida (v1.4.7 / port no oficial de PS4)**: La versión 1.4.7 es una modificación/port "+ "no oficial para PS4 desarrollado por terceros. Este repositorio desarrolla y ofrece soporte "+ "exclusivamente para la versión oficial de **PlayStation 5** (PPSA99810). No es posible ofrecer asistencia "+ "técnica, investigar problemas ni publicar correcciones para esa versión de PS4, ya que no fue creada "+ "por el mantenedor de este proyecto.\n\n"+ "Este reporte se cierra por tratarse de una versión/plataforma no admitida.\n\n"+ "*(Consejo: Si tienes dificultades para reclamar juegos gratuitos o gestionar tu cuenta, accede a https://www.xbox.com/play "+ "desde el navegador de un ordenador o móvil para reclamar los títulos directamente en tu cuenta de Xbox).*"+ ),"ask_release": "la **versión de la app** (se muestra en Configuración > Actualizaciones, ej.: v1.3.2)","ask_log": ("el **xcloud.log** (`/data/psbox/xcloud.log` por FTP, o usa *Informar de un problema* "@@ -165,8 +195,25 @@ def looks_like_log(text):return bool(re.search(r"\d\d:\d\d:\d\d \[[IWED]\]", text or ""))+def is_unsupported_147(fields, release, title, body):+ """Detects issues reporting version 1.4.7 or the unofficial PS4 port."""+ if release == (1, 4, 7):+ return True+ app_rel = field(fields, "app release")+ if re.search(r"\bv?1\.4\.7\b", app_rel, re.I):+ return True+ fw = field(fields, "ps5 firmware").strip().lower()+ plat = field(fields, "platform").strip().lower()+ if fw == "ps4" or plat == "ps4":+ return True+ text = f"{title or ''}\n{body or ''}"+ if re.search(r"\bv?1\.4\.7\b", text, re.I):+ return True+ return False++def triage(issue, rules, latest):- """-> (labels to add, comment text or None)."""+ """-> (labels to add, comment text or None, should_close bool)."""title = (issue.get("title") or "")[:1000]body = (issue.get("body") or "")[:MAX_TEXT]fields = parse_form(body)@@ -182,6 +229,11 @@ def triage(issue, rules, latest):tr = STRINGS[lang]reply_key = f"reply_{lang}" if lang != "en" else "reply"+ if is_unsupported_147(fields, release, title, body):+ labels = ["unsupported-platform"]+ out = [MARKER, tr["header"], "", tr["unsupported_147"]]+ return labels, "\n".join(out), True+labels, notes = [], []asked_update = Falsefor rule in rules:@@ -214,7 +266,7 @@ def triage(issue, rules, latest):labels.append(f"fw: {firmware}")if not notes and not asks and not outdated:- return labels, None+ return labels, None, Falseout = [MARKER, tr["header"], ""]for note in notes:out.append(f"- {note}")@@ -222,7 +274,7 @@ def triage(issue, rules, latest):out.append(tr["outdated_latest"].format(current=".".join(map(str, release)), latest=latest))if asks:out.append(tr["ask_line"].format(asks=tr["ask_join"].join(asks)))- return labels, "\n".join(out)+ return labels, "\n".join(out), False# --- GitHub ---------------------------------------------------------------------@@ -247,7 +299,7 @@ def label_colour(name):return LABEL_COLOURS.get(name, "ededed")-def apply(repo, number, labels, comment, token):+def apply(repo, number, labels, comment, token, close=False):for name in labels: # made the first time they're neededtry:api("POST", f"/repos/{repo}/labels", token, {"name": name, "color": label_colour(name)})@@ -256,15 +308,22 @@ def apply(repo, number, labels, comment, token):raiseif labels:api("POST", f"/repos/{repo}/issues/{number}/labels", token, {"labels": labels})- if comment is None:- return- mine = [c for c in api("GET", f"/repos/{repo}/issues/{number}/comments?per_page=100", token)- if MARKER in (c.get("body") or "") and c.get("user", {}).get("type") == "Bot"]- if mine:- if mine[0]["body"] != comment:- api("PATCH", f"/repos/{repo}/issues/comments/{mine[0]['id']}", token, {"body": comment})- else:- api("POST", f"/repos/{repo}/issues/{number}/comments", token, {"body": comment})+ if comment is not None:+ mine = [c for c in api("GET", f"/repos/{repo}/issues/{number}/comments?per_page=100", token)+ if MARKER in (c.get("body") or "") and c.get("user", {}).get("type") == "Bot"]+ if mine:+ try:+ if mine[0]["body"] != comment:+ api("PATCH", f"/repos/{repo}/issues/comments/{mine[0]['id']}", token, {"body": comment})+ except urllib.error.HTTPError:+ api("POST", f"/repos/{repo}/issues/{number}/comments", token, {"body": comment})+ else:+ api("POST", f"/repos/{repo}/issues/{number}/comments", token, {"body": comment})+ if close:+ try:+ api("PATCH", f"/repos/{repo}/issues/{number}", token, {"state": "closed", "state_reason": "not_planned"})+ except urllib.error.HTTPError as e:+ print(f"Warning: could not close issue #{number}: {e}")def main(argv):@@ -272,9 +331,10 @@ def main(argv):if len(argv) >= 3 and argv[1] == "--dry-run":issue = json.load(open(argv[2]))latest = argv[argv.index("--latest") + 1] if "--latest" in argv else None- labels, comment = triage(issue, rules, latest)+ labels, comment, should_close = triage(issue, rules, latest)print("labels:", labels)print(comment or "(no comment)")+ print(f"close: {should_close}")return 0repo, token = os.environ["GITHUB_REPOSITORY"], os.environ["GITHUB_TOKEN"]number = os.environ.get("TRIAGE_ISSUE", "").strip()@@ -291,9 +351,9 @@ def main(argv):latest = api("GET", f"/repos/{repo}/releases/latest", token)["tag_name"].lstrip("v")except urllib.error.HTTPError:latest = None- labels, comment = triage(issue, rules, latest)- print(f"issue #{issue['number']}: labels {labels}, comment {'yes' if comment else 'no'}")- apply(repo, issue["number"], labels, comment, token)+ labels, comment, should_close = triage(issue, rules, latest)+ print(f"issue #{issue['number']}: labels {labels}, comment {'yes' if comment else 'no'}, close: {should_close}")+ apply(repo, issue["number"], labels, comment, token, close=should_close)return 0