Skip to content

feat(ui): save notes from the Reader (YPE-6783) - #508

Open
abharms wants to merge 42 commits into
mainfrom
codex/YPE-6783-reader-save-notes
Open

abharms wants to merge 42 commits into
mainfrom
codex/YPE-6783-reader-save-notes

Conversation

@abharms

@abharms abharms commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Reader Save Notes — YPE-6783

Add the Reader Save action and a composer for the exact selected passage, including gaps, optional text, Private/Public visibility, and highlight color. Save requests Notes authorization when needed and refreshes chapter highlights after success.

Drafts survive cancellation, declined authorization, recoverable failures, and the OAuth redirect. Sign-out/account replacement invalidates owned drafts; stale callbacks cannot resume a different account’s action. Save retries reuse the draft UUID, with reconciliation when a create response is lost. Built-in auth and host-controlled/disabled auth remain separate.

Scope stays with note creation. Saved-note indicators, lists, editing, deletion, and tags are deferred. The existing useYVAuth implementation and its tests are unchanged from the base branch. The added token-observer API and provider-held legacy snapshots were removed. Account-bound grant metadata, expired legacy-binding recovery, and account checks for highlight reads remain.

Breaking: the published BuiltInVerseAction union adds 'save'; exhaustive consumer maps/guards must handle it. The UI changeset therefore declares a major release.

Validation

  • Workspace build, six typechecks, lint, bundle limits, and tree-shaking checks passed.
  • The fresh full unit run passed all 1,308 tests (3 opt-in skips).
  • Final Notes suite: 15 Chromium journeys passed. The retained recovery and host-controlled cases also passed in Firefox and WebKit.
  • Full-app mocked Notes smoke: passed (OAuth callback route, decline, competing highlight intent, token-service recovery, exact create, stale callback, same-account re-sign-in, sign-out, navbar scopes, and narrow layout).

The focused follow-up removes 831 net lines, including the legacy-session/rotation-observer layer, its tests, and redundant browser scenarios. The Notes suite has 15 journeys after deleting duplicate staged-account, session-replacement/remount, and pre-composer Back scenarios; coverage remains in the real-provider hook workflow, permissions workflow, and full-app smoke. Two files now match the base branch, reducing the PR diff from 61 to 59 files.

Live API blocker and earlier QA

Passage-only saving sends empty content as required by the ticket and native SDK design. The last verified live API request returned HTTP 400 (content: String should have at least 1 character); the API-owned fix still needs deployment and live retesting. No placeholder workaround was added. Mocked browser tests do not establish live passage-only support.

Earlier live text-filled saves passed composer close, exact passage/color persistence, and highlight refresh. BrowserStack run TR-17: three passed cases, linked to YPE-6783. Those results came from local Chromium execution and do not include the blocked passage-only case.

Confidence Score: 5/5 · The latest changes appear safe to merge; no new actionable issue was found.RetriggerView in GreptileConfidence Score: 5/5

The latest changes appear safe to merge; no new actionable issue was found.

Summary

Adds Reader Notes with exact verse selections, optional text, visibility, color, and account-bound authorization.

  • The Bible Reader saves notes for the selected verses.
  • The SDK exposes token-based hooks for creating and updating notes.
  • The SDK keeps OAuth grants and pending work tied to the right account.
  • The Reader refreshes the right chapter after a note save.
  • The Reader’s note and action controls expose clearer labels and focus behavior.
  • The Vite example can run a mocked Notes flow in CI.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Select verses and choose Save] --> B{Notes permission available?}
  B -->|No| C[Keep draft and request authorization]
  C --> D[Check returned state and account]
  D --> E[Open composer]
  B -->|Yes| E
  E --> F[Create note with draft UUID]
  F -->|Recoverable failure| E
  F -->|Earlier create returned different fields| G[Update that note]
  G --> H[Close composer and refresh highlights]
  F -->|Saved fields match| H
Loading

Reviews (24) · Last reviewed commit: "refactor: reuse oauth cleanup and reader..." · Reviewed by Greptile

platform-localization-pr-bot Bot and others added 15 commits November 24, 2026 10:30
chore: sync react localization

Co-authored-by: camrun91 <16566029+camrun91@users.noreply.github.com>
* fix(core): sanitize planted footnote content in Bible HTML

Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com>

* fix(core): address review on footnote sanitization

Sanitize footnote content in an inert template, drop non-HTML-namespace
elements, sanitize generated footnote content for idempotency, document the
sanitization contract, and consolidate tests.

