fix(gateway): avoid stale NATS payload limits#203
Conversation
yordis
commented
Jun 4, 2026
- Keep gateway claim-check thresholds tied to NATS server limits instead of stale local assumptions.
- Require startup to observe server INFO before deriving payload policy.
PR SummaryMedium Risk Overview Claim-check publishing takes a Dependency bump: Config cleanup: Reviewed by Cursor Bugbot for commit 2080893. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Warning Review limit reached
More reviews will be available in 37 minutes and 10 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
WalkthroughThis PR removes the ChangesNATS Server Payload Configuration Removal
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Code Coverage SummaryDetailsDiff against mainResults for commit: 2080893 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rsworkspace/crates/trogon-gateway/src/main.rs`:
- Line 85: Replace the generic std::io::Error usage for the missing NATS INFO
with a typed domain error: add a ServeError::MissingNatsServerInfo variant (or
similar) to your ServeError enum/struct and use it instead of
std::io::Error::other when the INFO path is absent (the expression currently
using .ok_or_else(|| std::io::Error::other("NATS server info is
unavailable"))?). Update the call site to return
Err(ServeError::MissingNatsServerInfo) (or map the Option to that variant) and
adjust any function signatures or conversions (e.g., From<ServeError> impls or
Result return types in main/startup functions) so the new ServeError flows
through the startup path.
- Around line 83-86: The code freezes NATS max_payload at startup
(server_max_payload from nats.try_server_info()) and ClaimCheckPublisher uses
that fixed MaxPayload in publish_event, which can become stale after reconnects;
change the implementation so publish_event (or the ClaimCheckPublisher path that
checks MaxPayload) queries the current server info at publish time (call
try_server_info() and read max_payload) or updates its stored MaxPayload on NATS
reconnect events instead of only at startup; update references in
ClaimCheckPublisher and publish_event (and remove reliance on the startup
server_max_payload variable) so the publish-time check uses the live max_payload
from the nats client or a value refreshed on reconnect.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f21aa357-1d1d-4efb-8e8f-f4bdd4e449e6
⛔ Files ignored due to path filters (1)
rsworkspace/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
rsworkspace/Cargo.tomlrsworkspace/crates/trogon-gateway/src/config.rsrsworkspace/crates/trogon-gateway/src/main.rs
💤 Files with no reviewable changes (1)
- rsworkspace/crates/trogon-gateway/src/config.rs
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1944dbd to
2080893
Compare