Skip to content

Allow null steps in AchievementUpdateRequest#1145

Merged
Brutus5000 merged 2 commits into
developfrom
fix/achievement-steps-nullable
Jun 21, 2026
Merged

Allow null steps in AchievementUpdateRequest#1145
Brutus5000 merged 2 commits into
developfrom
fix/achievement-steps-nullable

Conversation

@Brutus5000

@Brutus5000 Brutus5000 commented Jun 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Achievement processing broke after the Spring Boot 4 / Jackson 3 upgrade: incoming request.achievement.update messages with no steps field (sent for REVEAL/UNLOCK operations) are rejected as MismatchedInputException: Cannot map null into type int, turning them into poison messages that block the queue.
  • Jackson 3 flipped FAIL_ON_NULL_FOR_PRIMITIVES to true by default and treats absent JSON properties as null for primitive record components. Jackson 2 silently coerced these to 0, masking the latent contract gap.
  • Switch steps to Integer and annotate it with @Schema(nullable = true, description = ...) to document that it is only required for INCREMENT and SET_STEPS_AT_LEAST. The controller only unboxes steps() on those two paths, so no NPE risk.

Test plan

  • Republish a REVEAL/UNLOCK message (no steps field) and confirm it is consumed without MessageConversionException.
  • Republish an INCREMENT / SET_STEPS_AT_LEAST message and confirm the steps value is applied as before.
  • Confirm the achievement queue drains and is no longer stuck on the poison message.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Enhanced OpenAPI/Swagger documentation for achievement update API endpoints with improved field metadata and clarity.
  • API Changes

    • The steps parameter in achievement update requests is now properly marked as optional for REVEAL and UNLOCK operations, and required for INCREMENT and SET_STEPS_AT_LEAST operations.

Jackson 3 (brought in by Spring Boot 4) defaults
FAIL_ON_NULL_FOR_PRIMITIVES to true and treats absent JSON properties
as null for primitive record components. The producer omits steps for
REVEAL/UNLOCK operations, which Jackson 2 silently coerced to 0 but
Jackson 3 now rejects, turning every such message into a poison pill
that blocks the achievement queue.

Switch steps to Integer and document via @Schema that it is only
required for INCREMENT and SET_STEPS_AT_LEAST.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Brutus5000, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 57 minutes and 14 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 084768f2-8bb5-4d28-8450-9c404b6e9a77

📥 Commits

Reviewing files that changed from the base of the PR and between f436d1c and d98139d.

📒 Files selected for processing (1)
  • src/main/java/com/faforever/api/achievements/AchievementsController.java
📝 Walkthrough

Walkthrough

AchievementUpdateRequest changes the steps record component from primitive int to nullable Integer and annotates it with @Schema, documenting that it is required only for INCREMENT and SET_STEPS_AT_LEAST operations and ignored for REVEAL and UNLOCK.

Changes

AchievementUpdateRequest steps nullability

Layer / File(s) Summary
steps field: nullable Integer and @Schema annotation
src/main/java/com/faforever/api/achievements/AchievementUpdateRequest.java
Adds io.swagger.v3.oas.annotations.media.Schema import, changes steps from int to Integer, and annotates it with @Schema(nullable = true) that describes its conditional requirement based on the Operation value.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit hops through fields of code,
where int once stood, now Integer glowed.
Nullable steps, a gentle switch,
with @Schema notes to fill the niche.
For REVEAL and UNLOCK, just leave it bare —
this bunny tidied up with care! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Allow null steps in AchievementUpdateRequest' directly and clearly summarizes the main change in the pull request, which modifies the steps field from a primitive int to a nullable Integer.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/achievement-steps-nullable

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 and usage tips.

Without this, a malformed payload would NPE on auto-unboxing inside the
switch and produce a confusing stack trace. Throwing explicitly points
straight at the contract violation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Brutus5000 Brutus5000 merged commit 39eea66 into develop Jun 21, 2026
4 checks passed
@Brutus5000 Brutus5000 deleted the fix/achievement-steps-nullable branch June 21, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant