Skip to content

refactor: rename usfm/USFM to passageId/bookId across SDK - #123

Closed
bryanmontz wants to merge 4 commits into
mainfrom
bdm/rename-usfm-to-passage-id
Closed

bryanmontz wants to merge 4 commits into
mainfrom
bdm/rename-usfm-to-passage-id

Conversation

@bryanmontz

@bryanmontz bryanmontz commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Renames the esoteric (and imprecisely used) usfm/USFM vocabulary to passageId/bookId across the SDK's public surface and internals.
  • Source-compatible: every renamed public symbol keeps a @available(*, deprecated, renamed:) forwarder. BibleReference's CodingKeys are made explicit so the JSON wire format ("bookUSFM", etc.) is preserved.
  • Sweeps tests, Examples/SampleApp, and README.md to use the new names.

Public-API renames (with deprecated forwarders kept)

  • BibleReference.bookUSFM → bookId (stored)
  • BibleReference.init(versionId:bookUSFM:chapter:verse:) → …:bookId:…
  • BibleReference.init(versionId:bookUSFM:chapter:verseStart:verseEnd:) → …:bookId:…
  • BibleReference.asUSFM → passageId
  • BibleReference.chapterUSFM → chapterPassageId
  • BibleVersion.bookUSFMs → bookIds

Internal renames

  • BibleContentStorage.chapter(versionId:usfm:) → (versionId:passageId:)
  • Internal locals/params (bookUSFM, usfm, chapterUSFM, asUSFM, subUSFMs, StateIn.bookUSFM, StateUp.bookUSFM, etc.) updated to match the new vocabulary throughout ChapterRepository, HighlightsCache, HighlightsRepository, HighlightsViewModel, URLBuilder, BibleVersionRendering, BibleAttributedString, BibleCardView, BibleTextView, BibleVersion+Additions, and the Reader view models / header / intro views.

Test plan

  • swift build — clean
  • swift test — 365 tests passing
  • scripts/check-api-stability.sh check — PASSED (additive only; no breaking changes)
  • swiftlint --strict — 0 violations

🤖 Generated with Claude Code

Greptile Summary

This PR renames Bible reference terminology across the SDK. The main changes are:

  • Public BibleReference APIs now use bookId, passageId, and chapterPassageId.
  • Deprecated forwarders preserve source compatibility for the old bookUSFM, asUSFM, and chapterUSFM names.
  • BibleReference keeps the existing bookUSFM JSON wire key through explicit coding keys.
  • Reader, UI, cache, highlight, sample app, README, and test code were updated to the new names.

Confidence Score: 5/5

The rename is source-compatible and preserves the existing JSON wire format.

The changes are broad but mechanical, with deprecated forwarders retained and the reported validation covering build, tests, API stability, and linting.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex attempted a swift build from detached worktrees for the requested commits, but the build exited with code 127 before any Swift code could run.
  • The before/after artifacts captured the exact commands, commits, and selected test files, and confirmed the blocker Exit code 127 (Swift binary not found).
  • The docs-sample before/after evidence shows USFM/bookId counts and confirms the build blocker due to the Swift executable not being found.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (4): Last reviewed commit: "Merge branch 'main' into bdm/rename-usfm..." | Re-trigger Greptile

USFM is an esoteric term and we weren't using it precisely. Replace it
with passage-id vocabulary throughout the public surface and internals.

- BibleReference: stored `bookUSFM` -> `bookId`, `asUSFM` -> `passageId`,
  `chapterUSFM` -> `chapterPassageId`. Explicit CodingKeys preserve the
  JSON wire format (`"bookUSFM"`).
- BibleVersion: `bookUSFMs` -> `bookIds`; internal param/local names
  updated. `book(with:)` / `reference(with:)` / `chapterLabels(_:)` keep
  their external selectors.
- Internal `BibleContentStorage.chapter(versionId:usfm:)` ->
  `(versionId:passageId:)`; renaming flows through ChapterRepository,
  HighlightsCache/Repository/ViewModel, URLBuilder, UI rendering,
  Reader view models.
- All deprecated old names kept as `@available(*, deprecated, renamed:)`
  forwarders so this is source-compatible. API stability check still
  passes (additive only).
