gowalk-cicd 1.0.217 → 1.0.218

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.
package/README.md CHANGED
@@ -1266,8 +1266,22 @@ A failed upload emits the typed `apple_build_upload_failed` error annotation wit
1266
1266
  `processing_pending`, or a fallback such as `local_io`), `stage`, `receipt_available` and
1267
1267
  the receipt's own identifiers (`cfBundleVersion`, `upload_id`, `file_id`, `state`,
1268
1268
  `provider_status`, `provider_code`, `provider_pointer`). Exception text is never
1269
- published. The job also retains the exact exported IPA as `apple-ipa-<run>-<attempt>`
1270
- (7 days), copied without byte changes to the safe archive member `app.ipa`, so punctuation
1269
+ published. From 1.0.218 a failed App Store Connect request publishes its final HTTP status as
1270
+ `provider_status`, including unclassified 429/5xx responses; a request that received no response
1271
+ records only the closed `network_error` label in the retained receipt (the annotation shape is unchanged) (`tls`, `connect_timeout`, `read_timeout`, `timeout`,
1272
+ `connection` or `request`). Reads and the `uploaded: true` commit of the one reserved file make
1273
+ up to three attempts on 429, 500, 502, 503, 504 or a network error (2 s, then 8 s backoff);
1274
+ creates and classified refusals (400, 401, 403, 404, 409, 412, 422) are never repeated.
1275
+ `provider_request_failed` at stage `file_reserved` means every part transferred and only the
1276
+ commit failed. Read that receipt's `file_id` back first with the account-pinned store tooling: while it
1277
+ is still `AWAITING_UPLOAD`, that same tooling may send the same `uploaded: true` body once (never a
1278
+ direct Mac call or another upload), then read the file back `COMPLETE` with any nonnull whole-file
1279
+ checksum matching the retained IPA and the unique matching build before treating it as delivered, and
1280
+ reconcile the deployment as described above.
1281
+ Never upload different bytes under the same build number.
1282
+
1283
+ The job also retains the exact exported IPA as `apple-ipa-<run>-<attempt>` (7 days),
1284
+ copied without byte changes to the safe archive member `app.ipa`, so punctuation
1271
1285
  in the exported filename cannot block retention. A continuation can complete that upload instead of rebuilding
1272
1286
  different bytes under the same number. Build numbers come from `/builds`,
1273
1287
  `/preReleaseVersions` **and** `/apps/{id}/buildUploads`, so an unfinished or refused
@@ -165,6 +165,17 @@ def _request_timeouts() -> tuple[float, float]:
165
165
  )
166
166
 
167
167
 
168
+ class RequestFailed(SystemExit):
169
+ """Terminal ``request`` failure. It stays a SystemExit with the same message, so
170
+ existing callers are unchanged; ``status`` (HTTP) or ``category`` (closed network
171
+ label) lets a caller publish the cause without the message's provider text."""
172
+
173
+ def __init__(self, message: str, *, status: int | None = None, category: str = ""):
174
+ super().__init__(message)
175
+ self.status = status
176
+ self.category = category
177
+
178
+
168
179
  def _network_error_category(exc: BaseException) -> str:
169
180
  """Closed diagnostic labels only; exception text can contain private URLs."""
