Skip to content

fix: restore hashability of status enums that define custom __eq__#2470

Merged
manishdait merged 1 commit into
hiero-ledger:mainfrom
exploreriii:fix/status-enum-hashability
Jul 22, 2026
Merged

fix: restore hashability of status enums that define custom __eq__#2470
manishdait merged 1 commit into
hiero-ledger:mainfrom
exploreriii:fix/status-enum-hashability

Conversation

@exploreriii

Copy link
Copy Markdown
Contributor

Fixes #2469

Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
@github-actions github-actions Bot added pending-review skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues labels Jul 22, 2026
@exploreriii
exploreriii marked this pull request as ready for review July 22, 2026 18:34
@exploreriii
exploreriii requested a review from a team as a code owner July 22, 2026 18:34
Copilot AI review requested due to automatic review settings July 22, 2026 18:34
@exploreriii
exploreriii requested a review from a team as a code owner July 22, 2026 18:34

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: fe4e7544-397c-4dc3-9559-146f425bce2d

📥 Commits

Reviewing files that changed from the base of the PR and between 4a1f8df and fc702ca.

📒 Files selected for processing (6)
  • src/hiero_sdk_python/system/freeze_type.py
  • src/hiero_sdk_python/tokens/token_freeze_status.py
  • src/hiero_sdk_python/tokens/token_key_validation.py
  • src/hiero_sdk_python/tokens/token_kyc_status.py
  • src/hiero_sdk_python/tokens/token_pause_status.py
  • tests/unit/status_enum_hashability_test.py

Walkthrough

Five status enums now hash using their underlying values. New parameterized unit tests verify that enum members work in sets and dictionaries and remain hash-consistent with their integer values.

Changes

Status enum hashability

Layer / File(s) Summary
Value-based enum hashing
src/hiero_sdk_python/system/freeze_type.py, src/hiero_sdk_python/tokens/token_freeze_status.py, src/hiero_sdk_python/tokens/token_key_validation.py, src/hiero_sdk_python/tokens/token_kyc_status.py, src/hiero_sdk_python/tokens/token_pause_status.py
Adds __hash__ implementations that return hashes of each enum member’s underlying value.
Hashability validation
tests/unit/status_enum_hashability_test.py
Adds parameterized tests covering set membership, dictionary keys, and hash consistency with integer equality.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: restoring hashability for enums with custom equality.
Description check ✅ Passed The description is related to the change set and references the fixed issue.
Linked Issues check ✅ Passed All affected enums listed in issue #2469 now implement hash, and tests verify hashability and int-consistent equality.
Out of Scope Changes check ✅ Passed The added tests and hash methods are directly in scope for restoring enum hashability.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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.

@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 22, 2026

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

lgtm

@manishdait
manishdait merged commit 3b976da into hiero-ledger:main Jul 22, 2026
31 of 37 checks passed
@github-actions

Copy link
Copy Markdown

👋 Hi @exploreriii! Great work completing a Beginner issue! 🎉

Thanks for your contribution! 🚀

Here are some issues you might want to explore next:

🌟 Stay connected:

Happy coding! 🚀
— Hiero Python SDK Team

@MonaaEid MonaaEid added this to the v0.2.9 milestone Jul 22, 2026
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2470      +/-   ##
==========================================
+ Coverage   95.03%   95.07%   +0.04%     
==========================================
  Files         164      164              
  Lines       10464    10474      +10     
==========================================
+ Hits         9944     9958      +14     
+ Misses        520      516       -4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 pending-review queue:committers PR awaiting committer technical review skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TokenFreezeStatus and other status enums are unhashable — TypeError when used in dicts

5 participants