gowalk-cicd 1.0.123 → 1.0.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 1.0.123
1
+ 1.0.124
@@ -1,4 +1,4 @@
1
- """Retry one positively identified interrupted Pod fetch within the existing install deadline."""
1
+ """Retry one positively identified transient Pod fetch fault within the existing install deadline."""
2
2
  import json
3
3
  import re
4
4
  import sys
@@ -14,6 +14,11 @@ TERMINAL = re.compile(
14
14
  r"repository not found|checksum|compatible versions|deployment mode|"
15
15
  r"returned error:\s*(?:401|403|407)\b|\bcurl(?:\s+(?:51|60)\b|:\s*\((?:51|60)\))", re.I)
16
16
  PARTIAL = re.compile(r"\bcurl(?:\s+18\b|:\s*\(18\))", re.I)
17
+ # CocoaPods reports a timed-out CDN spec fetch as its own sentence and never as a curl
18
+ # code, so the partial-transfer evidence above cannot see it: "CDN: trunk URL couldn't be
19
+ # downloaded: <url> Response: Timeout was reached". A timeout leaves the successfully
20
+ # fetched specs cached, so the second attempt resumes rather than starting over.
21
+ TIMED_OUT = re.compile(r"Response:\s*Timeout was reached|\bcurl(?:\s+28\b|:\s*\(28\))", re.I)
17
22
 
18
23
 
19
24
  def interrupted_transfer(body: str) -> bool:
@@ -21,6 +26,17 @@ def interrupted_transfer(body: str) -> bool:
21
26
  text in body.lower() for text in ("early eof", "transfer closed", "bytes of body are still expected")))
22
27
 
23
28
 
29
+ def timed_out(body: str) -> bool:
30
+ return bool(TIMED_OUT.search(body) and not TERMINAL.search(body))
31
+
32
+
33
+ def retryable(body: str) -> str:
34
+ """Name the transient class this failure belongs to, or "" when it is not one."""
35
+ if interrupted_transfer(body):
36
+ return "partial_transfer"
37
+ return "transient_timeout" if timed_out(body) else ""
38
+
39
+
24
40
  def install(argv: list[str], folder, log, snapshot: dict, *, timeout: float = 900) -> tuple[int, int]:
25
41
  deadline = time.monotonic() + timeout
26
42
  for attempt in (1, 2):
@@ -35,9 +51,10 @@ def install(argv: list[str], folder, log, snapshot: dict, *, timeout: float = 90
35
51
  log.seek(0)
36
52
  log.truncate()
37
53
  log.write(body.encode())
38
- if code == 0 or attempt == 2 or not interrupted_transfer(body):
54
+ reason = retryable(body)
55
+ if code == 0 or attempt == 2 or not reason:
39
56
  return code, attempt
40
- payload = {"schema": "gowalk-cicd/native-pods-retry.v1", "attempt": 2, "reason": "partial_transfer"}
57
+ payload = {"schema": "gowalk-cicd/native-pods-retry.v1", "attempt": 2, "reason": reason}
41
58
  print("::notice title=native_pods_retry::" + json.dumps(payload, separators=(",", ":")),
42
59
  file=sys.stderr, flush=True)
43
60
  raise AssertionError("unreachable")
@@ -12,6 +12,10 @@ import native_pods_retry
12
12
  import test_native_pods
13
13
 
14
14
  PARTIAL = "error: RPC failed; curl 18 transfer closed with outstanding read data remaining\nfatal: early EOF"
15
+ # Verbatim from ios-zuper-sms Mobile Deploy 34346560202, after the diagnostic's own URL
16
+ # redaction — the form `retryable` actually sees.
17
+ TIMEOUT = "\n".join(["CDN: trunk URL couldn't be downloaded: [URL redacted] "
18
+ "Response: Timeout was reached"] * 30)
15
19
 
16
20
 
17
21
  class RetryTests(unittest.TestCase):
@@ -81,6 +85,42 @@ class RetryTests(unittest.TestCase):
81
85
  self.assertEqual(self.fixture.run_cli()[0], 1)
82
86
  self.assertEqual(len(json.loads((self.root / "attempts.json").read_text())), 1)
83
87
 
88
+ def test_timed_out_cdn_fetch_recovers_within_the_same_deadline(self):
89
+ self.script([TIMEOUT])
90
+ code, result = self.fixture.run_cli()
91
+ self.assertEqual((code, result["pod_attempts"]), (0, 2))
92
+ attempts = json.loads((self.root / "attempts.json").read_text())
93
+ self.assertEqual(len(attempts), 2)
94
+ for attempt in attempts:
95
+ self.assertEqual(attempt["argv"], ["install", "--deployment", "--no-repo-update"])
96
+ self.assertTrue(attempt["proxy"].startswith("http://127.0.0.1:"))
97
+ self.assertEqual((self.root / "Podfile.lock").read_text(), "fixture-lock")
98
+
99
+ def test_repeat_timeout_stops_after_second_attempt(self):
100
+ self.script([TIMEOUT, TIMEOUT, TIMEOUT])
101
+ code, result = self.fixture.run_cli()
102
+ self.assertEqual((code, result["code"]), (1, "native_pods_install_failed"))
103
+ self.assertEqual(len(json.loads((self.root / "attempts.json").read_text())), 2)
104
+
105
+ def test_terminal_evidence_dominates_a_timeout(self):
106
+ for failure in ("certificate verify failed", "The requested URL returned error: 403",
107
+ "checksum mismatch", "curl: (60) unknown trust failure"):
108
+ with self.subTest(failure=failure):
109
+ (self.root / "attempts.json").unlink(missing_ok=True)
110
+ self.script([TIMEOUT + "\n" + failure])
111
+ self.assertEqual(self.fixture.run_cli()[0], 1)
112
+ self.assertEqual(len(json.loads((self.root / "attempts.json").read_text())), 1)
113
+
114
+ def test_each_transient_class_is_named_and_unrelated_waits_are_not_retried(self):
115
+ self.assertEqual(native_pods_retry.retryable(TIMEOUT), "transient_timeout")
116
+ self.assertEqual(native_pods_retry.retryable(PARTIAL), "partial_transfer")
117
+ self.assertEqual(native_pods_retry.retryable("curl: (28) Operation timed out"),
118
+ "transient_timeout")
119
+ for body in ("the timeout was generous", "Response: 404 Not Found",
120
+ "waiting for the lock", "unknown network error"):
121
+ with self.subTest(body=body):
122
+ self.assertEqual(native_pods_retry.retryable(body), "")
123
+
84
124
  def test_one_deadline_and_no_guess_from_generic_eof(self):
85
125
  for body in ("fatal: early EOF", "curl 180 failure", "unknown network error"):
86
126
  self.assertFalse(native_pods_retry.interrupted_transfer(body))
@@ -1 +1 @@
1
- 1.0.123
1
+ 1.0.124
@@ -1 +1 @@
1
- 1.0.123
1
+ 1.0.124
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gowalk-cicd",
3
- "version": "1.0.123",
3
+ "version": "1.0.124",
4
4
  "description": "Zero-config GitHub Actions delivery for iOS TestFlight and Android Google Play.",
5
5
  "type": "module",
6
6
  "bin": {