170
181
  for error_type, category in (
@@ -184,12 +195,12 @@ def _retry_network_error(
184
195
  backoffs: tuple[int, ...], exc: BaseException,
185
196
  ) -> None:
186
197
  """Network error path: sleep and return when retries remain, else
187
- raise SystemExit (terminal). Caller ``continue``s after return."""
198
+ raise RequestFailed (terminal). Caller ``continue``s after return."""
188
199
  category = _network_error_category(exc)
189
200
  if attempt >= total - 1:
190
- raise SystemExit(
201
+ raise RequestFailed(
191
202
  f"ASC {method} {path} network error after {total} "
192
- f"attempts (category={category})"
203
+ f"attempts (category={category})", category=category,
193
204
  )
194
205
  delay = backoffs[attempt]
195
206
  print(
@@ -235,7 +246,7 @@ def request(
235
246
  raising (useful for 409 conflict handling). Per-request timeouts come
236
247
  from ``_request_timeouts()`` (env-overridable); without them a hung
237
248
  TCP socket would block the CI runner indefinitely.
238
- Raises SystemExit on non-retryable failure with a clear stderr message.
249
+ Raises RequestFailed (a SystemExit) on non-retryable failure with a clear message.
239
250
  """
240
251
  url = f"{ASC_BASE}{path}"
241
252
  headers = {"Authorization": f"Bearer {token}"}
@@ -263,8 +274,9 @@ def request(
263
274
  continue
264
275
  break
265
276
  assert resp is not None
266
- raise SystemExit(
267
- f"ASC {method} {path} failed: {resp.status_code}\n{resp.text[:2000]}"
277
+ raise RequestFailed(
278
+ f"ASC {method} {path} failed: {resp.status_code}\n{resp.text[:2000]}",
279
+ status=resp.status_code,
268
280
  )
269
281
 
270
282
 
@@ -26,13 +26,20 @@ from upload_receipt import Receipt, UploadError
26
26
  CLASSIFIED_STATUSES = {400, 401, 403, 404, 409, 412, 422}
27
27
 
28
28
 
29
- def api(method: str, path: str, body=None, params=None) -> dict:
29
+ def api(method: str, path: str, body=None, params=None, *, idempotent: bool = False) -> dict:
30
30
  token = asc_common.make_jwt(os.environ["ASC_KEY_ID"], os.environ["ASC_ISSUER_ID"],
31
31
  os.environ["ASC_KEY_PATH"])
32
- # An uncertain create is discovered from the provider on the next invocation,
33
- # never repeated automatically under a second upload identity.
34
- response = asc_common.request(method, path, token, json_body=body, params=params,
35
- allow_status=CLASSIFIED_STATUSES, max_attempts=3 if method == "GET" else 1)
32
+ # Reads and the idempotent uploaded=true commit retry 429/5xx/network failures. An
33
+ # uncertain create is discovered from the provider on the next invocation, never
34
+ # repeated automatically under a second upload identity.
35
+ try:
36
+ response = asc_common.request(method, path, token, json_body=body, params=params,
37
+ allow_status=CLASSIFIED_STATUSES,
38
+ max_attempts=3 if method == "GET" or idempotent else 1)
39
+ except asc_common.RequestFailed as exc:
40
+ # Only the HTTP status or the closed network label is published, never the message.
41
+ cause = {"provider_status": exc.status} if exc.status else {"network_error": exc.category}
42
+ raise UploadError("provider_request_failed", f"Apple request {method} {path} failed", **cause) from None
36
43
  if response.status_code >= 400:
37
44
  try:
38
45
  error = (response.json().get("errors") or [{}])[0]
@@ -152,7 +159,7 @@ def transfer_all(ipa: Path, file: dict, info: dict) -> None:
152
159
  # checksum enum includes SHA_256, but IPA finalization rejected that
153
160
  # optional attribute with ENTITY_ERROR.ATTRIBUTE.INVALID in production.
154
161
  "type": "buildUploadFiles", "id": file["id"], "attributes": {"uploaded": True},
155
- }})
162
+ }}, idempotent=True)
156
163
 
157
164
 
158
165
  def deliver(ipa: Path, report: Path, timeout: int, handoff: Path | None = None) -> dict:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gowalk-cicd",
3
- "version": "1.0.217",
3
+ "version": "1.0.218",
4
4
  "description": "Zero-config GitHub Actions delivery for iOS TestFlight and Android Google Play.",
5
5
  "type": "module",
6
6
  "bin": {
package/remedies.json CHANGED
@@ -5,6 +5,12 @@
5
5
  "fixed_in": "1.0.216",
6
6
  "remedy": "Keep the original IPA and apple-build-upload receipt. From 1.0.216 default-branch Linux candidate promotion retains the same authenticated verification handoff as macOS delivery; adopt the action and generated workflow together. Earlier inline Linux processing_pending failures have no handoff: do not fabricate one or use the handoff-only recovery workflow. In an authorized same-repository default-branch Actions job, authenticate the original apple-upload-<run>-<attempt> artifact and archive digest, then run reconcile_apple_upload.cjs DEPLOYMENT_ID ORIGINAL_RUN_ID ORIGINAL_ATTEMPT /path/to/apple-build-upload.json with that unchanged receipt. Serialize with Mobile Deploy and preserve its original owner. The released helper requires fresh completed upload/file/checksum and unique VALID eligible iOS build/app proof; it never rebuilds or uploads. Retain its result, read back uploaded, then rerun the whole original deploy. Missing original bytes or checksum proof remain unverified; never invent digests, upload another binary under the same number or hand-edit ownership."
7
7
  },
8
+ {
9
+ "schema": "gowalk-cicd/apple-build-upload-failed.v2",
10
+ "code": "provider_request_failed",
11
+ "fixed_in": "1.0.218",
12
+ "remedy": "Keep the original IPA artifact, apple-build-upload receipt and deployment owner. From 1.0.218 the uploaded=true commit of the one reserved file retries 429, 500, 502, 503, 504 and network errors up to three attempts, like reads; creates and classified refusals still run once. A failed request publishes its HTTP status as provider_status; when no response arrived the receipt keeps only the closed network_error label. Exception text, URLs and provider bodies stay private. Stage file_reserved means every part transferred and only the commit failed. Read that file_id back with the account-pinned store tooling; while it is still AWAITING_UPLOAD, that tooling may send the same uploaded=true body once (never a direct Mac call or another upload). Then read the file back COMPLETE with any nonnull whole-file checksum matching the retained IPA and the unique matching build, and reconcile the named deployment to success/uploaded with that evidence. Do not fabricate a handoff or relabel the receipt, and never upload different bytes under the same build number."
13
+ },
8
14
  {
9
15
  "schema": "gowalk-cicd/mobile-release-refused.v1",
10
16
  "code": "mobile_release_phase_owner_mismatch",