Co-Authored-By: Cameron Pak <cameronandrewpak@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* refactor(ui): organize Bible reader modules (YPE-6808)

* refactor(ui): extract reader settings lifecycle and toolbar (#495)

* refactor(ui): extract reader settings lifecycle and toolbar (YPE-6815)

* fix(ui): address reader settings review feedback
* feat(ui): re-export passage and versions hooks

Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7

* chore(ci): remove packed UI consumer check

* docs(ui): clarify shared provider import guidance

Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7

* docs: address hook re-export review nits

Amp-Thread-ID: https://ampcode.com/threads/T-01a20e73-4446-71f0-950a-3054df5492c7

---------

Co-authored-by: Amp <amp@ampcode.com>
* fix(ui): preserve focus at high zoom

* fix(ui): harden zoom focus coverage

* refactor(ui): simplify zoom focus handling

* test(ui): cover zoom focus behavior

* test(ui): focus reader close before asserting

* fix(ui): address zoom review findings

* test(ui): compare pointer focus styles

* test(ui): respect focus-visible heuristics

* test(ui): use native focus traversal

* fix(ui): scope focus preservation

* fix(ui): preserve sign-in focus contrast

* test(ui): await close focus transition

* refactor(ui): centralize picker scroll geometry

* fix(ui): keep picker focus visible in constrained panels

* fix(ui): preserve the expanded book trigger in compact panels

* test(ui): reach reader settings close with native keys

* fix(ui): honor reduced motion in chapter reveal

* fix(ui): address focus and scroll review feedback

* fix(ui): reveal focused chapters in Firefox

Keep focused book triggers fully visible within the built-in accordion on Linux Firefox. Wait for the settings dialog opening animation before asserting visibility in WebKit.

* test(ui): query the current settings dialog while opening
* feat(core): add content library video APIs

* refactor(core): simplify video schema ownership

* fix(core): harden content library contracts

* fix(core): validate video response boundaries

* fix(core): distinguish no-content responses

* fix(core): scope no-content status handling

* fix(core): distinguish empty response bodies

* test(core): isolate Content Library smoke coverage

* feat(core): keep content library APIs compatible with v3

* fix(core): align content library rollout contracts (YPE-6573)

* fix(core): accept empty video filters and trim search bundles (YPE-6573)

* fix(core): address content library review feedback (YPE-6573)

* docs(core): clarify video APIs and live validation (YPE-6573)

* fix(core): use stable Content Library routes (YPE-6573)
* feat(core): add Notes API client

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

* fix(core): address Notes API review feedback

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

* fix(core): normalize Notes write colors

* fix(core): address Notes API contract review

* fix(core): enforce Notes version filters and tolerate malformed passages

* fix(core): isolate malformed Notes list records

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

* chore: refresh combined core bundle budget

Amp-Thread-ID: https://ampcode.com/threads/T-01a2095d-25a9-72c5-a0fb-baa79c35e05a

---------

Co-authored-by: Amp <amp@ampcode.com>
* fix(ui): label reader sign-in menu trigger (YPE-6810)

* test(ui): capture Linux WebKit dialog visibility failures

* test(ui): stress WebKit visibility diagnostics

* test(ui): check settings visibility after keyboard focus

Assert dialog opening state after Enter and visibility on the Close button after native Tab, alongside the focus-ring checks. Remove temporary WebKit diagnostics and repeated CI groups.
* fix(ui): handle reader clipboard failures (YPE-6809)

* fix(ui): report clipboard failures and retry failed shares

* fix(ui): keep clipboard warnings visible while scrolling

* fix(ui): ignore stale clipboard action results
* fix(ui): retain iframe verse selection and anchors (YPE-6410)

* test(ui): cover iframe highlight painting and reset

* fix(ui): complete iframe reader text and focus handling
chore(ui): align declaration build with strict checks

Refs: YPE-6464
* chore(ui): align declaration build with strict checks

Refs: YPE-6464

* chore: enable additional TypeScript safety checks

Refs: YPE-6832
* feat(ui): customize verse actions and indicators

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* test(ui): wait for verse layout in browser journeys

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): keep configured verse actions reachable

Make exiting actions inert and keep the visible verse indicator inside its pointer target.

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): keep verse callbacks scoped to the displayed passage

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): preserve verse action focus and warning visibility

Signed-off-by: Austin <abharms@gmail.com>

* fix(ui): restore focus after rejected verse action dismissal

