chore: Include buffers (30MB) for SNS and SQS message payloads#408
chore: Include buffers (30MB) for SNS and SQS message payloads#408
Conversation
📝 WalkthroughWalkthroughReplaced single fixed message-size constants with separate HARD_LIMIT and ATTRIBUTE_BUFFER constants and recalculated MESSAGE_MAX_SIZE for both SNS and SQS; updated inline docs to clarify that body size is measured and a reserved buffer accounts for attributes/overhead. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/sns/lib/sns/AbstractSnsService.ts`:
- Line 13: Update the comment on SNS_MESSAGE_MAX_SIZE to clearly state why the
220KB application limit was chosen (e.g., "conservative safety margin to reserve
~36KB for future message attributes and overhead" or "based on anticipated
average attribute payloads of X bytes") and make a matching note in the
message-size computation comment in snsUtils (the function that currently
computes size from the message body only) so it explicitly documents the
assumption and future work to include attributes; also call out that
SNS_MESSAGE_MAX_SIZE is re-exported from the public API and advise adding a
changelog note so downstream consumers expecting 256KB are informed.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/sqs/lib/sqs/AbstractSqsService.ts (1)
12-14: LGTM — minor optional nit on unit notation in comments.AWS increased the SQS maximum message payload from 256 KiB to 1 MiB, so
SQS_MESSAGE_HARD_LIMIT = 1024 * 1024is correct. The decomposition intoHARD_LIMITandATTRIBUTE_BUFFERcleanly mirrors the SNS approach described in the PR.One optional nit:
30 * 1024and the derivedSQS_MESSAGE_MAX_SIZEare binary multiples (KiB), but the inline comments use "KB" (decimal). Consider aligning with "KiB" to match the established "1 MiB" annotation on line 12 and avoid ambiguity.✏️ Optional comment nit
-export const SQS_MESSAGE_ATTRIBUTE_BUFFER = 30 * 1024 // 30KB - reserved space for message attributes and overhead -export const SQS_MESSAGE_MAX_SIZE = SQS_MESSAGE_HARD_LIMIT - SQS_MESSAGE_ATTRIBUTE_BUFFER // 994KB - maximum allowed message body size +export const SQS_MESSAGE_ATTRIBUTE_BUFFER = 30 * 1024 // 30 KiB - reserved space for message attributes and overhead +export const SQS_MESSAGE_MAX_SIZE = SQS_MESSAGE_HARD_LIMIT - SQS_MESSAGE_ATTRIBUTE_BUFFER // 994 KiB - maximum allowed message body size🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/sqs/lib/sqs/AbstractSqsService.ts` around lines 12 - 14, Update the unit notation in the inline comments to use binary units (KiB) to match the existing "1 MiB" notation: change the comment on SQS_MESSAGE_ATTRIBUTE_BUFFER (currently "30KB") to "30 KiB" and the comment on SQS_MESSAGE_MAX_SIZE (currently "994KB") to "994 KiB", leaving the numeric constants and variable names SQS_MESSAGE_HARD_LIMIT, SQS_MESSAGE_ATTRIBUTE_BUFFER, and SQS_MESSAGE_MAX_SIZE unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/sqs/lib/sqs/AbstractSqsService.ts`:
- Around line 12-14: Update the unit notation in the inline comments to use
binary units (KiB) to match the existing "1 MiB" notation: change the comment on
SQS_MESSAGE_ATTRIBUTE_BUFFER (currently "30KB") to "30 KiB" and the comment on
SQS_MESSAGE_MAX_SIZE (currently "994KB") to "994 KiB", leaving the numeric
constants and variable names SQS_MESSAGE_HARD_LIMIT,
SQS_MESSAGE_ATTRIBUTE_BUFFER, and SQS_MESSAGE_MAX_SIZE unchanged.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
packages/sns/lib/sns/AbstractSnsService.tspackages/sns/lib/utils/snsUtils.tspackages/sqs/lib/sqs/AbstractSqsService.tspackages/sqs/lib/utils/sqsUtils.ts
✅ Files skipped from review due to trivial changes (2)
- packages/sns/lib/utils/snsUtils.ts
- packages/sqs/lib/utils/sqsUtils.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/sns/lib/sns/AbstractSnsService.ts
Summary by CodeRabbit
Bug Fixes
Documentation