- Tests, Examples/SampleApp, and README updated to the new names.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bryanmontz bryanmontz self-assigned this May 15, 2026
@bryanmontz
bryanmontz marked this pull request as ready for review May 15, 2026 20:49
@bryanmontz
bryanmontz requested a review from davidfedor May 15, 2026 20:49
Comment thread Tests/YouVersionPlatformCoreTests/BibleVersionTests.swift Outdated
Comment thread Sources/YouVersionPlatformCore/Bible/BibleReference.swift Outdated
- BibleReference.chapterPassageId: drop misleading optional; both
  contributing properties are non-optional so the value is always
  defined. Removes dead `guard let` branches at internal call sites.
  The deprecated `chapterUSFM: String?` forwarder is unchanged.
- BibleVersionTests: rename parameterized test `bookUSFMValidation`
  -> `bookIdValidation` to match the renamed parameter and set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@davidfedor

Copy link
Copy Markdown
Member

There need to be new API baseline files added to this PR, right? Given the newly public symbols.

case versionMetadata(versionId: Int)
case chaptersDirectory(versionId: Int)
case chapter(versionId: Int, usfm: String)
case chapter(versionId: Int, passageId: String)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This ends up being unclear what is meant by "passageId" here, when looked at in isolation. It might mean just the three-letter book code, or it might mean "JHN.3", or "JHN.3.16", and typechecking isn't going to help either. I think "bookId" is right.

Resolve conflict in BibleVersion+Additions.swift: take main's verseEnd
invariant fix (assertionFailure when verseStart is set but verseEnd is
nil) while keeping this branch's bookId rename.

Apply the usfm->passageId/bookId rename to test content merged in from
main (NavigationTests, BibleReferenceTests, BibleVersionDisplayTitleTests)
so the branch no longer uses its own deprecated APIs. JSON wire-format
keys remain "bookUSFM".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

✅ Commit Lint: passed

All commit messages in this PR conform to Conventional Commits.

📦 Release preview: v5.2.3 (no bump)

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

Release analyzer output
[analyzer] Analyzing commit: refactor: rename usfm/USFM to passageId/bookId across SDK

USFM is an esoteric term and we weren't using it precisely. Replace it
with passage-id vocabulary throughout the public surface and internals.

- BibleReference: stored `bookUSFM` -> `bookId`, `asUSFM` -> `passageId`,
  `chapterUSFM` -> `chapterPassageId`. Explicit CodingKeys preserve the
  JSON wire format (`"bookUSFM"`).
- BibleVersion: `bookUSFMs` -> `bookIds`; internal param/local names
  updated. `book(with:)` / `reference(with:)` / `chapterLabels(_:)` keep
  their external selectors.
- Internal `BibleContentStorage.chapter(versionId:usfm:)` ->
  `(versionId:passageId:)`; renaming flows through ChapterRepository,
  HighlightsCache/Repository/ViewModel, URLBuilder, UI rendering,
  Reader view models.
- All deprecated old names kept as `@available(*, deprecated, renamed:)`
  forwarders so this is source-compatible. API stability check still
  passes (additive only).
- Tests, Examples/SampleApp, and README updated to the new names.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
[analyzer] The commit should not trigger a release
[analyzer] Analyzing commit: refactor: address Greptile review comments

- BibleReference.chapterPassageId: drop misleading optional; both
  contributing properties are non-optional so the value is always
  defined. Removes dead `guard let` branches at internal call sites.
  The deprecated `chapterUSFM: String?` forwarder is unchanged.
- BibleVersionTests: rename parameterized test `bookUSFMValidation`
  -> `bookIdValidation` to match the renamed parameter and set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
[analyzer] The commit should not trigger a release
[analyzer] Analyzing commit: Merge branch 'main' into bdm/rename-usfm-to-passage-id

Resolve conflict in BibleVersion+Additions.swift: take main's verseEnd
invariant fix (assertionFailure when verseStart is set but verseEnd is
nil) while keeping this branch's bookId rename.

Apply the usfm->passageId/bookId rename to test content merged in from
main (NavigationTests, BibleReferenceTests, BibleVersionDisplayTitleTests)
so the branch no longer uses its own deprecated APIs. JSON wire-format
keys remain "bookUSFM".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
[analyzer] The commit should not trigger a release
[analyzer] Analyzing commit: Merge branch 'main' into bdm/rename-usfm-to-passage-id
[analyzer] The commit should not trigger a release
[analyzer] Analysis of 4 commits complete: no release

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage Report

