Skip to content

feat: add usable Bible version filters - #340

Merged
cameronapak merged 11 commits into
mainfrom
cursor/cp/ype-4657-usable-version-0c10
Aug 20, 2026
Merged

feat: add usable Bible version filters#340
cameronapak merged 11 commits into
mainfrom
cursor/cp/ype-4657-usable-version-0c10

Conversation

@cameronapak

@cameronapak cameronapak commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Implements YPE-4657: apps can limit which Bible versions the SDK uses.

Public API

  • permittedVersionIds, excludedVersionIds, permittedLanguageTags on YouVersionProvider (and YouVersionPlatformConfiguration for core-only hosts)
  • Unset = no restriction. Empty permit list = permit nothing. Allowlists AND. Exclusion wins.

Refuse

  • An unusable id is not a Bible version this app may use — lists, picker, recents, reader/card/text/VOTD, core/hooks
  • Core throws Error with status: 403 before returning scripture (no network when the id alone decides)
  • UI reuses forbiddenError. One dev console.warn for a host-passed unusable versionId
  • No silent fallback to 3034. No picker-as-escape-hatch

Lists

  • Filtered getVersions / getLanguages walk server pages so a usable row on a later page is not dropped
  • page_size: '*' still walks every server page when filter field injection exceeds the API's 3-field * cap
  • Picker recents are hidden at read time; localStorage is not rewritten

Docs: CONTEXT.md, docs/adr/YPE-4657-usable-bible-version.md, package READMEs.

Open in Web Open in Cursor 

Greptile Summary

The PR adds app-configurable Bible-version and language filters across core, hooks, and UI.

  • Enforces allowlists and exclusions before scripture and highlight operations.
  • Filters version and language collections while preserving pagination overflow.
  • Propagates filter configuration through providers and hides unusable picker entries and recents.
  • Adds tests, documentation, and package changesets for the public API.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/core/src/version-filters.ts Implements filter predicates and resumable filtered pagination; the stable-page overflow fix preserves all usable rows.
packages/core/src/languages.ts Preserves logical all-page collection while omitting the incompatible wire-level page_size parameter when filter fields are injected.
packages/core/src/bible.ts Applies version policy to collection and content APIs, including metadata checks for language-based restrictions.
packages/core/src/highlights.ts Enforces the same usable-version policy before highlight reads, writes, and deletes.
packages/hooks/src/context/YouVersionProvider.tsx Synchronizes provider filter props to core configuration before descendants can fetch.
packages/ui/src/components/YouVersionProvider.tsx Propagates filter configuration through the UI provider and bundled core boundary.
packages/ui/src/components/bible-version-picker.tsx Applies version restrictions to picker results and restored recent selections.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Host[Host application] --> Provider[YouVersionProvider filters]
  Provider --> Config[Platform configuration]
  Config --> Core[Core version checks]
  Core --> Lists[Filtered versions and languages]
  Core --> Content[Scripture and highlight requests]
  Lists --> UI[Picker and recents]
  Content -->|Usable| API[Platform API]
  Content -->|Unusable| Forbidden[403 forbidden error]
Loading

Reviews (9): Last reviewed commit: "fix: give vapor-flash tests headroom pas..." | Re-trigger Greptile

Grill-shaped glossary and ADR so implementation uses Swift names
without copying Swift's picker-vs-text split.

Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com>
@changeset-bot

changeset-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 73b6bc3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@youversion/platform-core Minor
@youversion/platform-react-hooks Minor
@youversion/platform-react-ui Minor
vite-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Apps can limit which Bible versions the SDK uses via
permittedVersionIds, excludedVersionIds, and permittedLanguageTags.
Core refuses unusable ids with 403; lists walk pages; UI reuses the
forbidden error and hides filtered recents without rewriting storage.
@cameronapak
cameronapak marked this pull request as ready for review August 18, 2026 21:14
@cameronapak cameronapak self-assigned this Aug 18, 2026
Comment thread packages/core/src/version-filters.ts Outdated
Resume mid-page with a client cursor so page_size slicing does not drop
usable versions or languages, and never send that cursor to the API.

Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com>
@cursor cursor Bot changed the title docs: shape YPE-4657 usable Bible version filter feat: add usable Bible version filters Aug 18, 2026
Comment thread packages/core/src/version-filters.ts
@cameronapak

Copy link
Copy Markdown
Collaborator Author

@greptile review

Code Implementor, sent on behalf of Cam. I am AI.

The last open thread is resolved. The catalog does not change order during pagination. Please post a new review so the official score matches the 5/5 you already agreed on that thread.

Comment thread packages/core/src/bible.ts Outdated
Comment thread packages/core/src/highlights.ts
Injected filter fields can exceed the API's 3-field page_size=* cap.
Drop * from the HTTP request only; collectFilteredPage still walks
every server page so usable versions are not truncated.
…able-version-0c10

# Conflicts:
#	packages/ui/src/components/bible-version-picker.test.tsx
Parse the leftover-page cursor with Zod, name the resume start type,
drop a useless array copy, and stop annotating test page maps as Record.
Comment thread packages/core/src/languages.ts
Same as getVersions: injecting id can exceed the API's 3-field
page_size=* cap. Drop * from HTTP params only so getLanguages still
returns every usable language across server pages (YPE-4657).
Comment thread packages/core/src/bible.ts
Unfiltered *+>3 fields must stay a loud schema reject, not a silent
single-page fetch. Only strip * from HTTP params when a filter
injected extra fields and collectFilteredPage will walk.
Comment thread packages/ui/src/lib/use-version-filter-warning.ts
The unit project still uses Vitest's 5s default, so a loaded CI runner
could expire the it() while a 5s waitFor was still open.

@Dustin-Kelley Dustin-Kelley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🙌

@cameronapak
cameronapak merged commit 830d5d5 into main Aug 20, 2026
14 checks passed
@cameronapak
cameronapak deleted the cursor/cp/ype-4657-usable-version-0c10 branch August 20, 2026 15:57
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.

3 participants