Refs: YPE-6782
Signed-off-by: Austin <abharms@gmail.com>

---------

Signed-off-by: Austin <abharms@gmail.com>
@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 047ece5

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-react-ui Major
@youversion/platform-core Major
@youversion/platform-react-hooks Major
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

Preserve the draft on browser Back and clean up a partially persisted automatic token refresh. Keep the composer within narrow viewports and simplify the shared action and highlight paths.

Ref: YPE-6783
Keep note handoffs bound to their initiating Reader and authorization attempt. Preserve focus, existing verse actions, and a recoverable draft across OAuth failures and navigation.

Ref: YPE-6783
Keep OAuth recovery bound to the initiating draft and restore focus around the Notes composer. Refresh highlights for the passage on screen and preserve existing host sign-in behavior.

Ref: YPE-6783
@abharms
abharms force-pushed the codex/YPE-6783-reader-save-notes branch from 18244d4 to 24e6dd4 Compare November 27, 2026 16:23
Keep host-controlled toolbar scopes, restore legacy startup token rotation, and retain the captured draft through a verified failed callback. Verify the workflow with isolated browser fixtures and native Safari.

Ref: YPE-6783
Keep verified legacy auth tokens available, discard drafts for ended sessions, restore selection during host takeover, and gate highlight writes to the rendered passage.

Ref: YPE-6783
Retain clean-canceled drafts across navigation, allow matching-chapter highlight intents, and keep verified auth state bound to its active account and handoff.

Ref: YPE-6783
@abharms

abharms commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

@greptileai review

@abharms

abharms commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T23:08:13.599021Z 047ece5 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f0a017475

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Resume Notes on the verified configured callback, supersede an older pending highlight action, and keep account-bound requests and drafts tied to the right session. Preserve standalone swatch outlines under host styling.

Ref: YPE-6783
Retry the original create payload, then reconcile the current draft against the recovered note ID using the verified writer token. Keep that ID and draft after a failed update.

Ref: YPE-6783
@abharms
abharms marked this pull request as draft November 28, 2026 02:30
@abharms

abharms commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator Author

@greptileai review

@abharms

abharms commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: c479eed68a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Base automatically changed from feat/after-thanksgiving-merge to main November 30, 2026 19:29
Preserve Reader Notes behavior while incorporating main's token, note-ID, and clipboard fixes. Locale catalogs now match main, so remove the obsolete PR507 import declaration. Update the Spanish Notes journey to use its newly translated catalog labels.
Keep QA evidence in Jira, the PR, and BrowserStack. Restore the main localization ownership policy and remove superseded sync changesets now that PR507 is merged. SDK implementation and locale catalogs are unchanged.
@abharms

abharms commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

@greptileai review

@abharms

abharms commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 2963e39ca4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@abharms
abharms marked this pull request as ready for review November 30, 2026 23:02
@abharms
abharms requested review from bmanquen and camrun91 November 30, 2026 23:09

@bmanquen bmanquen 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.

1 blocking issue inline.

if (!savedNote) {
const request: CreateNote = {
request_id: requestId,
content: submitted.text,

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.

issue (blocking): Save is on by default, but its default input fails on the live API

content: submitted.text sends '' whenever the user taps Save without typing, and production currently returns HTTP 400 for that. Save is in DEFAULT_ACTION_ITEMS, so every Reader that upgrades gets a Save button whose simplest use fails with a generic error. Because core/hooks/ui are a fixed changeset group, merging also means main can't cut any release until the API fix ships.

Either hold the merge until the API fix is deployed and a live passage-only save passes, or require text for now (disable submit when !draft.text.trim() and update the README/changeset wording) and relax it in a follow-up.

const update: UpdateNote = { status: visibility, color };
if (text) update.content = text;
const note = await updateNote(savedNote.id, update, patchToken);
if (note.id !== savedNote.id || !noteMatchesDraft(note, draft)) {

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.

question (non-blocking): does the Notes API echo content, status, and color exactly as sent?

noteMatchesDraft compares the returned note to the draft with ===. If the API trims or normalizes text (e.g. "Amen " → "Amen", or \r\n), the create succeeds, the Reader PATCHes, and this line throws "does not match the draft". The user sees an error for a note that saved, and every retry fails the same way. The smoke script mocks the API, so nothing here shows the live behavior. If the API normalizes, compare normalized values or trust a 2xx update.

This branch has not been deployed

No deployments
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.

4 participants