You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Aias00 (via GitHub)" <gi...@apache.org> on 2026/09/15 14:02:52 UTC
[PR] [ISSUE #4143][ISSUE #4147] feat(ai): align message query paging contracts [rocketmq-dashboard]
Aias00 opened a new pull request, #4345:
URL: https://github.com/apache/rocketmq-dashboard/pull/4345
## Summary
Reimplements #4148 as a separate PR from the latest `rocketmq-studio` baseline, following the maintainer review without rewriting the original PR history.
- add nested `page: {page, pageSize}` using the existing typed `PageRequest` contract to both `rmq.message.query` and `rmq.message.query_by_topic`; default to 1/20 and cap tool requests at 100 in the catalog schema
- reuse `MessageService.queryMessagesPage(...)` for message-ID, business-key, and Topic queries; preserve the direct unique-key lookup and wrap its 0..1 result in the same paging contract
- serialize the established common `PageOutput` fields as `{page, pageSize, total, items}`, with `resultMayBeTruncated` as message-specific metadata
- add `includeBody` to both query tools, default false; omit `body`, `bodyEncoding`, and `bodyTruncated` unless explicitly requested
- preserve identifier priority `msgId`, then `uniqueKey`, then `key`
- add optional `traceTopicName`; non-blank values use the existing four-argument trace service while blank/absent values keep the legacy three-argument path
- keep the existing tool count, L1 permissions, REST/service APIs, and provider implementations unchanged
## Verification
- TDD red: the rewritten contract tests initially failed because `MessageQueryOutput`, nested paging, and `traceTopicName` did not exist
- focused handler/catalog/output contract tests: 25 passed
- MessageService, REST controller, MCP registration/discovery/invocation, message handlers, catalog, and output-schema tests: 73 passed
- full server suite with `-Dspring.profiles.active=dev`: 260 test classes, 2361 tests, 0 failures/errors/skips
- `mvn -B -ntp -DskipTests package`: passed, Checkstyle 0 violations
- `git diff --check`: passed
- independent read-only review: no findings
Supersedes #4148
Closes #4143
Closes #4147
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE #4143][ISSUE #4147] feat(ai): align message query paging contracts [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #4345: [ISSUE #4143][ISSUE #4147] feat(ai): align message query paging contracts
URL: https://github.com/apache/rocketmq-dashboard/pull/4345
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE #4143][ISSUE #4147] feat(ai): align message query paging contracts [rocketmq-dashboard]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on PR #4345:
URL: https://github.com/apache/rocketmq-dashboard/pull/4345#issuecomment-5682157984
## 🤖 Automated Code Review
**PR:** feat(ai): align message query paging contracts
**Verdict: Generally good — with a few suggestions**
This PR cleanly refactors the AI tool message query contracts to use proper pagination (`PageRequest`/`PageOutput`) instead of returning unbounded lists. The changes are well-scoped and consistent.
### ✅ Strengths
- Clean use of Java records with backward-compatible convenience constructors
- Proper pagination capping (max 100) enforced in the catalog schema
- `includeBody` opt-in is a good default — avoids unnecessary payload bloat in AI tool responses
- `MessageQueryOutput.fromUniqueKey()` handles in-memory paging correctly with proper bounds checking
- Test coverage is updated alongside the contract changes
- YAML catalog schema properly constrains `page` with `additionalProperties: false`
### ⚠️ Suggestions
1. **`MessageQueryOutput.fromUniqueKey()` — potential off-by-one with large offsets**
- File: `MessageQueryOutput.java`
- `long offset = (long) (page - 1) * pageSize;` — casting to `int` via `Math.min(offset, messages.size())` is safe only because `messages.size()` is bounded by int. Consider adding a comment explaining this assumption.
2. **`MessageQueryToolHandler` — default page allocation in execute()**
- File: `MessageQueryToolHandler.java:52`
- `PageRequest page = input.page() != null ? input.page() : new PageRequest(1, 20);` — This creates a new object on every call when page is null. Minor, but consider using a static constant for the default.
3. **`MessageTraceToolHandler` — verify trace queries also respect paging**
- The trace input now accepts a `page` field. Ensure the downstream `MessageService.queryMessageTraceByKey()` actually supports pagination, or document that it returns all results regardless.
### Summary
Solid refactoring that improves the AI tool contract consistency. The suggestions above are minor. LGTM with the above considerations.
---
<sub>🔍 Automated review by RockteMQ-AI. Please verify suggestions before applying.</sub>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org