Skip to content

test: codrabbit prompt#211

Closed
exploreriii wants to merge 7 commits into
mainfrom
codrabbit-prompt
Closed

test: codrabbit prompt#211
exploreriii wants to merge 7 commits into
mainfrom
codrabbit-prompt

Conversation

@exploreriii

Copy link
Copy Markdown
Owner

Description:

Related issue(s):

Fixes #1

Notes for reviewer:

Checklist

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

Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Repository owner deleted a comment from github-actions Bot Feb 8, 2026
@exploreriii

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Feb 8, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Repository owner deleted a comment from github-actions Bot Feb 8, 2026
@coderabbitai

coderabbitai Bot commented Feb 8, 2026

Copy link
Copy Markdown

Walkthrough

Refactors AccountInfo by replacing legacy staking fields with a composite staking_info field; updates protobuf review guidance in .coderabbit.yaml to treat generated _pb2 modules as the authoritative contract with mandatory verification steps and defect definitions; updates tests and minor query init removal.

Changes

Cohort / File(s) Summary
Configuration & Review Guidance
.coderabbit.yaml
Replaces prior proto source-of-truth wording: declares generated protobuf Python modules (*_pb2.py, *_pb2.pyi, *_pb2_grpc.py) as the authoritative wire-format contract; adds a mandatory proto verification procedure, explicit defect definitions, and mirrored global review guidance.
AccountInfo Refactor
src/hiero_sdk_python/account/account_info.py
Removes staked_account_id, staked_node_id, decline_staking_reward; adds staking_info: Optional[StakingInfo]; updates import path for StakingInfo; adjusts _from_proto/_to_proto, __str__/__repr__ to use staking_info.
Tests — AccountInfo
tests/unit/account_info_test.py
Updates fixtures and assertions to expect staking_info and max_automatic_token_associations; adds round-trip proto conversion checks for the new fields.
Tests — TopicInfo
tests/unit/topic_info_test.py
Adjusts expected expiration_time formatting in string/repr assertions from timestamp-with-time to date-only (YYYY-MM-DD).
Query init removal
src/hiero_sdk_python/query/account_info_query.py
Removes initialization of public account_id in __init__; callers must set account_id via set_account_id before use (possible AttributeError if not set).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 4
❌ Failed checks (1 warning, 3 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is a blank template with no concrete information about what was changed, why it was changed, or how it addresses the linked issue. Provide a meaningful description outlining the key changes, their rationale, and how they relate to the objectives of issue #1.
Title check ❓ Inconclusive The title 'test: codrabbit prompt' is vague and does not meaningfully describe the substantial changes in the PR, which involve refactoring staking fields, updating protobuf guidance, and modifying tests. Use a clear, descriptive title that reflects the main changes, such as 'refactor: migrate staking fields to StakingInfo composite object' or similar.
Linked Issues check ❓ Inconclusive The linked issue #1 contains only 'test' as its description with no specific coding requirements or objectives to validate against the code changes. Clarify the requirements in issue #1 or provide additional context explaining how the code changes fulfill the linked issue's objectives.
Out of Scope Changes check ❓ Inconclusive The PR contains substantial changes beyond protobuf guidance updates: staking field refactoring in AccountInfo, test modifications, and removal of account_id initialization in AccountInfoQuery. Clarify whether all changes (staking refactoring, test updates, AccountInfoQuery modification) are in scope for issue #1, or if some are separate concerns.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codrabbit-prompt

No actionable comments were generated in the recent review. 🎉


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Comment on lines +194 to 195
f"staked_info={self.staking_info!r}, "
f")"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use staking_info label in repr for consistency.
The debug string currently says staked_info, which doesn’t match the field name.

✅ Proposed fix
-            f"staked_info={self.staking_info!r}, "
+            f"staking_info={self.staking_info!r}, "
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
f"staked_info={self.staking_info!r}, "
f")"
f"staking_info={self.staking_info!r}, "
f")"

Comment on lines +76 to 99
def test_from_proto_with_staking_info():
"""Test the from_proto method of the AccountInfo class with staking info"""
public_key = PrivateKey.generate_ed25519().public_key()

staking_info={
"decline_reward": True,
"staked_node_id": 3,
"staked_account_id": None
}

proto = CryptoGetInfoResponse.AccountInfo(
accountID=AccountId(0, 0, 100)._to_proto(),
key=public_key._to_proto(),
balance=5000000,


)

account_info = AccountInfo._from_proto(proto)

assert account_info.staking_info is not None
assert account_info.staking_info.decline_reward is True
assert account_info.staking_info.staked_node_id == 3

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's locate and examine the test file
find . -name "account_info_test.py" -type f

Repository: exploreriii/hiero_sdk_python

Length of output: 105


🏁 Script executed:

# List the test/unit directory structure
ls -la tests/unit/ | head -20

Repository: exploreriii/hiero_sdk_python

Length of output: 1513


🏁 Script executed:

# Search for StakingInfo class definition
rg "class StakingInfo" --type py

Repository: exploreriii/hiero_sdk_python

Length of output: 127


🏁 Script executed:

# Search for the AccountInfo class and its _from_proto method
rg "def _from_proto" -A 15 --type py | grep -A 15 "AccountInfo"

Repository: exploreriii/hiero_sdk_python

Length of output: 2336


🏁 Script executed:

# Read the test file to verify the test at lines 76-99
cat -n tests/unit/account_info_test.py | sed -n '70,105p'

Repository: exploreriii/hiero_sdk_python

Length of output: 1561


🏁 Script executed:

# Read the full AccountInfo._from_proto implementation
cat -n src/hiero_sdk_python/account/account_info.py | grep -A 50 "def _from_proto"

Repository: exploreriii/hiero_sdk_python

Length of output: 2713


🏁 Script executed:

# Check the StakingInfo class definition and _to_proto method
cat -n src/hiero_sdk_python/staking_info.py

Repository: exploreriii/hiero_sdk_python

Length of output: 6189


Populate proto.staking_info so the test actually exercises _from_proto's staking_info deserialization.

The staking_info dict is unused; _from_proto checks proto.HasField("staking_info") which will be False, causing account_info.staking_info to be None and failing the assertions.

Fix
-    staking_info={
-            "decline_reward": True,
-            "staked_node_id": 3,
-            "staked_account_id": None 
-        }
+    staking_info = StakingInfo(
+        decline_reward=True,
+        staked_node_id=3,
+        staked_account_id=None,
+    )
 
     proto = CryptoGetInfoResponse.AccountInfo(
         accountID=AccountId(0, 0, 100)._to_proto(),
         key=public_key._to_proto(),
         balance=5000000,
-        
-        
     )
+    proto.staking_info.CopyFrom(staking_info._to_proto())
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def test_from_proto_with_staking_info():
"""Test the from_proto method of the AccountInfo class with staking info"""
public_key = PrivateKey.generate_ed25519().public_key()
staking_info={
"decline_reward": True,
"staked_node_id": 3,
"staked_account_id": None
}
proto = CryptoGetInfoResponse.AccountInfo(
accountID=AccountId(0, 0, 100)._to_proto(),
key=public_key._to_proto(),
balance=5000000,
)
account_info = AccountInfo._from_proto(proto)
assert account_info.staking_info is not None
assert account_info.staking_info.decline_reward is True
assert account_info.staking_info.staked_node_id == 3
def test_from_proto_with_staking_info():
"""Test the from_proto method of the AccountInfo class with staking info"""
public_key = PrivateKey.generate_ed25519().public_key()
staking_info = StakingInfo(
decline_reward=True,
staked_node_id=3,
staked_account_id=None,
)
proto = CryptoGetInfoResponse.AccountInfo(
accountID=AccountId(0, 0, 100)._to_proto(),
key=public_key._to_proto(),
balance=5000000,
)
proto.staking_info.CopyFrom(staking_info._to_proto())
account_info = AccountInfo._from_proto(proto)
assert account_info.staking_info is not None
assert account_info.staking_info.decline_reward is True
assert account_info.staking_info.staked_node_id == 3
🧰 Tools
🪛 GitHub Actions: Code Coverage

[error] 96-96: pytest failure in test_from_proto_with_staking_info: staking_info is None but expected not None. This indicates AccountInfo._from_proto is not populating staking_info when staking info is provided.

🪛 Ruff (0.14.14)

[error] 80-80: Local variable staking_info is assigned to but never used

Remove assignment to unused variable staking_info

(F841)

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