Skip to content

refactor: Move changeTokenURI's per-page step onto NFTokenPageEntry - #8412

Open
mvadari wants to merge 4 commits into
mvadari/rearch/nftokenpage-removeTokenfrom
mvadari/rearch/nftokenpage-changeTokenURI
Open

mvadari wants to merge 4 commits into
mvadari/rearch/nftokenpage-removeTokenfrom
mvadari/rearch/nftokenpage-changeTokenURI

Conversation

@mvadari

@mvadari mvadari commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

High Level Overview of Change

Adds the writable member NFTokenPageEntry::changeTokenURI(uint256 const& id, std::optional<Slice> const& uri). It finds the token on this page, sets or removes its URI, and updates the page. It returns tecINTERNAL if the page does not hold the token, as before. nft::changeTokenURI(view, owner, id, uri) stays a free function because it locates the page by key search across the owner's page range; it now returns the member's result. The body is in NFTokenPageEntry.cpp.

Context of Change

Part of the Wrapped SLEs migration (design: step 2/3 of #7886). The per-page URI change now lives on the typed, writable page wrapper, so the compiler rejects it on a read-only view. Pure refactor: no amendment, no behavior change; any observable difference is a bug.

Stacked on #8410; review only the last commit.

This PR was fully written by AI (Claude Code) under human direction; the human author reviewed the diff.

API Impact

  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)

Test Plan

Compile-checked (clang++ -fsyntax-only, project flags) NFTokenPageEntry.cpp, NFTokenHelpers.cpp, and every .cpp that includes NFTokenPageEntry.h or NFTokenHelpers.h (14/14). clang-tidy (including the standalone header check) and pre-commit are clean. No new tests. CI runs the full unit test suite.

🤖 Generated with Claude Code

@ripple-ai-reviewer ripple-ai-reviewer Bot 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.

Clean, mechanical refactor that moves the per-page URI update logic from the free function nft::changeTokenURI into a new writable member NFTokenPageEntry::changeTokenURI. The extracted logic is copied verbatim (find NFT by ID, set/remove URI, call update(), return tecINTERNAL/tesSUCCESS), and the free function now just delegates to the member after locating the page. Includes were updated appropriately (Slice.h, TER.h) and the requires Base::kIsWritable constraint matches the existing pattern used by insertToken. No behavioral differences are apparent between the old and new code paths.

@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mvadari
mvadari force-pushed the mvadari/rearch/nftokenpage-changeTokenURI branch from 0572b1b to a2c8698 Compare September 30, 2026 17:40
@mvadari
mvadari added this pull request to stack #8443 September 30, 2026 17:40

@ripple-ai-reviewer ripple-ai-reviewer Bot 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.

Pure mechanical refactor moving the per-page URI-change logic from the free function nft::changeTokenURI into a new writable member NFTokenPageEntry::changeTokenURI. The moved logic (locate NFT via find_if on sfNFTokenID, set/clear sfURI, call update(), return tecINTERNAL/tesSUCCESS) is preserved verbatim, and the free function now just delegates to it after its own !page check. No behavioral differences are apparent; includes and forward declarations added (Slice.h, TER.h, base_uint.h) are consistent with the new signature. No issues found in the changed lines.

@mvadari
mvadari force-pushed the mvadari/rearch/nftokenpage-changeTokenURI branch from a2c8698 to 2b2f337 Compare October 5, 2026 12:50

@ripple-ai-reviewer ripple-ai-reviewer Bot 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.

Clean, mechanical refactor: the per-page URI logic is moved verbatim from the free function changeTokenURI in NFTokenHelpers.cpp onto the new NFTokenPageEntry::changeTokenURI method, with the free function now delegating to it. The find/set/remove/update logic is unchanged, and the method is correctly gated with requires Base::kIsWritable. No behavioral differences are introduced in the diff.

@mvadari
mvadari force-pushed the mvadari/rearch/nftokenpage-changeTokenURI branch from 2b2f337 to 857541f Compare October 5, 2026 13:40

@ripple-ai-reviewer ripple-ai-reviewer Bot 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.

Pure mechanical refactor moving the per-page URI update logic from the free function nft::changeTokenURI into a new writable member NFTokenPageEntry::changeTokenURI. The moved logic (find token by ID, set/remove sfURI, call update(), return tecINTERNAL if not found) is identical to the original free-function body, and the call site is updated to delegate correctly. No behavioral differences, resource leaks, or correctness issues spotted in the changed lines.

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

This PR has conflicts, please resolve them in order for the PR to be reviewed.

1 similar comment
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

This PR has conflicts, please resolve them in order for the PR to be reviewed.

@mvadari
mvadari force-pushed the mvadari/rearch/nftokenpage-changeTokenURI branch from 857541f to aa1b73c Compare October 5, 2026 14:47
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

All conflicts have been resolved. Assigned reviewers can now start or resume their review.

@ripple-ai-reviewer ripple-ai-reviewer Bot 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.

Clean, mechanical refactor that moves the per-page URI-change logic from the free function into NFTokenPageEntry::changeTokenURI, with the free function now delegating to it. The new member mirrors the previous logic exactly (find token, set/remove URI, update, return tec/tes), and no behavioral change is apparent.

@github-actions

Copy link
Copy Markdown

This PR has conflicts, please resolve them in order for the PR to be reviewed.

nft::changeTokenURI() locates the page for the token, then finds the
token in the page, sets or removes its URI, and updates the page. The
second part only needs the page, so it becomes the writable member
NFTokenPageEntry::changeTokenURI(id, uri). The free function keeps
the page lookup and returns the member's result.

No behavior change.
@mvadari
mvadari force-pushed the mvadari/rearch/nftokenpage-changeTokenURI branch from aa1b73c to c9263e4 Compare November 10, 2026 02:57
@github-actions

Copy link
Copy Markdown

All conflicts have been resolved. Assigned reviewers can now start or resume their review.

@ripple-ai-reviewer ripple-ai-reviewer Bot 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.

No issues found.

…arch/nftokenpage-changeTokenURI

# Conflicts:
#	src/libxrpl/ledger/helpers/NFTokenHelpers.cpp

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.

1 participant