Skip to content

test: cover highlight repository failures - #127

Open
davidfedor wants to merge 7 commits into
mainfrom
codex/move-preview-member-to-extension
Open

test: cover highlight repository failures#127
davidfedor wants to merge 7 commits into
mainfrom
codex/move-preview-member-to-extension

Conversation

@davidfedor

@davidfedor davidfedor commented May 18, 2026

Copy link
Copy Markdown
Member

Motivation

  • Increase code coverage by exercising previously untested failure paths in the highlights repository (parsing malformed passage IDs and API failure / error branches).
  • Ensure repository queue and retry behavior is validated for remove/update failures and when saveOperations throws.

Description

  • Added test-only helpers and a throwing test subclass in Tests/YouVersionPlatformCoreTests/BibleHighlightsRepositoryTests.swift to simplify creating common BibleReference/PendingHighlightOperation fixtures and simulate a saveOperations failure.
  • Marked the test MockBibleHighlightsAPI as final and kept it as the mock implementation for API calls used in tests.
  • Added tests that cover malformed passageId values so convertToBibleHighlight() failure paths are hit via highlights(for:).
  • Added tests for saveOperations and processQueue covering remove/update failure results, thrown API errors, and the re-queue/retry behavior when operations fail or saveOperations throws.

Testing

  • Ran swift test and the full test suite completed successfully with all tests passing.
  • Ran SwiftLint via LINUX_SOURCEKIT_LIB_PATH=/root/.local/share/swiftly/toolchains/6.1.3/usr/lib /tmp/swiftlint-install/swiftlint --strict and it reported no violations.

Codex Task

Greptile Summary

The PR expands highlight repository failure-path coverage while making queue scheduling controllable in tests.

  • Adds an internal queue-processing switch that preserves automatic processing for production callers.
  • Adds deterministic coverage for failed remove/update operations, thrown save errors, and automatic retries.
  • Introduces reusable highlight-operation fixtures and sequential mock create results.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
Sources/YouVersionPlatformCore/Bible/BibleHighlightsRepository.swift Adds an internal test-control flag around automatic queue startup and retry scheduling while retaining existing behavior through the public initializer.
Tests/YouVersionPlatformCoreTests/BibleHighlightsRepositoryTests.swift Expands failure and retry coverage, removes real retry delays from manually controlled tests, and renames the operation fixture helper to avoid shadowing.

Reviews (8): Last reviewed commit: "refactor: consolidate highlight reposito..." | Re-trigger Greptile

Context used:

@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

✅ Commit Lint: passed

All commit messages in this PR conform to Conventional Commits.

📦 Release preview: v5.4.0 (no bump)

These commits do not trigger a version bump. The published version on main would remain v5.4.0.

Release analyzer output
[analyzer] Analyzing commit: test: cover highlight repository failures
[analyzer] The commit should not trigger a release
[analyzer] Analyzing commit: chore: merge main
[analyzer] The commit should not trigger a release
[analyzer] Analyzing commit: test: harden highlight repository failure coverage
[analyzer] The commit should not trigger a release
[analyzer] Analyzing commit: test: remove timing delays from highlight tests
[analyzer] The commit should not trigger a release
[analyzer] Analyzing commit: chore: merge main
[analyzer] The commit should not trigger a release
[analyzer] Analyzing commit: test: rename highlight operation factory
[analyzer] The commit should not trigger a release
[analyzer] Analyzing commit: refactor: consolidate highlight repository initializers
[analyzer] The commit should not trigger a release
[analyzer] Analysis of 7 commits complete: no release

@davidfedor
davidfedor marked this pull request as ready for review May 18, 2026 19:13
Comment thread Tests/YouVersionPlatformCoreTests/BibleHighlightsRepositoryTests.swift Outdated
@davidfedor

Copy link
Copy Markdown
Member Author

@greptile please re-review

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage Report

