Skip to content

Commit dd3030f

Browse files
authored
chore: Added prompt for coderabbit to review Query classes (hiero-ledger#1411)
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
1 parent 9745999 commit dd3030f

File tree

2 files changed

+128
-1
lines changed

2 files changed

+128
-1
lines changed

.coderabbit.yaml

Lines changed: 127 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,126 @@ reviews:
1919
poem: false # Do not write a literal poem (spammy)
2020
enable_prompt_for_ai_agents: false # Disable prompts for AI agents (spammy)
2121

22+
# QUERY REVIEW INSTRUCTIONS
23+
query_review_instructions: &query_review_instructions |
24+
You are acting as a senior maintainer reviewing the Query base class
25+
and its subclasses for the hiero-sdk-python project.
26+
27+
NOTE:
28+
- Review focus levels indicate areas that are important to check carefully.
29+
- They do NOT imply severity or urgency.
30+
- Only recommend fixes when there is a clear behavioral regression.
31+
32+
Scope is STRICTLY LIMITED to:
33+
- Changes to the base `Query` class
34+
- Changes to existing `Query` subclasses
35+
- Newly added `Query` subclasses
36+
37+
----------------------------------------------------------
38+
REVIEW FOCUS 1 — QUERY SEMANTICS & PAYMENT BEHAVIOR
39+
(CONTRACTUAL / HIGH SENSITIVITY)
40+
----------------------------------------------------------
41+
Queries do not reach consensus and use `QueryHeader` for payment and responseType.
42+
43+
The following behaviors are contractual and must remain unchanged:
44+
- `_is_payment_required()` semantics
45+
- FREE vs PAID query classification
46+
- COST_ANSWER vs ANSWER_ONLY behavior
47+
- Whether a payment transaction is attached
48+
49+
Good to check and verify that changes do NOT:
50+
- Alter FREE → PAID or PAID → FREE behavior
51+
- Attach payment to COST_ANSWER queries
52+
- Bypass `get_cost(client)` for paid queries
53+
- Hardcode fees or override payment logic
54+
55+
----------------------------------------------------------
56+
REVIEW FOCUS 2 — EXECUTION LIFECYCLE & BASE CLASS INTEGRITY
57+
----------------------------------------------------------
58+
All queries MUST:
59+
- Use the base `Query` execution flow
60+
- Delegate retries, backoff, and node selection to `_Executable`
61+
- Call `_before_execute(client)` before `_execute(client)`
62+
63+
Subclasses MUST NOT:
64+
- Override retry logic
65+
- Implement custom node selection
66+
- Manage gRPC deadlines manually
67+
- Bypass `_Executable` state handling
68+
69+
Flag deviations for review; recommend fixes only if behavior changes.
70+
71+
----------------------------------------------------------
72+
REVIEW FOCUS 3 — REQUEST CONSTRUCTION CONTRACT
73+
----------------------------------------------------------
74+
`_make_request()` MUST:
75+
- Validate all required identifiers (accountId, tokenId, topicId, etc.)
76+
- Call `_make_request_header()` exactly once
77+
- Populate protobuf fields via `_to_proto()` helpers
78+
- Avoid manual `QueryHeader` mutation
79+
80+
Subclasses MUST NOT:
81+
- Set `responseType` directly
82+
- Inject payment logic
83+
- Rebuild headers manually
84+
85+
----------------------------------------------------------
86+
REVIEW FOCUS 4 — RESPONSE EXTRACTION & DOMAIN MAPPING
87+
----------------------------------------------------------
88+
`_get_query_response()` MUST:
89+
- Return the exact protobuf response field
90+
- Perform NO data transformation
91+
- Match the expected protobuf response type
92+
93+
`execute()` MUST NOT:
94+
- Implement retries or error handling
95+
- Modify payment or execution behavior
96+
- Catch and suppress execution errors
97+
98+
----------------------------------------------------------
99+
REVIEW FOCUS 5 — NEW SUBCLASS VALIDATION
100+
----------------------------------------------------------
101+
For newly added `Query` subclasses:
102+
- Ensure they extend `Query` directly
103+
- Verify required abstract methods are implemented
104+
- Confirm payment semantics match the Hedera API
105+
- Validate protobuf service and method correctness
106+
- Ensure naming matches existing query patterns
107+
108+
Missing or incorrect semantics should be flagged clearly.
109+
110+
----------------------------------------------------------
111+
REVIEW FOCUS 6 — REGRESSION & BEHAVIOR CHANGE DETECTION
112+
----------------------------------------------------------
113+
Good to check whether any change:
114+
- Alters base `Query` behavior
115+
- Changes default responseType handling
116+
- Modifies `_make_request_header()` usage
117+
- Alters `_get_method()` behavior
118+
- Introduces side effects (logging, prints, stack traces)
119+
- Changes error propagation behavior
120+
121+
Small changes should be flagged for verification
122+
if they could affect execution flow or payment safety.
123+
124+
----------------------------------------------------------
125+
REVIEW FOCUS 7 — EXPLICIT NON-GOALS
126+
----------------------------------------------------------
127+
Do NOT:
128+
- Review query consumers
129+
- Propose refactors unless correctness is impacted
130+
- Comment on style, formatting, or naming unless misleading
131+
132+
----------------------------------------------------------
133+
FINAL OBJECTIVE
134+
----------------------------------------------------------
135+
Ensure Query code remains:
136+
- Backward-compatible
137+
- Payment-safe
138+
- Execution-consistent
139+
- Strictly aligned with Hedera query semantics
140+
141+
22142
# ============================================================
23143
# GLOBAL REVIEW INSTRUCTIONS (APPLY TO ALL FILES)
24144
# ============================================================
@@ -32,7 +152,6 @@ reviews:
32152
- Do NOT block the PR on them.
33153
- Do NOT suggest fixes inline.
34154
- Instead, aggregate all out-of-scope issues into a single comment with a list of recommendations for one or more follow-up issues that can be created.
35-
36155
path_instructions:
37156
# --- CUSTOM INSTRUCTIONS FOR EXAMPLES DIRECTORY ---
38157
- path: "examples/**/*"
@@ -423,6 +542,13 @@ reviews:
423542
- Scripts MUST NOT assume write access
424543
- Permission failures MUST be handled gracefully
425544
545+
- path: "src/hiero_sdk_python/query/**/*.py"
546+
instructions: *query_review_instructions
547+
548+
- path: "src/hiero_sdk_python/contract/**/*_query.py"
549+
instructions: *query_review_instructions
550+
551+
426552
chat:
427553
art: false # Don't draw ASCII art (false)
428554
auto_reply: false # Don't allow bot to converse (spammy)

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
9393
- Chained Good First Issue assignment with mentor assignment to bypass GitHub's anti-recursion protection - mentor assignment now occurs immediately after successful user assignment in the same workflow execution. (#1369)
9494
- Add GitHub Actions script and workflow for automatic spam list updates.
9595
- Added technical docstrings and hardening (set -euo pipefail) to the pr-check-test-files.sh script (#1336)
96+
- Added prompt for coderabbit to review `Query` and it's sub-classes.
9697

9798
### Changed
9899
- Renamed `.github/scripts/check_advanced_requirement.sh` to `bot-advanced-check.sh` for workflow consistency (#1341)

0 commit comments

Comments
 (0)