Skip to content

refactor: simplify delete_token_nft_allowance_all_serials entry handling#2294

Merged
manishdait merged 4 commits into
mainfrom
refactor/nft-allowance-delete
May 19, 2026
Merged

refactor: simplify delete_token_nft_allowance_all_serials entry handling#2294
manishdait merged 4 commits into
mainfrom
refactor/nft-allowance-delete

Conversation

@Dosik13

@Dosik13 Dosik13 commented May 18, 2026

Copy link
Copy Markdown
Contributor

Description:

Simplify AccountAllowanceApproveTransaction.delete_token_nft_allowance_all_serials so that each call produces its own TokenNftAllowance entry. Repeated or chained calls on the same (token, spender) pair are no longer folded into a single entry

  • Update delete_token_nft_allowance_all_serials to append a new TokenNftAllowance entry per call instead of folding into an existing entry
  • Add unit test covering approve_token_nft_allowance followed by delete_token_nft_allowance_all_serials on the same (token, spender) pair
  • Add unit test covering repeated delete_token_nft_allowance_all_serials calls on the same (token, spender) pair
  • Add e2e test covering approve_token_nft_allowance followed by delete_token_nft_allowance_all_serials on the same (token, spender) pair

Related issue(s):

Fixes #

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Dosik13 added 2 commits May 18, 2026 18:06
Signed-off-by: dosi <dosi.kolev@limechain.tech>
Signed-off-by: dosi <dosi.kolev@limechain.tech>
@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2294      +/-   ##
==========================================
+ Coverage   93.97%   94.01%   +0.03%     
==========================================
  Files         163      163              
  Lines       10408    10403       -5     
==========================================
- Hits         9781     9780       -1     
+ Misses        627      623       -4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dosik13
Dosik13 marked this pull request as ready for review May 19, 2026 06:48
@Dosik13
Dosik13 requested review from a team as code owners May 19, 2026 06:48
@Dosik13
Dosik13 requested a review from parvninama May 19, 2026 06:48
@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Rate limit exceeded

@Dosik13 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 44 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0f0c52fa-7fce-4471-ab24-1c3e8995d360

📥 Commits

Reviewing files that changed from the base of the PR and between 09e5dad and 98872be.

📒 Files selected for processing (2)
  • tests/integration/account_allowance_e2e_test.py
  • tests/unit/account_allowance_approve_transaction_test.py

Walkthrough

This PR modifies the delete_token_nft_allowance_all_serials method to append new allowance entries instead of updating existing ones. It removes the merge logic, adds unit tests validating the append behavior, and includes an integration test for the combined scenario of approving a specific serial and deleting all-serials in one transaction.

Changes

NFT Allowance Delete-All-Serials Append Behavior

Layer / File(s) Summary
Remove delete-all-serials merge logic
src/hiero_sdk_python/account/account_allowance_approve_transaction.py
The conditional branch that updated an existing nft_allowances entry for the same token_id + spender_account_id pair has been removed from _approve_token_nft_allowance_all_serials, eliminating the merge/update behavior.
Unit tests for delete-all-serials append behavior
tests/unit/account_allowance_approve_transaction_test.py
Two new tests verify that delete_token_nft_allowance_all_serials appends rather than merges: one confirms prior per-serial approvals are preserved as separate entries, and another confirms repeated delete-all-serials calls each create a distinct allowance entry.
Integration test for combined serial approval and delete-all scenario
tests/integration/account_allowance_e2e_test.py
New integration test exercises approving allowance for a specific NFT serial while deleting all-serials for the same token/owner/spender pair in a single transaction, verifying the approved NFT transfers succeed and others fail with SPENDER_DOES_NOT_HAVE_ALLOWANCE. Import and function signature formatting updated for consistency.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: simplifying the delete_token_nft_allowance_all_serials method's entry handling logic.
Description check ✅ Passed The description is directly related to the changeset, providing context about the behavioral change and listing all modifications made across implementation and tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/nft-allowance-delete

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7edca58d-7060-48d8-be10-931fb8c85687

📥 Commits

Reviewing files that changed from the base of the PR and between 2977e47 and 09e5dad.

📒 Files selected for processing (3)
  • src/hiero_sdk_python/account/account_allowance_approve_transaction.py
  • tests/integration/account_allowance_e2e_test.py
  • tests/unit/account_allowance_approve_transaction_test.py
💤 Files with no reviewable changes (1)
  • src/hiero_sdk_python/account/account_allowance_approve_transaction.py

Comment thread tests/integration/account_allowance_e2e_test.py
Comment thread tests/unit/account_allowance_approve_transaction_test.py Outdated
Signed-off-by: dosi <dosi.kolev@limechain.tech>
@github-actions github-actions Bot added open to community review PR is open for community review and feedback queue:junior-committer PR awaiting initial quality review labels May 19, 2026
@Dosik13 Dosik13 added the priority: high High priority, needed soon label May 19, 2026
@Dosik13 Dosik13 moved this from 📋 Backlog to 👀 In Review in Hiero SDK Sprint Board May 19, 2026
@manishdait
manishdait merged commit bc1e285 into main May 19, 2026
31 checks passed
@manishdait
manishdait deleted the refactor/nft-allowance-delete branch May 19, 2026 13:20
@github-project-automation github-project-automation Bot moved this from 👀 In Review to ✅ Done in Hiero SDK Sprint Board May 19, 2026
@manishdait manishdait added this to the v0.2.7 milestone May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open to community review PR is open for community review and feedback priority: high High priority, needed soon queue:junior-committer PR awaiting initial quality review

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants