Skip to content

chore: Refactor TokenDissociateTransaction protobuf body creation#2454

Merged
exploreriii merged 3 commits into
hiero-ledger:mainfrom
manishdait:fix/tck-dissociateToken-failing
Jul 19, 2026
Merged

chore: Refactor TokenDissociateTransaction protobuf body creation#2454
exploreriii merged 3 commits into
hiero-ledger:mainfrom
manishdait:fix/tck-dissociateToken-failing

Conversation

@manishdait

Copy link
Copy Markdown
Contributor

Description:
This PR refactors _build_proto_body() in TokenDissociateTransaction to avoid raising a ValueError when account_id or token_ids are not set. This aligns the behavior of the other SDKs and fixes the TCK test

Changes Made:

  • Avoid throwing ValueError when account_id or token_ids is None
  • Added unit/e2e test to validate changes

Fixes #2453

Notes for reviewer:
Expected behavior (to match with the other SDKs):

  • If account_id is provided and token_ids is skip, the transaction should execute successfully.
  • If account_id is skip, the transaction should fail with a PrecheckError rather than raising ValueError.

Checklist

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

… error

Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
@github-actions github-actions Bot added the approved Issue has been approved by team member label Jul 18, 2026
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2454      +/-   ##
==========================================
+ Coverage   95.00%   95.01%   +0.01%     
==========================================
  Files         164      164              
  Lines       10461    10464       +3     
==========================================
+ Hits         9938     9942       +4     
+ Misses        523      522       -1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@manishdait
manishdait marked this pull request as ready for review July 18, 2026 20:54
@manishdait
manishdait requested review from a team as code owners July 18, 2026 20:54
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Token dissociation protobuf construction now conditionally includes account and token fields, filters null token identifiers, and supports omitted inputs. Unit and integration tests cover field serialization, successful execution, and missing-account precheck failure.

Changes

Token dissociation handling

Layer / File(s) Summary
Conditional protobuf body construction
src/hiero_sdk_python/tokens/token_dissociate_transaction.py, tests/unit/token_dissociate_transaction_test.py
_build_proto_body conditionally populates fields, ignores null token identifiers, and is covered for present, missing, and empty inputs.
Dissociation execution scenarios
tests/integration/token_dissociate_transaction_e2e_test.py
Integration tests use the env fixture to verify standard dissociation, execution without token IDs, and PrecheckError when the account ID is missing.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: refactoring TokenDissociateTransaction protobuf body creation.
Description check ✅ Passed The description is directly related to the code changes and test coverage added in the PR.
Linked Issues check ✅ Passed The changes address #2453 by allowing dissociation with no token IDs and adding coverage for that case.
Out of Scope Changes check ✅ Passed The PR stays focused on TokenDissociateTransaction behavior and related tests, with no clear unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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: e603a48d-a85d-4960-99c5-856acd31bfb9

📥 Commits

Reviewing files that changed from the base of the PR and between 832a5e9 and bbdea50.

📒 Files selected for processing (3)
  • src/hiero_sdk_python/tokens/token_dissociate_transaction.py
  • tests/integration/token_dissociate_transaction_e2e_test.py
  • tests/unit/token_dissociate_transaction_test.py

Comment thread tests/integration/token_dissociate_transaction_e2e_test.py
Comment thread tests/integration/token_dissociate_transaction_e2e_test.py
@github-actions github-actions Bot added open to community review PR is open for community review and feedback queue:committers PR awaiting committer technical review labels Jul 18, 2026
@exploreriii
exploreriii merged commit db74c9e into hiero-ledger:main Jul 19, 2026
33 of 36 checks passed
@manishdait
manishdait deleted the fix/tck-dissociateToken-failing branch July 20, 2026 08:10
@MonaaEid MonaaEid added this to the v0.2.9 milestone Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Issue has been approved by team member open to community review PR is open for community review and feedback queue:committers PR awaiting committer technical review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TCK test failure for dissociateToken method

4 participants