Skip to content

Preserve HTTP response and transport error details - #27

Merged
mxcl merged 1 commit into
masterfrom
codex/preserve-update-errors
Sep 25, 2026
Merged

mxcl merged 1 commit into
masterfrom
codex/preserve-update-errors

Conversation

@mxcl

@mxcl mxcl commented Sep 25, 2026

Copy link
Copy Markdown
Owner

HTTP failures during update checks currently become invalidHTTPResponse, so a GitHub rate limit or HTTP 500 is presented as “an invalid or insecure response” and callers cannot inspect the status or retry headers. Transport errors also lose their original diagnostic context.

Add AppUpdaterHTTPError retaining the full HTTPURLResponse, with localized status details and messages for HTTP 429 or HTTP 403 with an exhausted rate-limit header. Retain the original URLError in AppUpdaterNetworkError.underlyingError, including network timeouts. Alert text includes the host, never signed URL paths/query strings or response bodies; callers inspecting the retained objects must treat them as potentially sensitive.

HTTPS, redirect, content-type, compression, size, and installation checks remain enforced. TUF recognizes the new HTTP error as a network failure, preserving its existing verified-cache/embedded fallback behavior. Cancellation still propagates unchanged.

Compatibility: non-2xx HTTPS responses now throw AppUpdaterHTTPError instead of .invalidHTTPResponse; network timeouts now throw AppUpdaterNetworkError with .timedOut instead of .operationTimedOut. Process timeouts are unchanged.

Validation: swift test passed all 80 tests, then the added download-failure regression passed separately. Coverage includes preserved status/headers/URL, 403 vs confirmed rate limiting, 429/503, safe alert text, original transport diagnostics, timeout diagnostics, TUF fallback, and no promoted download on HTTP failure.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Preserves HTTP response metadata and underlying transport diagnostics while maintaining security checks and TUF fallback behavior.

Changes:

  • Adds structured HTTP and network error details.
  • Retains status, headers, URLs, and timeout diagnostics safely.
  • Updates TUF fallback handling and regression coverage.
File Description
Tests/​AppUpdaterTests/​TUFTests.swift Tests embedded fallback for HTTP failures.
Tests/​AppUpdaterTests/​AppUpdaterTests.swift Tests HTTP, timeout, security, and download behavior.
Attestation/​TUF.swift Treats HTTP failures as network failures for fallback.
AppUpdater.swift Adds HTTP and network failure details.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 36139576316

Coverage increased (+0.4%) to 70.865%

Details

  • Coverage increased (+0.4%) from the base build.
  • Patch coverage: 35 of 35 lines across 2 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 2636
Covered Lines: 1868
Line Coverage: 70.86%
Coverage Strength: 437.21 hits per line

💛 - Coveralls

@mxcl
mxcl merged commit 685dff9 into master Sep 25, 2026
2 checks passed
@mxcl
mxcl deleted the codex/preserve-update-errors branch September 25, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants