feat(tck): Add getTopicInfo method to TCK#2395
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #2395 +/- ##
==========================================
- Coverage 95.04% 95.01% -0.04%
==========================================
Files 163 163
Lines 10461 10465 +4
==========================================
Hits 9943 9943
- Misses 518 522 +4 🚀 New features to boost your workflow:
|
f9a7208 to
7e59016
Compare
|
Hi, this is WorkflowBot.
|
Walkthrough
ChangesTopicInfo refactor and getTopicInfo TCK handler
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: e34349a6-aa3a-46ec-b62f-cf8af31a0bae
📒 Files selected for processing (13)
examples/consensus/topic_info.pysrc/hiero_sdk_python/consensus/topic_info.pysrc/hiero_sdk_python/query/topic_info_query.pytck/handlers/account.pytck/handlers/topic.pytck/param/topic.pytck/response/topic.pytck/util/key_utils.pytests/integration/topic_create_transaction_e2e_test.pytests/integration/topic_info_query_e2e_test.pytests/integration/topic_update_transaction_e2e_test.pytests/unit/topic_info_query_test.pytests/unit/topic_info_test.py
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/hiero_sdk_python/consensus/topic_info.py (1)
69-80: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winAlign the constructor contract with the new SDK wrapper types.
These fields are now stored and parsed as
AccountId/ genericKey, but the public__init__surface still advertisesAccountID/PublicKey. That incorrectly narrows valid topic key shapes and leaves the SDK model out of sync with what_from_proto()returns.Suggested fix
- auto_renew_account: AccountID | None, + auto_renew_account: AccountId | None, ... - fee_schedule_key: PublicKey | None, - fee_exempt_keys: list[PublicKey] | None, + fee_schedule_key: Key | None, + fee_exempt_keys: list[Key] | None,As per path instructions, proto message fields should use the corresponding SDK wrapper class in the SDK surface.
Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: fb542e36-c8a2-45c2-9ccc-99872ebe7e33
📒 Files selected for processing (3)
examples/consensus/topic_info.pysrc/hiero_sdk_python/consensus/topic_info.pytck/handlers/topic.py
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
0a7a85e to
97e741b
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/hiero_sdk_python/consensus/topic_info.py (1)
45-49: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winType-hint mismatch:
auto_renew_account/fee_schedule_keystill typed for the old protobuf/PublicKey types.This diff switches the stored attribute types to SDK types but leaves the constructor parameter type hints stale:
- Line 77:
self.auto_renew_account: AccountId | None = auto_renew_account, but the__init__parameter (line 45) is still typedauto_renew_account: AccountID | None(the raw protobuf type, imported at line 20)._from_protonow passesAccountId._from_proto(...)(SDK type), notAccountID.- Line 79:
self.fee_schedule_key: Key = fee_schedule_keydeclares a requiredKey, but the parameter (line 47) is stillfee_schedule_key: PublicKey | None(optional, wrong type name)._from_protopopulates this viaKey.from_proto_key(...), which can beNone.- Same stale
PublicKeytyping applies tofee_exempt_keys: list[PublicKey] | None(line 48) vs. the actuallist[Key]produced by_from_protoand stored at line 80.These inconsistencies will mislead type checkers/IDE users of this public class.
🩹 Proposed fix
auto_renew_period: Duration | None, - auto_renew_account: AccountID | None, + auto_renew_account: AccountId | None, ledger_id: bytes | None, - fee_schedule_key: PublicKey | None, - fee_exempt_keys: list[PublicKey] | None, + fee_schedule_key: Key | None, + fee_exempt_keys: list[Key] | None, custom_fees: list[CustomFixedFee] | None, ) -> None: ... - self.fee_schedule_key: Key = fee_schedule_key + self.fee_schedule_key: Key | None = fee_schedule_keyAlso update the docstring (
Args:block) and remove the now-unusedAccountID/PublicKeyimports if no longer referenced elsewhere in the signature.As per path instructions for
src/hiero_sdk_python/**/*.py, "Check that each SDK field type correctly represents the proto type" and flag any SDK attribute referencing a mismatched type.Also applies to: 69-84
Source: Path instructions
♻️ Duplicate comments (1)
src/hiero_sdk_python/query/topic_info_query.py (1)
88-94: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winClient-side
topic_idvalidation removed from_make_request().This drops the previous guard that rejected a missing
topic_idbefore sending the query, matching a concern already raised in a prior review round (still unresolved in this revision). ATopicInfoQuerywith notopic_idset will now silently produce aConsensusGetTopicInfoQuerywithouttopicIDand round-trip to the network instead of failing fast locally.This appears intentional to let the TCK's
getTopicInfohandler exercise "missing topicId" as a server-side negative-path scenario (seetck/handlers/topic.py'sif params.topicId is not None: query.set_topic_id(...)), and is covered by a new unit test (test_topic_id_not_set_when_none). However, it also changes behavior for any general SDK caller who constructsTopicInfoQuery()and calls.execute()without ever settingtopic_id— they now pay for a network round trip and get a less specific error instead of an immediate client-sideValueError.Please confirm this is an intentional, permanent contract change (not just an oversight retained from the TCK requirement) since Query path instructions treat identifier validation in
_make_request()as a MUST.As per path instructions, "
_make_request()MUST: Validate all required identifiers (accountId, tokenId, topicId, etc.)".Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: ff1068d5-0578-4f14-b29d-6133291d97bc
📒 Files selected for processing (13)
examples/consensus/topic_info.pysrc/hiero_sdk_python/consensus/topic_info.pysrc/hiero_sdk_python/query/topic_info_query.pytck/handlers/account.pytck/handlers/topic.pytck/param/topic.pytck/response/topic.pytck/util/key_utils.pytests/integration/topic_create_transaction_e2e_test.pytests/integration/topic_info_query_e2e_test.pytests/integration/topic_update_transaction_e2e_test.pytests/unit/topic_info_query_test.pytests/unit/topic_info_test.py
Description:
This PR introduce the
getTopicIdmethod to tck module.Changes Made:
getTopicInfomethod to tck.topic_info_queryto handle None topic_id.Related issue(s):
Fixes #2394
Notes for reviewer:
topic_infoto includetopicIdand replace the proto type to use sdk-types forautoRenewAccount,adminKey,submitKeyChecklist