Skip to content

[TAS-6926] 🐛 Stop opening books with transferred token IDs - #1704

Merged
nwingt merged 4 commits into
likecoin:developfrom
nwingt:tas-6926
Nov 5, 2026
Merged

nwingt merged 4 commits into
likecoin:developfrom
nwingt:tas-6926

Conversation

@nwingt

@nwingt nwingt commented Nov 4, 2026

Copy link
Copy Markdown
Member

No description provided.

@nwingt
nwingt requested a balanced review from Copilot November 4, 2026 16:33
@notion-workspace

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟡 Changes recommended

Outstanding critical and moderate issues remain, including an async race where replaceStaleTokenId() can repopulate token state after reset() and an unguarded recovery path in startReaderLoad() that can leave loading state stuck if recoverLoadError throws.

2 open issues
What changed in this PR

This pull request fixes reader load failures when a user attempts to open a book using an NFT token_id they no longer own (e.g., after transferring a copy) by adding a recovery path that swaps to another owned token ID and retries the load.

Changes:

  • Add a recover-and-retry hook to the reader load flow to handle 403 NOT_NFT_OWNER before showing the error modal.
  • Track and rebuild per-class token ID lists in the bookshelf store and add stale token replacement logic (with contract fallback).
  • Wire recovery into both EPUB and PDF readers, with unit tests covering the new behavior.
File Summary
test/​unit/​use-reader-file-load.test.ts Adds unit tests validating the new recover-and-retry behavior in the reader load composable.
test/​unit/​bookshelf-token-ids.test.ts Adds unit tests for token ID list refresh/merge behavior and stale token replacement logic.
app/​stores/​bookshelf.ts Rebuilds token ID lists on refresh and introduces replaceStaleTokenId() to drop stale IDs and find a valid replacement (including contract lookup).
app/​pages/​reader/​pdf.vue Wires PDF reader loading to attempt recovery (swap token ID) before surfacing errors.
app/​pages/​reader/​epub.vue Wires EPUB reader loading to attempt recovery (swap token ID) before surfacing errors.
app/​composables/​use-reader.ts Implements replaceStaleNFTId() to swap the route’s nft_id to another owned copy on NOT_NFT_OWNER.
app/​composables/​use-reader-file-load.ts Adds recoverLoadError support to attempt recovery+retry before displaying the error modal.

This pull request requires changes.

Review effort: Balanced

Comment thread app/stores/bookshelf.ts Resolved
Comment thread app/composables/use-reader-file-load.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟢 Approval recommended

The change is narrowly scoped around a one-time recovery-and-retry path, is consistently wired through both EPUB and PDF reader flows, and is backed by unit tests covering the retry and token-id update behaviors.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@nwingt
nwingt merged commit c0aa0be into likecoin:develop Nov 5, 2026
1 check passed
@nwingt
nwingt deleted the tas-6926 branch November 5, 2026 02:27
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