Coverage after merging codex/move-preview-member-to-extension into main will be
42.62%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/DerivedData/Build/Intermediates.noindex/YouVersionPlatform.build/Debug-iphonesimulator/YouVersionPlatformReader.build/DerivedSources
   resource_bundle_accessor.swift87.50%100%75%88.89%19, 44–45
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/DerivedData/Build/Intermediates.noindex/YouVersionPlatform.build/Debug-iphonesimulator/YouVersionPlatformUI.build/DerivedSources
   resource_bundle_accessor.swift87.50%100%75%88.89%19, 44–45
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore
   YouVersionPlatformConfiguration.swift90.83%100%80%92.55%145–147, 40–42
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs
   URLBuilder.swift88.70%100%90%88.54%110–119, 12–19
   URLRequest+YouVersion.swift100%100%100%100%
   YouVersionAPI.swift94.97%100%90.91%95.48%11–13, 154, 62, 70, 72
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Bible
   BibleVersionAPI.swift73.50%100%66.67%74.51%118–132, 37–39, 58, 65–67, 75, 87
   BibleVersions.swift93.06%100%100%92.06%32, 54, 60–61, 83
   Highlights.swift80.47%100%68.42%82%109–116, 158, 161, 180, 183, 212, 215, 223, 227, 260–262, 63, 67, 79, 97
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/DataExchange
   DataExchange.swift97.37%100%100%97.14%39
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Languages
   Languages.swift93.90%100%87.50%94.59%104, 47–49
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Organizations
   Organizations.swift37.04%100%33.33%37.50%29–39, 41–43, 51
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Users
   SignInWithYouVersionPKCEAuthorizationRequest.swift81.25%100%73.68%82.40%100, 111, 122–129, 137, 75–81, 99
   SignInWithYouVersionPermission.swift69.77%100%60%71.05%18, 20, 22, 26, 39, 50–51, 53–56
   SignInWithYouVersionResult.swift39.68%100%20%43.40%15–17, 44–56, 83–91
   Users.swift74.13%100%67.74%75%112, 150–156, 16, 161, 17, 171, 18–20, 208, 21, 211, 228, 234, 252–254, 278–280, 282–284, 286–288, 290–292, 297–299, 31–40, 44, 61, 67–71, 85
   YouVersionUserInfo.swift70.59%100%50%73.33%18, 29–31
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/VOTD
   VOTD.swift94.12%100%100%93.33%22
   YouVersionVerseOfTheDay.swift0%100%0%0%15–18, 20–25
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/Bible
   BibleBook.swift100%100%100%100%
   BibleChapterRepository.swift85.26%100%82.76%85.83%111–113, 42, 49, 54–57, 65–68, 83
   BibleContentStorage.swift100%100%100%100%
   BibleHighlight.swift55.56%100%50%57.14%12–14
   BibleHighlightsCache.swift86.71%100%83.33%87.61%103–105, 117–118, 62, 65–67, 72
   BibleHighlightsRepository.swift94.87%100%86.79%96.01%19–21, 23–25, 27–29, 31–33
   BibleHighlightsViewModel.swift90.68%100%85.71%91.43%33–36, 66, 69, 73
   BibleReference.swift84.30%100%67.80%86.90%136, 231–232, 256, 260, 293, 306, 316, 326, 336, 338–349, 53–57, 88, 90, 92
   BibleTextNode.swift92.86%100%75%95.83%
   BibleTextNodeParser.swift94.29%100%100%93.79%104, 150, 155, 173, 190, 44, 56–59
   BibleVersion.swift70.10%100%86.67%67.07%107–126, 61, 71–74, 80
   BibleVersionRepository.swift86.30%100%83.02%87.03%125–128, 173, 212–217, 243, 248, 276–278, 71–74, 82–85
   DeprecatedBibleAPI.swift0%100%0%0%100, 102–104, 106–108, 110–112, 114–116, 119–121, 126, 128, 131–133, 138, 140, 142–144, 147–149, 27, 29–31, 36, 38, 40–42, 44–46, 48–50, 52–54, 56–58, 65–67, 69–71, 73–75, 77–79, 81–83, 85–87, 94–96, 98–99
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/Logging
   YouVersionPlatformLogger.swift62.50%100%50%65.91%100, 56–58, 77–79, 90, 92, 94, 98
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/Utilities
   AbbreviationSplitting.swift100%100%100%100%
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformReader
   BibleReaderNavigation.swift100%100%100%100%
   BibleReaderView.swift0%100%0%0%104–112, 119–129, 144–153, 155–180, 187, 194–197, 200–204, 206–278, 282, 284–287, 291, 293–313, 316–320, 322–341, 343–360, 362–381, 383–388, 390–415, 417–439, 44, 440–449, 45, 450–459, 46, 460–469,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant