Skip to content

Fix issues found during the connection-reuse review - #5

Merged
jonathan-kosgei merged 4 commits into
mainfrom
fix-noticed-issues
Nov 3, 2026
Merged

jonathan-kosgei merged 4 commits into
mainfrom
fix-noticed-issues

Conversation

@jonathan-kosgei

@jonathan-kosgei jonathan-kosgei commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #4: fixes the items that its review left as noticed but unchanged, wherever a fix is possible in this repository. The public API does not change. A dead branch and the unused private helper behind it are removed, the README's IPResponse table is corrected, the Linux URLSession shim is limited to the toolchains that need it, and the CI workflow moves off deprecated runner images and action versions while adding Swift 6.0 to 6.4 to the matrix.

Changes

  • Dead api-key check in bulkLookup removed. buildURL always adds the api-key query item, so if !url.absoluteString.contains("api-key") could never run; the branch and its only callee appendAPIKey(to:) are gone. The request URL is unchanged, and the new testBulkLookupSendsTheAPIKeyOnceAsAQueryItem pins exactly one api-key query item next to fields on the bulk URL.
  • README IPResponse table corrected. timeZone is documented as TimeZoneInfo? (the type was renamed in Rename TimeZone to TimeZoneInfo to fix macOS CI failure #2), the missing regionType and emojiUnicode rows are added, and a short TimeZoneInfo section lists its properties.
  • Linux URLSession.data(for:) shim compiled only below Swift 6. swift-corelibs-foundation ships the async data(for:delegate:) from Swift 6.0 on; the shim is now guarded with canImport(FoundationNetworking) && compiler(<6.0), so Swift 6 toolchains on Linux use the native method and the two declarations never coexist. Swift 5.9 and 5.10 on Linux behave exactly as before.
  • CI workflow modernised. actions/checkout moves from v4 (Node.js 20, deprecated on GitHub Actions; every job printed a runner warning) to v7 (Node.js 24). The deprecated macos-14 image is replaced by macos-15 and macos-26. The Linux matrix keeps Swift 5.9 and 5.10 and adds 6.0, 6.1, 6.2, 6.3 and 6.4; fail-fast: false lets every version report instead of being cancelled by the first failure.

Not changed

  • User-Agent header: a Swift package has no version metadata available at runtime to build ipdata-swift/<version> from, and a hard-coded string would drift from the release tags.
  • Idle-connection policy: URLSession exposes no pool idle timeout, HTTP/2 keepalive ping or TCP keepalive setting (timeoutIntervalForRequest is per request), so the stack defaults stay in place.
  • Retry granularity: with URLSession.data(for:) the client cannot tell whether response bytes had already arrived when networkConnectionLost is raised, so the bulk retry keys on the error alone.
  • MockURLProtocol mutable statics: fine in the Swift 5 language mode the package uses (swift-tools-version: 5.9); they would need isolation only under Swift 6 strict concurrency, which is not enabled.
  • swift-tools-version stays 5.9 so that the package keeps supporting Swift 5.9 and 5.10.
  • Open PR Fix macOS test crash: read httpBodyStream when httpBody is nil #3: its macOS test-crash fix is superseded by the equivalent change already on main (which also compiles on Linux); closing it is left to the maintainer.

Verification

  • No Swift toolchain was available where this change was written, so swift build and swift test were not run locally; GitHub Actions is the compiler and test runner for this PR. Every edited file was re-read in full after editing, and a bracket-nesting check that skips comments, string literals, interpolations and raw strings passed for all five Swift files.
  • python3 -c 'import yaml; yaml.safe_load(open(".github/workflows/ci.yml"))': parses; Linux matrix 5.9, 5.10, 6.0, 6.1, 6.2, 6.3, 6.4, macOS matrix macos-15, macos-26.
  • CI: green on the first run. Workflow CI, run 41639305092 on f033e21 (event pull_request), conclusion success, all nine jobs passed: Swift 5.9 on Ubuntu, Swift 5.10 on Ubuntu, Swift 6.0 on Ubuntu, Swift 6.1 on Ubuntu, Swift 6.2 on Ubuntu, Swift 6.3 on Ubuntu, Swift 6.4 on Ubuntu, Swift on macos-15, Swift on macos-26. swift test executed 41 tests with 0 failures (the 40 existing tests plus testBulkLookupSendsTheAPIKeyOnceAsAQueryItem) on every job whose log was checked (Swift 5.9, 6.0 and 6.4 on Ubuntu, macos-15 and macos-26); the Swift 5.9 and 5.10 jobs compile the Linux shim, the Swift 6.0 to 6.4 jobs build without it. The Node.js 20 is deprecated runner warning that every earlier run printed is gone from the logs.

🤖 Generated with Claude Code

`buildURL` adds the `api-key` query item to every URL it builds, so the
`if !url.absoluteString.contains("api-key")` branch in `bulkLookup` could
never run. Drop it together with `appendAPIKey(to:)`, whose only caller it
was. The bulk URL is unchanged; a new test pins that it carries exactly one
`api-key` query item next to the `fields` item.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
swift-corelibs-foundation ships the async `URLSession.data(for:delegate:)`
from Swift 6.0 on, so the package's own `data(for:)` shim is only needed by
the 5.9 and 5.10 toolchains on Linux. Guard it with `compiler(<6.0)` so that
Swift 6 toolchains use the native method and the two declarations never
coexist.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The table listed `timeZone` as `TimeZone?` although the model type is
`TimeZoneInfo`, and it had no rows for `regionType` and `emojiUnicode`.
Correct the type, add the two rows and a short TimeZoneInfo section.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- actions/checkout v4 targets Node.js 20, which GitHub Actions has
  deprecated; the runner already forces it onto Node.js 24 and prints a
  warning on every job. Move to v7, which runs on Node.js 24 natively.
- The macos-14 image is deprecated in actions/runner-images. Test on
  macos-15 and macos-26 instead.
- Add Swift 6.0 to 6.4 to the Linux matrix next to 5.9 and 5.10, and let
  the matrix finish every job (fail-fast off) so that one failing version
  does not cancel the others.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jonathan-kosgei
jonathan-kosgei merged commit 906c8f4 into main Nov 3, 2026
9 checks passed
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.

2 participants