Conversation
🦋 Changeset detectedLatest commit: cb1ff01 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
Search hits and the structural validator both need the same chapter/verse shape. parseUsfmReference owns that grammar so inverted ranges drop at the boundary instead of leaking into the reader.
The PRD's suggestion-suppression, stale-page, and dedupe rules are consequences of one SearchSession union plus a pure reducer, so the eight phases can be proven without timers or network.
Headless hosts get one phase and five commands. Debounce, language-range gating, and page commits stay inside the hook so UI never sees tokens or TanStack Query.
Content can scroll and dim only after the destination chapter is on screen. A seq mailbox plus a hold timer keeps focus separate from verse selection.
Hosts get a zero-required-prop search dialog that talks to useBibleSearch and navigates through one Root-owned verse-focus mailbox. English keys land here so the UI can ship; platform-localization still owns the canonical source.
The public helpers and Reader search UI are new surface on core, hooks, and ui, so they ship as minors together.
The first keystroke after submit left the submitted lane while debounce still held that query. Suggestions then re-fetched it and showed a spinner. Debounce null while submitted, and skip queriesRequest until the new input settles.
The hold-clear scroll listener sat on the renderer root, which does not scroll. Listen on the nearest overflow ancestor instead. Drop the unused focusedVerses return. Content never read it.
1773708 to
b29aaf2
Compare
Widen useDebounce test props so null flush typechecks. Wait for the Reader canvas before clicking Search. Revert human en.json edits and keep English via t() defaultValue until platform-localization syncs bibleSearch* keys.
The previous CI fix copied en.json from the deleted search API tip, which still differed from main. That kept Locale Ownership red and broke version-picker and verse tests that assert main's English copy.
Unsafe integer endpoints stall `verse += 1` at 2^53 and oversized spans allocate huge arrays. Lock the intended rejection before the parser change.
Number.isInteger accepted 2^53 endpoints, so verse += 1 never advanced and search hits could hang. Reject non-safe integers and spans over 250 verses instead of expanding them.
cameronapak
left a comment
There was a problem hiding this comment.
Review
Summary
Standards: 0 must-fix. Spec: 10 must-fix. Primary concern: host navigation is unavailable and automatic scrolling clears selected-verse focus before arrival.
For Agents
- CI: failing. Integration Tests reports 582 passing assertions and 11 unhandled rejections; the cause is not established. Other build, typecheck, lint, and unit-test checks pass.
- Bot review: clear; earlier bot findings are resolved.
- Event: REQUEST_CHANGES
- HEAD: 9720ea4
- Spec: the user-supplied artifact of the Search PRD, linked from parent YPE-5622.
- Verification: 92 existing targeted Vitest tests passed. Three focused regression reproductions failed for result deduplication, stale suggestions, and wildcard fallback. Chromium confirmed automatic scrolling clears focus before arrival. Temporary reproduction fixtures were removed.
Written by Code Reviewer bot on behalf of Cam.
There was a problem hiding this comment.
This change allows for us to be able to easily add Zod to the UI package
Dustin-Kelley
left a comment
There was a problem hiding this comment.
Review posted by Claude (AI agent) on behalf of Dustin. Four inline comments below using Conventional Comments.
| vReq?.versionId, | ||
| vReq?.query ?? '', | ||
| vReq?.pageToken ?? '', | ||
| props.bookIds, |
There was a problem hiding this comment.
suggestion (non-blocking): props.bookIds is part of the searchVerses query key, but the fetch never uses it — filtering is client-side in deriveSearchPhase.
Toggling the testament filter while a page is in flight changes the key, so TanStack abandons that request and fires an identical /v1/search-verses call under the new key; the first response is cached under a key that's never observed again.
Dropping props.bookIds from the key removes the redundant request with no behaviour change.
Posted by Claude on behalf of Dustin.
There was a problem hiding this comment.
I'm keeping bookIds in this query key for this PR. You're right that it can duplicate a request, but removing it changes the agreed filter behavior: switching testament after a failed continuation must immediately clear the stale error and retry. Avoiding the extra request needs separate error-reset/retry handling rather than only removing the key.
Verification evidence
- Coordinator-run counterexample: temporarily removed bookIds and ran pnpm --filter @youversion/platform-react-hooks exec vitest run src/useBibleSearch.test.tsx -t 'replaces a failed continuation'. The test failed: expected nextPage: loading, received nextPage: failed.
- Restored bookIds in 7d6fe84. Full unit suite: 1437 passed, 2 live API tests skipped; 61 Chromium stories passed.
- This retains the extra-request tradeoff; it does not implement request deduplication across testament filters.
Written by Coding Agent on behalf of Cam.
abharms
left a comment
There was a problem hiding this comment.
Reviewed the current head (77aa9e6) against YPE-5766, its parent ticket, the PR's stated behavior, the public navigation contract, and the existing review threads. I left four confirmed issues inline; the first three are blocking.
The exclusive browsing/submitted search lane and stale-response guards are especially well designed—they make concurrent suggestion/result behavior much easier to reason about. The transient-focus implementation also shows thoughtful accessibility work around focus timing, reduced motion, and preserving user input.
I did not rerun the suite locally; the PR's GitHub checks are green at this head.
Important
This pull request was started by Cameron Llewellyn and passed onto Cameron Pak
Bible Reader search
Adds toolbar search with suggestions, browser-local recents, testament filters, verse previews, and navigation that centers the selected verse while dimming surrounding verses. Hosts can use
useBibleSearchheadlessly or override the toolbar action withonSearchPress.Closes YPE-5766. Parent: YPE-5622.
UI views
Current Chromium captures using live API data. Filters expand as an accordion; reduced motion uses a fade.
Dark mode
Verification and remaining limitations
The PR appears safe to merge.
Summary
The PR adds end-to-end Bible Reader search with suggestions, local recents, testament filters, paginated verse results, navigation, and transient verse focus.
useBibleSearchsession and search client integration.Diagram
Reviews (16) · Last reviewed commit: "chore: merge main into Bible search bran..."