Coverage after merging bdm/rename-usfm-to-passage-id into main will be
92.31%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/DerivedData/Build/Intermediates.noindex/YouVersionPlatform.build/Debug-iphonesimulator/YouVersionPlatformCoreTests.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.swift100%100%100%100%
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs
   URLBuilder.swift87.26%100%88.89%87.05%12–19, 90–99
   URLRequest+YouVersion.swift100%100%100%100%
   YouVersionAPI.swift96.91%100%100%96.55%73, 81, 83
/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.swift78.48%100%64.71%80.14%113, 125–132, 156, 159, 175, 202, 205, 213, 234–236, 31, 34, 50, 79, 83, 95
/Users/runner/work/platform-sdk-swift/platform-sdk-swift/Sources/YouVersionPlatformCore/APIs/Languages
   Languages.swift92.75%100%85.71%93.55%47–49, 79
/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.swift94.39%100%92.31%94.68%80–81, 87, 98
   SignInWithYouVersionPermission.swift0%100%0%0%8
   SignInWithYouVersionResult.swift86.21%100%50%92%
   Users.swift71.37%100%58.33%72.86%112, 144–150, 155, 16, 165, 17–20, 202, 205, 21, 222, 228, 245–247, 265–267, 269–271, 273–275, 277–279, 284–286, 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.swift87.59%100%85.71%88.03%102–104, 48–51, 59–62
   BibleContentStorage.swift100%100%100%100%
   BibleHighlight.swift55.56%100%50%57.14%12–14
   BibleHighlightsCache.swift83.92%100%80%84.96%103–105, 117–118, 135–136, 62, 65–67, 72
   BibleHighlightsRepository.swift77.42%100%67.44%78.72%128–132, 19–20, 204–205, 207–209, 21, 210–211, 23, 237–238, 24, 240–244, 25, 27–29, 306–309, 31, 310–319, 32, 320–329, 33, 330–332
   BibleHighlightsViewModel.swift95.35%100%93.75%95.58%45, 48, 52, 57
   BibleReference.swift81.49%100%61.90%84.74%104, 106, 108, 130, 145, 158, 253–254, 278, 282, 315, 328, 338, 348, 358, 360–371, 45–47, 50–52, 69, 74–78
   BibleTextNode.swift92.86%100%75%95.83%
   BibleTextNodeParser.swift94.29%100%100%93.79%104, 150, 155, 173, 190, 44, 56–59
   BibleVersion.swift68.69%100%81.25%66.27%110–129, 61, 71–74, 78, 83
   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.swift55.36%100%41.67%59.09%100, 49–51, 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/Tests/YouVersionPlatformCoreTests
   AbbreviationSplittingTests.swift100%100%100%100%
   BibleChapterRepositoryTests.swift100%100%100%100%
   BibleContentStorageTests.swift100%100%100%100%
   BibleHighlightsCacheTests.swift100%100%100%100%
   BibleHighlightsRepositoryTests.swift99.52%100%100%99.48%56, 66
   BibleHighlightsViewModelTests.swift95.82%100%96.88%95.67%19–25, 30, 38, 46
   BibleMetadataAPITests.swift100%100%100%100%
   BibleReferenceTests.swift100%100%100%100%
   BibleReferenceTests_adjacency.swift100%100%100%100%
   BibleReferenceTests_codable.swift100%100%100%100%
   BibleReferenceTests_contains.swift100%100%100%100%
   BibleReferenceTests_existsIn.swift89.19%100%80%90.63%15–17, 9
   BibleReferenceTests_overlaps.swift100%100%100%100%
   BibleReferenceTests_unvalidatedReference.swift100%100%100%100%
   BibleTextNodeTests.swift100%100%100%100%
   BibleVersionAPITests.swift97.51%100%93.33%97.85%61–63
   

@davidfedor

Copy link
Copy Markdown
Member

since this PR is ancient, I'm closing it, and having Codex do the same concepts, starting fresh.

@davidfedor davidfedor closed this Jul 27, 2026
@bryanmontz

Copy link
Copy Markdown
Contributor Author

@davidfedor Sounds good. Sorry I left it forever!

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