Skip to content

Conversation

@ChaitanyaChute
Copy link
Contributor

@ChaitanyaChute ChaitanyaChute commented Dec 18, 2025

Description:
Replace all usages of ResponseCode.get_name(receipt.status) with the canonical ResponseCode(receipt.status).name .

  • Replace ResponseCode.get_name(receipt.status) in examples
  • Replace ResponseCode.get_name(receipt.status) in integration tests

Fixes #1136

Summary by CodeRabbit

  • Refactor
    • Standardized how status codes are accessed throughout examples and integration tests for improved code consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings December 18, 2025 18:09
@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Walkthrough

This PR standardizes enum naming conventions by replacing all instances of ResponseCode.get_name(receipt.status) with ResponseCode(receipt.status).name across example files and integration tests. The change affects error message formatting only, with no alterations to control flow or functional behavior.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Updated unreleased section to document the replacement of ResponseCode.get_name() calls with .name property access for consistency.
Example Scripts
examples/query/payment_query.py, examples/tokens/token_revoke_kyc_transaction.py, examples/tokens/token_update_transaction_fungible.py, examples/tokens/token_update_transaction_key.py, examples/tokens/token_update_transaction_nft.py
Replaced ResponseCode.get_name(receipt.status) with ResponseCode(receipt.status).name in error message constructions across token and query operations.
Integration Tests
tests/integration/file_update_transaction_e2e_test.py, tests/integration/token_revoke_kyc_transaction_e2e_test.py, tests/integration/token_update_transaction_e2e_test.py
Updated assertion error messages to use ResponseCode(receipt.status).name instead of ResponseCode.get_name(receipt.status) for consistent enum name retrieval.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Rationale: All changes follow an identical, repetitive pattern across 9 files with no logic modifications or control-flow alterations. Review primarily involves verifying consistent application of the replacement across all affected files.

Suggested reviewers

  • exploreriii

Poem

🐰 A rabbit hops through code so bright,
Replacing get_name with .name—what delight!
From querys to tokens, the refactor flows free,
Consistency reigns across all that we see! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.91% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'chore: rename/response code name' is vague and uses non-descriptive phrasing that doesn't clearly convey what the actual change accomplishes, making it difficult to understand the primary objective from the title alone. Consider a more specific title like 'chore: replace ResponseCode.get_name() with ResponseCode().name' to clearly communicate the main change to reviewers.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The pull request successfully replaces all instances of ResponseCode.get_name(receipt.status) with ResponseCode(receipt.status).name across examples and integration tests as required by issue #1136.
Out of Scope Changes check ✅ Passed All changes in the pull request are directly related to replacing ResponseCode.get_name() with ResponseCode().name as specified in the linked issue; no unrelated or out-of-scope changes detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@github-actions
Copy link

Hi, this is WorkflowBot.
Your pull request cannot be merged as it is not passing all our workflow checks.
Please click on each check to review the logs and resolve issues so all checks pass.
To help you:

@exploreriii exploreriii changed the title Rename/response code name chore: rename/response code name Dec 18, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors response code name retrieval to use the canonical Python enum pattern. The change replaces the custom ResponseCode.get_name(receipt.status) method with the standard ResponseCode(receipt.status).name approach across examples and integration tests.

  • Standardizes response code name retrieval using Python's built-in enum .name property
  • Updates error messages in assertions to use the canonical pattern
  • Updates CHANGELOG to document this refactoring change

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/integration/token_update_transaction_e2e_test.py Replaces 35 instances of ResponseCode.get_name() with ResponseCode().name in token update test assertions
tests/integration/token_revoke_kyc_transaction_e2e_test.py Updates 10 instances in token revoke KYC test assertions
tests/integration/file_update_transaction_e2e_test.py Updates 4 instances in file update test assertions
examples/tokens/token_update_transaction_nft.py Updates 2 instances in NFT token update example error messages
examples/tokens/token_update_transaction_key.py Updates 2 instances in token key update example error messages
examples/tokens/token_update_transaction_fungible.py Updates 2 instances in fungible token update example error messages
examples/tokens/token_revoke_kyc_transaction.py Updates 5 instances in token revoke KYC example error messages
examples/query/payment_query.py Updates 1 instance in payment query example error message
CHANGELOG.md Documents the refactoring change in the Changed section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 08ba48a and 59f6fa8.

📒 Files selected for processing (9)
  • CHANGELOG.md (1 hunks)
  • examples/query/payment_query.py (1 hunks)
  • examples/tokens/token_revoke_kyc_transaction.py (4 hunks)
  • examples/tokens/token_update_transaction_fungible.py (2 hunks)
  • examples/tokens/token_update_transaction_key.py (2 hunks)
  • examples/tokens/token_update_transaction_nft.py (2 hunks)
  • tests/integration/file_update_transaction_e2e_test.py (4 hunks)
  • tests/integration/token_revoke_kyc_transaction_e2e_test.py (10 hunks)
  • tests/integration/token_update_transaction_e2e_test.py (30 hunks)
