Move five untested Foundation extensions to WordPressShared and add tests#25826
Merged
Conversation
A pure-Foundation leaf that lived in the app with no test coverage. Relocating it to WordPressShared makes it reusable and exercisable under the root `swift test` cross-platform gate, with a new Swift Testing suite. All three existing call sites already import WordPressShared, so no caller changes are needed.
A pure-Foundation leaf (Data → hexadecimal string, used to stringify the push notification device token) that lived in the app untested. The similarly named UIColor.hexString in WordPressUI is a separate extension and is unchanged. The one real caller, PushNotificationsManager, already imports WordPressShared. Adds a Swift Testing suite.
…tests A pure-Foundation leaf, untested, used by the media exporters to hand back an already-complete Progress. Relocated to WordPressShared; the five exporter call sites pick up an import WordPressShared. Adds a Swift Testing suite.
A pure-Foundation, NSLock-backed property wrapper, untested, used by two Blog Dashboard helpers. Relocated to WordPressShared with the wrapper, its init, and wrappedValue made public (load/store stay internal); both call sites pick up an import WordPressShared. Adds a Swift Testing suite.
A pure-Foundation leaf (day counting and localized<->unlocalized weekday index conversions), untested despite fiddly modular arithmetic. It already leaned on WordPressShared's normalizedDate(), so relocation is natural; the two call sites pick up an import WordPressShared. Adds a Swift Testing suite covering the weekday-index conversions and day counting. Keeps the legacy NSCalendar+Helpers file name.
Contributor
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 33382 | |
| Version | PR #25826 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 6ad9013 | |
| Installation URL | 0sr9id5pvleb0 |
Contributor
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 33382 | |
| Version | PR #25826 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 6ad9013 | |
| Installation URL | 2oc66k87hu4c0 |
Contributor
🤖 Build Failure AnalysisThis build has failures. Claude has analyzed them - check the build annotations for details. |
jkmassel
force-pushed
the
jkmassel/relocate-untested-extensions
branch
from
July 22, 2026 21:43
eeabaf8 to
af107f1
Compare
crazytonyli
approved these changes
Jul 22, 2026
Adds edge-case coverage to the suites introduced earlier in this branch, worked up via an analyze-then-adversarially-verify pass over each one: - Data.hexString: high bytes (no sign extension), byte order, a full 0...255 nibble reference, a hex round-trip, a UTF-8 reference vector, and a non-zero-start-index slice. - Progress: distinct-instance independence, determinacy, not cancelled/paused, and that discreteCompletedProgress() does not attach to a current parent (the reason it uses discreteProgress). - @atomic: a 10k-iteration concurrent readers/writers stress test, value copy independence, reference identity, and Optional/nil round-trip. - Calendar: round-trip identity and in-range invariants across all seven firstWeekday values, a Saturday-start case, multi-span day counts, negative (future) counts, and time-of-day normalization. Bool.stringLiteral is a two-value mapping already fully covered, so it gets nothing. Two proposals were corrected during review: the @atomic concurrency assertion moved outside the concurrentPerform closure (GCD threads don't carry Swift Testing's task-local context), and the Progress parent check now asserts before resignCurrent, which otherwise auto-completes the pending unit.
jkmassel
force-pushed
the
jkmassel/relocate-untested-extensions
branch
from
July 22, 2026 23:26
af107f1 to
6ad9013
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Continues the cross-platform
WordPressSharedwork (#25825, #25815, #25344). Where those PRs moved extensions that already had a test inKeystoneTests, this one goes after app-layer Foundation extensions that had no test at all — so a test-driven sweep never surfaced them. Each is a pure-Foundationleaf that belongs in the library layer; relocating it intoWordPressSharedmakes it reusable and, for the first time, exercisable under the rootswift testcross-platform gate. Every move lands with a new Swift Testing suite.Moved (each with a new suite in
WordPressSharedTests)Calendarday/weekday helpers (NSCalendar+Helpers)Bool.stringLiteral"true"/"false"Data.hexStringProgress.discreteCompletedProgress()Progress@AtomicNSLock-backed property wrapper+9XCTest-equivalent cases under the rootswift testgate, all green.Caller changes
Nine files pick up an
import WordPressShared; the members used by the app are madepublic(Calendar's were already public, and@Atomicexposes only the wrapper/init/wrappedValue—load/storestay internal). Two of the five needed no caller changes at all —Bool.stringLiteral's three call sites andData.hexString's one real caller already importWordPressShared.Note:
Data.hexStringis distinct from the similarly namedUIColor.hexStringinWordPressUI— that one is unrelated and untouched.Considered but not moved
Pattern.swift(thePattern<Element>closure combinators) looked like a relocation candidate, but it's still used byPingHubManager, so it stays put.Test plan
swift testfrom the repo root: 86 tests / 16 suites, 0 failures — the five new suites (BoolStringRepresentationTests,DataHexStringTests,ProgressHelpersTests,AtomicTests,CalendarHelpersTests) run under the cross-platform gate.xcodebuild build-for-testing -scheme WordPress -testPlan WordPressUnitTests -destination 'generic/platform=iOS Simulator':** TEST BUILD SUCCEEDED **— the app and every module/test target still compile, with all nine caller imports resolving.swiftlint: 0 violations across the 19 changed files.Related