Skip to content

fix(usersrole): give the multipart request ceiling headroom - #261

Merged
jdwillmsen merged 1 commit into
mainfrom
fix/usersrole-multipart-headroom
Oct 23, 2026
Merged

jdwillmsen merged 1 commit into
mainfrom
fix/usersrole-multipart-headroom

Conversation

@jdwillmsen

@jdwillmsen jdwillmsen commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Why

usersrole's max-request-size was the same as max-file-size (2MB). The multipart request also carries part headers and boundaries, so a file just under 2MB, which is within the file limit, got rejected on the request ceiling. This raises spring.servlet.multipart.max-request-size to 4MB. max-file-size stays at 2MB, so 2MB is still the largest icon, and the request now has room for the multipart overhead around it.

Paired with jdwlabs/deployments#321, which raises the NGINX Gateway Fabric body limit on the usersrole route to 4m. Without that, the gateway returns 413 for any upload over 1MB before it reaches this service. That PR also notes that profile-service, which serves /api/profiles in non, needs the same gateway policy.

Cherry-picked from 787f7b178.

Verified

  • commitlint --from origin/main: 0 problems. prettier --check on the changed file: clean.
  • bash gradlew test in apps/backend/usersrole (the target nx test usersrole runs, invoked directly because local @nx/gradle graph creation hung): BUILD SUCCESSFUL, 346 tests, 0 failures, 0 errors, 0 skipped

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Increased the maximum multipart request size to 4 MB; the per-file limit remains 2 MB.

…file

max-request-size matched max-file-size exactly, so a 2MB file — itself within
the limit — was rejected on the part headers and boundaries carried with it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@jdwlabs-review-bot

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Configuration Clarity

The change correctly increases the max-request-size to 4MB to accommodate multipart overhead, which is good. However, the comment explaining the reasoning is helpful but could be more explicit about the actual impact on request handling and potential side effects, such as increased memory usage or timeout considerations when processing larger requests.

# Headroom over max-file-size, not a match for it: the request carries the
# part headers and boundaries on top of the file, so an equal ceiling
# rejects a file that is itself within the limit.
max-request-size: 4MB

@jdwlabs-review-bot

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Adjusts request size limit to accommodate multipart overhead

The comment explains the reasoning for setting max-request-size to 4MB, which is 2MB
more than max-file-size. This provides necessary headroom for multipart request
overhead while avoiding unnecessary rejection of valid files.

apps/backend/usersrole/src/main/resources/application.yaml [32]

+      max-request-size: 4MB
 
-
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies that the max-request-size is set to 4MB to provide headroom for multipart request overhead, which is 2MB more than max-file-size. However, since the existing_code and improved_code are identical, there's no actual change being proposed, making the impact minimal. The explanation is reasonable but doesn't introduce a functional improvement.

Low

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between f0b1ba9 and 55b1a45.

📒 Files selected for processing: 1
  • apps/backend/usersrole/src/main/resources/application.yaml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The multipart request-size limit increases from 2MB to 4MB. The per-file limit remains 2MB. Comments explain the additional request overhead from multipart headers and boundaries.

Changes: Multipart limits

Layer / File(s) Summary
Request-size limit
apps/backend/usersrole/src/main/resources/application.yaml
The request-size limit changes to 4MB. The per-file limit remains 2MB. Comments describe the overhead from multipart headers and boundaries.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 55b1a

No actionable merge-blocking risk remains in the reviewed change.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: increasing the usersrole multipart request-size ceiling.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jdwillmsen
jdwillmsen merged commit 804dba8 into main Oct 23, 2026
23 checks passed
@jdwillmsen
jdwillmsen deleted the fix/usersrole-multipart-headroom branch October 23, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant