Skip to content

Clear two Linux build warnings (#433) - #442

Merged
leogdion merged 1 commit into
v1.0.0-beta.4from
433-linux-build-warnings
Aug 29, 2026
Merged

Clear two Linux build warnings (#433)#442
leogdion merged 1 commit into
v1.0.0-beta.4from
433-linux-build-warnings

Conversation

@leogdion

Copy link
Copy Markdown
Member

Clears the two Linux build warnings from #433 (Parts 1 and 2). Part 3 (the openapi.yaml wording) is owned by another lane, so this is Part of #433, not a close.

1. Unused public import FoundationNetworking

Sources/MistKit/Models/AssetUploading/URLRequest+AssetUpload.swift:33internal import (not bare import — the package enables InternalImportsByDefault but the convention is an explicit modifier on every import).

I verified the other three public import FoundationNetworking sites are genuinely justified and left them alone:

FilePublic API using the module
URLSession+AssetUpload.swiftpublic func upload(_:to:)
URLSession+CourierPoll.swiftpublic var courierTransport, public func pollCourier(_:timeout:)
WebCourierPoller.swiftpublic struct WebCourierPoller, public static var ephemeralConfiguration: URLSessionConfiguration

2. failureURLStringfailingURL, and the userInfo-key subtlety

failureURLString reads NSErrorFailingURLStringKey and returns String?; failingURL reads the distinctNSErrorFailingURLKey and returns URL?. A straight rename silently drops the failed URL from the description for any error carrying only the string key.

Decision: prefer the typed URL, fall back to the string key.

privatestaticfunc failingURLString(for error:URLError)->String?{iflet failingURL = error.failingURL {return failingURL.absoluteString
}return error.errorUserInfo[Self.failingURLStringKey]as?String}

This is not a hypothetical gap — the "string key only" test fails without the fallback on both macOS and Linux, because neither Foundation's failingURL nor corelibs' consults the string key.

Why the key is spelled as a literal. My first attempt read the fallback via the named constant NSURLErrorFailingURLStringErrorKey. The Linux build showed that constant is itself deprecated on swift-corelibs-foundation:

warning: 'NSURLErrorFailingURLStringErrorKey' is deprecated:
Use NSURLErrorFailingURLErrorKey instead [#DeprecatedDeclaration]

so naming it merely relocated the warning rather than clearing it. The fallback therefore uses a documented private constant holding the key's raw value:

privatestaticletfailingURLStringKey="NSErrorFailingURLStringKey"

I verified that raw value is identical on Darwin Foundation and on corelibs-foundation (swift:6.3-noble) by printing both constants on each platform. It is a frozen NSError userInfo key, so hard-coding it is safe; the alternative — dropping the fallback — would be a silent behavior regression.

File split. Adding the helper pushed CloudKitError+ErrorDescription.swift to 228 lines, over SwiftLint's 225-line file_length limit. networkErrorDescription and its helper move to a new CloudKitError+NetworkErrorDescription.swift, mirroring the existing CloudKitError+ZoneErrorDescription.swift, which was split out of the same file for the same reason.

Test coverage

There was previously no test for the .networkError description path. Four tests added to Tests/MistKitTests/CloudKitService/CloudKitErrorTests.swift, matching its existing style (@Suite/@Test/#expect/try #require, internal ACL, @testable import MistKit); the suite stays a struct since it remains a single file:

  1. only the string key present → URL reported (this is the one that regresses without the fallback)
  2. only the URL key present → absoluteString reported
  3. both present → URL key wins, string value absent
  4. neither present → no Failed URL: line at all

Nothing in the repo constructed URLError(_:userInfo:) before, so this establishes that pattern. The tests use the same hard-coded key literal rather than the deprecated constant — which both avoids re-introducing the warning in the test target and keeps the test independent of the production constant it exercises.

Verification

macOSswift build clean, swift test622 tests in 195 suites passed.

Linux (swift:6.3-noble in Docker) — I was able to verify this, and it changed the implementation (see the relocated-warning finding above). Before/after on the same image, filtering to warnings in package sources:

Before (base v1.0.0-beta.4 @ 61235b5):

CloudKitError+ErrorDescription.swift:183:24: warning: 'failureURLString' is deprecated: Use failingURL instead
URLRequest+AssetUpload.swift:33:10: warning: public import of 'FoundationNetworking' was not used in public declarations or inlinable code

After: no output — zero warnings. swift test on Linux also passes 622 tests in 195 suites.

LINT_MODE=STRICT ./Scripts/lint.sh — exits 1 with 28 violations, but this is exactly the pre-existing state of the base commit: I ran it on a clean tree at the merge base and on this branch under the same pinned toolchain and diffed the violation lists — identical, zero new or moved violations. (Note: the run must happen after mise trust; an untrusted mise.toml makes lint.sh's eval "$(mise env)" no-op and fall back to unpinned system tools, which produces ~54 spurious violations and rewrites unrelated files.)

Part of #433.

🤖 Generated with Claude Code

@coderabbitai

coderabbitaiBot commented Aug 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1f39a531-239d-4403-b6cf-5f7765e96a81

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecovBot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.64%. Comparing base (99deeac) to head (35a7504).

Additional details and impacted files
@@ Coverage Diff @@## v1.0.0-beta.4 #442 +/- ##
=================================================
+ Coverage 81.50% 81.64% +0.14% 
=================================================
Files 191 192 +1 Lines 4719 4723 +4 =================================================
+ Hits 3846 3856 +10 + Misses 873 867 -6 
FlagCoverage Δ
mistdemo-spm-macos11.30% <0.00%> (?)
mistdemo-swift-6.2-jammy11.30% <0.00%> (-0.01%)⬇️
mistdemo-swift-6.2-noble11.30% <0.00%> (-0.01%)⬇️
mistdemo-swift-6.3-jammy11.30% <0.00%> (-0.01%)⬇️
mistdemo-swift-6.3-noble11.30% <0.00%> (-0.01%)⬇️
mistdemo-swift-6.4-jammy11.30% <0.00%> (?)
mistdemo-swift-6.4-noble11.30% <0.00%> (?)
spm80.39% <100.00%> (+0.27%)⬆️
swift-6.1-jammy80.17% <100.00%> (+0.14%)⬆️
swift-6.1-noble80.34% <100.00%> (+0.18%)⬆️
swift-6.2-jammy80.28% <100.00%> (+0.24%)⬆️
swift-6.2-noble80.30% <100.00%> (+0.14%)⬆️
swift-6.3-jammy80.38% <100.00%> (+0.24%)⬆️
swift-6.3-noble80.22% <100.00%> (+0.24%)⬆️
swift-6.4-jammy80.32% <100.00%> (+0.03%)⬆️
swift-6.4-noble80.55% <100.00%> (+0.31%)⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leogdion
leogdionforce-pushed the 433-linux-build-warnings branch from 9483741 to 4cfa8d4CompareAugust 28, 2026 20:15
Fixes the two warnings surfaced by the Swift 6.4 Linux lane:
1. `URLRequest+AssetUpload.swift` declared `public import
FoundationNetworking` but its only declaration is an `internal init`.
Downgraded to `internal import` per the package's import convention.
2. `CloudKitError.networkErrorDescription` read the deprecated
`URLError.failureURLString`. Replaced with `failingURL?.absoluteString`
plus a fallback that reads the distinct legacy userInfo key directly,
so errors carrying only the string key still report their failed URL.
The network-error description moves to a new
`CloudKitError+NetworkErrorDescription.swift`, mirroring the existing
`CloudKitError+ZoneErrorDescription.swift` split, to stay under the
225-line file-length limit.
Adds four tests covering both userInfo keys, their precedence, and
neither being present.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xs1c8vvxjCxqZiStcmuPS2
@leogdion
leogdionforce-pushed the 433-linux-build-warnings branch from 4cfa8d4 to 35a7504CompareAugust 28, 2026 22:02
@leogdion
leogdion merged commit 608ff50 into v1.0.0-beta.4Aug 29, 2026
83 of 84 checks passed
@leogdion
leogdion deleted the 433-linux-build-warnings branch August 29, 2026 12:05
Sign up for freeto 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.

1 participant

@leogdion