Automattic / Automattic/wordpress-rs

`.httpTooManyRedirects` / `.redirectToNonExistentLocation` land in `GenericError` and discard the recorded redirect chain

Open
#1,503 0 comments 0 reactions 0 assignees View on GitHub
Bug Error Handling Swift
Dominant language
Rust
Stars
36
Forks
5
Avg merge
17h 30m
Merged PRs (30d)
43

Description

> Split out from Automattic/wordpress-rs#1497 — *Swift executor URLSession error audit*. Section B — Unchecked URLError codes we could classify better.
>
> File references are to `native/swift/Sources/wordpress-api/SafeRequestExecutor.swift` unless noted; `:NNN` line numbers were verified against `fix/converge-executor-error-classification`.

**Severity: medium.** A redirect loop produces `GenericError` with `redirects: nil` — even though `RequestExecutorDelegate.willPerformHTTPRedirection` recorded the full chain for exactly this diagnostic purpose, and the HTTPS/non-existent-site handlers do attach it. http↔https and www redirect loops from misconfigured `siteurl`/`home` values are a recurring real-world failure mode. Classify both codes as `HttpError` and attach `executorDelegate.redirects(for:)`.

**Caveat:** reqwest also sends redirect-policy errors to `GenericError` (no `is_redirect()` check), so this is an improvement over parity rather than a parity fix — ideally fix reqwest in the same pass.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in native/swift/Sources/wordpress-api/SafeRequestExecutor.swift at the URLError classification and the RequestExecutorDelegate redirect recording. Trace how .httpTooManyRedirects and .redirectToNonExistentLocation are handled, then verify the resulting HttpError includes executorDelegate.redirects(for:). Review the reqwest redirect-policy path as the stated follow-up, and confirm redirect-loop diagnostics preserve the full chain.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, swift
Domain
api, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.