🧰 Additional context used
🧬 Code graph analysis (8)
examples/tokens/token_revoke_kyc_transaction.py (1)
src/hiero_sdk_python/response_code.py (1)
  • ResponseCode (4-387)
examples/tokens/token_update_transaction_key.py (1)
src/hiero_sdk_python/response_code.py (1)
  • ResponseCode (4-387)
examples/query/payment_query.py (1)
src/hiero_sdk_python/response_code.py (1)
  • ResponseCode (4-387)
tests/integration/token_update_transaction_e2e_test.py (1)
src/hiero_sdk_python/response_code.py (1)
  • ResponseCode (4-387)
tests/integration/token_revoke_kyc_transaction_e2e_test.py (1)
src/hiero_sdk_python/response_code.py (1)
  • ResponseCode (4-387)
examples/tokens/token_update_transaction_nft.py (1)
src/hiero_sdk_python/response_code.py (1)
  • ResponseCode (4-387)
tests/integration/file_update_transaction_e2e_test.py (1)
src/hiero_sdk_python/response_code.py (1)
  • ResponseCode (4-387)
examples/tokens/token_update_transaction_fungible.py (1)
src/hiero_sdk_python/response_code.py (1)
  • ResponseCode (4-387)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Title Check
  • GitHub Check: Agent
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: StepSecurity Harden-Runner
🔇 Additional comments (10)
examples/query/payment_query.py (1)

64-64: LGTM! Correctly using the non-deprecated enum name access.

The change from ResponseCode.get_name(receipt.status) to ResponseCode(receipt.status).name correctly adopts the recommended pattern and eliminates the deprecation warning.

CHANGELOG.md (1)

76-77: LGTM! Changelog properly documents the refactoring.

The changelog entry clearly describes the replacement of the deprecated ResponseCode.get_name() method with the recommended ResponseCode(receipt.status).name pattern, and correctly references issue #1136.

tests/integration/file_update_transaction_e2e_test.py (1)

32-32: LGTM! Test assertions correctly updated to use non-deprecated method.

All assertion messages now use ResponseCode(receipt.status).name instead of the deprecated ResponseCode.get_name(receipt.status), maintaining consistency across the test file.

Also applies to: 56-56, 88-88, 124-124

examples/tokens/token_update_transaction_nft.py (1)

73-73: LGTM! Error messages correctly updated.

Both error messages now use the non-deprecated ResponseCode(receipt.status).name pattern for consistent status reporting.

Also applies to: 112-112

examples/tokens/token_update_transaction_key.py (1)

65-65: LGTM! Correctly adopting the recommended enum access pattern.

Both error messages have been updated to use ResponseCode(receipt.status).name, eliminating deprecation warnings.

Also applies to: 109-109

examples/tokens/token_update_transaction_fungible.py (1)

73-73: LGTM! Error messages properly refactored.

Both error messages now use the recommended ResponseCode(receipt.status).name approach instead of the deprecated get_name() method.

Also applies to: 112-112

examples/tokens/token_revoke_kyc_transaction.py (1)

71-71: LGTM! All error messages consistently refactored.

All five error messages throughout the file have been properly updated to use ResponseCode(receipt.status).name, eliminating deprecation warnings and maintaining consistency with the rest of the codebase.

Also applies to: 95-95, 121-121, 145-145, 192-192

tests/integration/token_revoke_kyc_transaction_e2e_test.py (3)

27-60: LGTM! Correctly migrated to canonical enum name access.

All assertion messages in this test function have been properly updated to use ResponseCode(receipt.status).name instead of the deprecated ResponseCode.get_name() method. The changes align with the deprecation warning and follow Python enum best practices.


79-112: LGTM! Consistent migration pattern applied.

All assertion messages correctly use the canonical ResponseCode(receipt.status).name syntax. The changes are consistent with the first test function.


131-144: LGTM! Migration complete for this test file.

The final assertion messages have been correctly updated to use the canonical enum name access pattern. All instances of the deprecated ResponseCode.get_name() method have been successfully replaced in this file.

@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1151   +/-   ##
=======================================
  Coverage   91.11%   91.11%           
=======================================
  Files         139      139           
  Lines        8451     8451           
=======================================
  Hits         7700     7700           
  Misses        751      751           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@exploreriii exploreriii merged commit e172165 into hiero-ledger:main Dec 18, 2025
28 of 30 checks passed
prajeeta15 pushed a commit to prajeeta15/hiero-sdk-python that referenced this pull request Dec 23, 2025
Signed-off-by: Chaitanya-chute <[email protected]>
Signed-off-by: prajeeta pal <[email protected]>
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.

Replace ResponseCode.get_name(receipt.status)

2 participants