Skip to content

๐Ÿ’ซ feat: ํ…Œ์ŠคํŠธ ๊ธฐ๊ฐ„ ํฌ์ธํŠธ ์ง€๊ธ‰ ์ƒํ•œ ์ •์ฑ… ์ ์šฉ - #118

Merged
JoonKyoLee merged 5 commits into
developfrom
feature/point-award-cap-policy
Jul 24, 2026
Merged

JoonKyoLee merged 5 commits into
developfrom
feature/point-award-cap-policy

Conversation

@JoonKyoLee

@JoonKyoLee JoonKyoLee commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

#๏ธโƒฃ Issue Number

๐Ÿ“ ์š”์•ฝ(Summary)

  • ํฌ์ธํŠธ ์ง€๊ธ‰ ์ƒํ•œ์„ ์„ค์ •๊ฐ’์œผ๋กœ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ์ •์ฑ… ๊ตฌ์กฐ๋ฅผ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ์„ค์ •๊ฐ’์ด ์—†์œผ๋ฉด ๊ธฐ์กด์ฒ˜๋Ÿผ ๋ฌด์ œํ•œ ์ง€๊ธ‰๋˜๊ณ , ์„ค์ •๊ฐ’์ด ์žˆ์œผ๋ฉด ์œ ์ €๋ณ„ ๋ˆ„์  ํฌ์ธํŠธ ์ง€๊ธ‰๋Ÿ‰ ๊ธฐ์ค€์œผ๋กœ ๋ถ€๋ถ„ ์ง€๊ธ‰ ๋˜๋Š” ๋ฏธ์ง€๊ธ‰๋˜๋„๋ก ๊ณตํ†ต ๋กœ์ง์„ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ๊ฐ€์ฑ , ์Šคํ”„ ๋ณด์ƒ, ๊ด€๋ฆฌ์ž ํฌ์ธํŠธ ์ง€๊ธ‰ ๊ฒฝ๋กœ๊ฐ€ ๋ชจ๋‘ ๊ณตํ†ต ํฌ์ธํŠธ ์ง€๊ธ‰ ๋กœ์ง์„ ์‚ฌ์šฉํ•˜๋„๋ก ์ •๋ฆฌํ•˜๊ณ  ๊ด€๋ จ ํ…Œ์ŠคํŠธ๋ฅผ ๋ณด๊ฐ•ํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ“ ๋ฆฌ๋ทฐ ์š”์ฒญ์‚ฌํ•ญ

  • ํฌ์ธํŠธ ์ง€๊ธ‰ ์ƒํ•œ์„ ๊ฐœ๋ณ„ ๊ธฐ๋Šฅ ๋ถ„๊ธฐ ์—†์ด ๊ณตํ†ต ์ง€๊ธ‰ ๋กœ์ง์—์„œ ์ผ๊ด€๋˜๊ฒŒ ์ฒ˜๋ฆฌํ•˜๋„๋ก ์ •๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ์ƒํ•œ ๊ทผ์ ‘ ์‹œ์—๋Š” ๋‚จ์€ ํ•œ๋„๋งŒํผ๋งŒ ๋ถ€๋ถ„ ์ง€๊ธ‰๋˜๋„๋ก ํ–ˆ๊ณ , ์ƒํ•œ ์†Œ์ง„ ์‹œ์—๋Š” ์ถ”๊ฐ€ ํฌ์ธํŠธ๊ฐ€ ์ง€๊ธ‰๋˜์ง€ ์•Š๋„๋ก ๋ฐ˜์˜ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • APP_POINT_POLICY_MAX_CUMULATIVE_EARN_AMOUNT_PER_USER ์„ค์ •์ด ์—†์„ ๋•Œ๋Š” ๊ธฐ์กด ๋™์ž‘๊ณผ ๋™์ผํ•˜๊ฒŒ ์ œํ•œ ์—†์ด ์ง€๊ธ‰๋˜๋Š” ๊ตฌ์กฐ์ž…๋‹ˆ๋‹ค.

๐Ÿ’ป ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ

  • ./gradlew -q compileKotlin ํ†ต๊ณผ
  • ./gradlew test --tests 'com.zerost.api.point.application.PointAwardServiceTest' --tests 'com.zerost.api.gacha.application.GachaExecutionServiceTest' --tests 'com.zerost.api.soup.application.SoupBrewingServiceTest' --tests 'com.zerost.api.soup.application.SoupRerollServiceTest' ํ†ต๊ณผ

๐Ÿ“Œ ํฌ์ธํŠธ

  • ํ…Œ์ŠคํŠธ ๊ธฐ๊ฐ„ ์ •์ฑ…์„ ํ•˜๋“œ์ฝ”๋”ฉํ•˜์ง€ ์•Š๊ณ  ์„ค์ •๊ฐ’ ๊ธฐ๋ฐ˜์œผ๋กœ ๋ถ„๋ฆฌํ•ด, ์šด์˜ ์ค‘์—๋„ ๋ฐฐํฌ ์—†์ด ์ƒํ•œ ์ ์šฉ/ํ•ด์ œ๊ฐ€ ๊ฐ€๋Šฅํ•˜๋„๋ก ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค.
  • ์‹ค์ œ ํฌ์ธํŠธ ์ง€๊ธ‰์ด ์ผ์–ด๋‚˜๋Š” ๋ชจ๋“  ๊ฒฝ๋กœ๋ฅผ ๊ณตํ†ต ์„œ๋น„์Šค๋กœ ๋ชจ์•„ ์ •์ฑ… ๋ˆ„๋ฝ ๊ฐ€๋Šฅ์„ฑ์„ ์ค„์˜€์Šต๋‹ˆ๋‹ค.

โœ๏ธ ํšŒ๊ณ 

  • ํฌ์ธํŠธ ์ง€๊ธ‰ ๋กœ์ง์ด ๊ธฐ๋Šฅ๋ณ„๋กœ ํฉ์–ด์ ธ ์žˆ์œผ๋ฉด ํ…Œ์ŠคํŠธ ๊ธฐ๊ฐ„ ์ •์ฑ… ๊ฐ™์€ ์šด์˜ ์š”๊ตฌ์‚ฌํ•ญ์ด ๋“ค์–ด์˜ฌ ๋•Œ ๋ˆ„๋ฝ ์œ„ํ—˜์ด ์ปค์งˆ ์ˆ˜ ์žˆ์—ˆ๋Š”๋ฐ, ์ด๋ฒˆ์— ๊ณตํ†ต ์ •์ฑ… ๊ณ„์ธต์œผ๋กœ ๋ฌถ์œผ๋ฉด์„œ ์ดํ›„ ์šด์˜ ๋Œ€์‘์ด ํ›จ์”ฌ ์‰ฌ์šด ๊ตฌ์กฐ๊ฐ€ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
  • ํŠนํžˆ ๋ถ€๋ถ„ ์ง€๊ธ‰๊นŒ์ง€ ๊ณตํ†ต ๋กœ์ง์—์„œ ์ฒ˜๋ฆฌํ•˜๊ฒŒ ํ•ด๋‘์–ด, ์ดํ›„ ์ƒํ•œ ์ •์ฑ…์ด ๋ฐ”๋€Œ๋”๋ผ๋„ ์˜ํ–ฅ ๋ฒ”์œ„๋ฅผ ์˜ˆ์ธกํ•˜๊ธฐ ์‰ฌ์›Œ์กŒ์Šต๋‹ˆ๋‹ค.

Summary by CodeRabbit

  • New Features

    • Centralized point awarding across asset grants, gacha rewards, and soup rewards for consistent behavior.
    • Added an optional per-user cumulative earning cap via app.point.policy.max-cumulative-earn-amount-per-user (environment-configurable).
  • Bug Fixes

    • Reward totals and granted point amounts now reflect the actual granted/capped value consistently across reward types.
  • Tests

    • Added/expanded coverage for no cap, partial cap, fully exhausted cap, and invalid (non-numeric/negative) cap inputs.
    • Updated gacha and soup reward tests to use the new awarding flow.

@JoonKyoLee JoonKyoLee self-assigned this Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. ๐ŸŽ‰

โ„น๏ธ Recent review info
โš™๏ธ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5d3a841b-31f6-435a-8ce8-5856386a2e11

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 18124ee and 1f758d6.

๐Ÿ“’ Files selected for processing (5)
  • src/main/kotlin/com/zerost/api/point/application/PointAwardService.kt
  • src/test/kotlin/com/zerost/api/gacha/application/GachaExecutionServiceTest.kt
  • src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt
  • src/test/kotlin/com/zerost/api/soup/application/SoupBrewingServiceTest.kt
  • src/test/kotlin/com/zerost/api/soup/application/SoupRerollServiceTest.kt
๐Ÿšง Files skipped from review as they are similar to previous changes (5)
  • src/test/kotlin/com/zerost/api/soup/application/SoupRerollServiceTest.kt
  • src/test/kotlin/com/zerost/api/gacha/application/GachaExecutionServiceTest.kt
  • src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt
  • src/main/kotlin/com/zerost/api/point/application/PointAwardService.kt
  • src/test/kotlin/com/zerost/api/soup/application/SoupBrewingServiceTest.kt

๐Ÿ“ Walkthrough

Walkthrough

Point awards are centralized in PointAwardService, which applies an optional per-user cumulative cap. Asset, gacha, and soup reward flows now use the service, with returned amounts reflected in balances, results, histories, and tests.

Changes

Point award policy

Layer / File(s) Summary
Award policy and persistence
src/main/kotlin/com/zerost/api/point/application/*, src/main/kotlin/com/zerost/api/point/domain/PointHistoryRepository.kt, src/main/resources/application.yaml
Adds configurable cumulative earning limits, earned-history aggregation, and shared award logic supporting full, partial, or zero grants.

Asset and gacha award integration

Layer / File(s) Summary
Asset and gacha award integration
src/main/kotlin/com/zerost/api/admin/asset/application/AdminAssetGrantService.kt, src/main/kotlin/com/zerost/api/gacha/application/GachaExecutionService.kt
Routes point awards through PointAwardService and records actual granted amounts in asset results and gacha rewards.

Soup reward integration

Layer / File(s) Summary
Soup reward integration
src/main/kotlin/com/zerost/api/soup/application/SoupRewardService.kt
Uses the awarded total to calculate base and bonus points, removes direct point-history persistence, and centralizes reward summary construction.

Service wiring and award tests

Layer / File(s) Summary
Service wiring and award tests
src/test/kotlin/com/zerost/api/{gacha,soup}/application/*Test.kt, src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt
Updates service construction and verifies unlimited, partial, exhausted, and invalid point-cap scenarios.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RewardFlow
  participant PointAwardService
  participant PointHistoryRepository
  participant UserRepository
  RewardFlow->>PointAwardService: request point award
  PointAwardService->>UserRepository: lock and load user
  PointAwardService->>PointHistoryRepository: read cumulative earned amount
  PointAwardService->>PointHistoryRepository: persist earning history
  PointAwardService-->>RewardFlow: return actual granted amount
Loading

Possibly related PRs

  • team-0st/BE#34: Refactors soup reward point and history mutations through PointAwardService.
  • team-0st/BE#36: Extends point-history persistence and query infrastructure used by centralized awarding.
  • team-0st/BE#37: Changes gacha point-history handling in GachaExecutionService.
๐Ÿšฅ Pre-merge checks | โœ… 4 | โŒ 1

โŒ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage โš ๏ธ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
โœ… Passed checks (4 passed)
Check name Status Explanation
Title check โœ… Passed The title clearly states the main change: applying a point payout cap policy during the test period.
Description check โœ… Passed The description includes the issue number, summary, review notes, and test results, matching the template well.
Linked Issues check โœ… Passed The PR implements the configurable cumulative point cap, shared award flow, partial/zero payout behavior, and tests required by #71.
Out of Scope Changes check โœ… Passed The changes stay focused on shared point-award policy, service refactors, config, and tests, with no clear unrelated additions.
โœจ Finishing Touches
๐Ÿ“ Generate docstrings
  • Create stacked PR
  • Commit on current branch
๐Ÿงช Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/point-award-cap-policy

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

๐Ÿงน Nitpick comments (2)
src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt (1)

47-56: ๐Ÿ—„๏ธ Data Integrity & Integration | ๐Ÿ”ต Trivial | โšก Quick win

Assert the capped amount in persisted history.

verify(pointHistoryRepository).save(any()) would still pass if the user received 100 but history recorded the requested 300. Capture the saved history and assert that its awarded amount is 100, since this value drives subsequent cumulative-cap calculations.

๐Ÿค– Prompt for 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.

In `@src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt`
around lines 47 - 56, Update the award test around PointAwardService.award to
capture the PointHistory passed to pointHistoryRepository.save instead of
verifying with any(). Assert the captured historyโ€™s awarded amount is 100, while
retaining the existing assertions for grantedAmount and user.point.
src/test/kotlin/com/zerost/api/gacha/application/GachaExecutionServiceTest.kt (1)

44-44: ๐Ÿ—„๏ธ Data Integrity & Integration | ๐Ÿ”ต Trivial | ๐Ÿ—๏ธ Heavy lift

Exercise capped awards through every downstream flow.

All three fixtures construct PointAwardService with an unset cap, so the standalone policy tests pass even if downstream services mishandle partial or exhausted grants.

  • src/test/kotlin/com/zerost/api/gacha/application/GachaExecutionServiceTest.kt#L44-L44,L55-L55: add capped Gacha assertions for response, balance, and history.
  • src/test/kotlin/com/zerost/api/soup/application/SoupBrewingServiceTest.kt#L65-L65,L74-L74: add capped soup assertions for response/base/bonus allocation, balance, and history.
  • src/test/kotlin/com/zerost/api/soup/application/SoupRerollServiceTest.kt#L62-L62,L71-L71: add capped reroll assertions for response, balance, and history.
๐Ÿค– Prompt for 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.

In
`@src/test/kotlin/com/zerost/api/gacha/application/GachaExecutionServiceTest.kt`
at line 44, The point-award fixtures use an unset cap, so downstream flows are
not tested against partial or exhausted grants. In
src/test/kotlin/com/zerost/api/gacha/application/GachaExecutionServiceTest.kt:44-44,
update the PointAwardService fixture and add capped assertions covering
response, balance, and history; in
src/test/kotlin/com/zerost/api/soup/application/SoupBrewingServiceTest.kt:65-65,
add capped assertions for response, base/bonus allocation, balance, and history;
in
src/test/kotlin/com/zerost/api/soup/application/SoupRerollServiceTest.kt:62-62,
add capped assertions for response, balance, and history, using the existing
service test structures and ensuring partial and exhausted grants are exercised.
๐Ÿค– 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 `@src/main/resources/application.yaml`:
- Around line 32-34: Remove the max-cumulative-earn-amount-per-user entry from
the point.policy configuration in application.yaml, relying on the existing
environment-variable binding and Kotlin default null value instead.

---

Nitpick comments:
In
`@src/test/kotlin/com/zerost/api/gacha/application/GachaExecutionServiceTest.kt`:
- Line 44: The point-award fixtures use an unset cap, so downstream flows are
not tested against partial or exhausted grants. In
src/test/kotlin/com/zerost/api/gacha/application/GachaExecutionServiceTest.kt:44-44,
update the PointAwardService fixture and add capped assertions covering
response, balance, and history; in
src/test/kotlin/com/zerost/api/soup/application/SoupBrewingServiceTest.kt:65-65,
add capped assertions for response, base/bonus allocation, balance, and history;
in
src/test/kotlin/com/zerost/api/soup/application/SoupRerollServiceTest.kt:62-62,
add capped assertions for response, balance, and history, using the existing
service test structures and ensuring partial and exhausted grants are exercised.

In `@src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt`:
- Around line 47-56: Update the award test around PointAwardService.award to
capture the PointHistory passed to pointHistoryRepository.save instead of
verifying with any(). Assert the captured historyโ€™s awarded amount is 100, while
retaining the existing assertions for grantedAmount and user.point.
๐Ÿช„ 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b7bc164a-960b-4a58-8a1e-3268d849b926

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between f270bfa and 41f8278.

๐Ÿ“’ Files selected for processing (12)
  • src/main/kotlin/com/zerost/api/admin/asset/application/AdminAssetGrantService.kt
  • src/main/kotlin/com/zerost/api/gacha/application/GachaExecutionService.kt
  • src/main/kotlin/com/zerost/api/point/application/PointAwardService.kt
  • src/main/kotlin/com/zerost/api/point/application/PointPolicyConfig.kt
  • src/main/kotlin/com/zerost/api/point/application/PointPolicyProperties.kt
  • src/main/kotlin/com/zerost/api/point/domain/PointHistoryRepository.kt
  • src/main/kotlin/com/zerost/api/soup/application/SoupRewardService.kt
  • src/main/resources/application.yaml
  • src/test/kotlin/com/zerost/api/gacha/application/GachaExecutionServiceTest.kt
  • src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt
  • src/test/kotlin/com/zerost/api/soup/application/SoupBrewingServiceTest.kt
  • src/test/kotlin/com/zerost/api/soup/application/SoupRerollServiceTest.kt

Comment thread src/main/resources/application.yaml Outdated
@JoonKyoLee
JoonKyoLee force-pushed the feature/point-award-cap-policy branch from 41f8278 to 2ed89aa Compare July 24, 2026 06:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@src/main/kotlin/com/zerost/api/point/application/PointPolicyProperties.kt`:
- Around line 5-7: Validate maxCumulativeEarnAmountPerUser during
PointPolicyProperties configuration binding or bootstrap, accepting null/blank
as unset but rejecting malformed and negative values as configuration errors.
Ensure PointAwardService receives only a valid non-negative integer cap and no
longer relies on lazy parsing or silently clamps invalid negative values.

In `@src/main/kotlin/com/zerost/api/point/domain/PointHistoryRepository.kt`:
- Around line 4-6: Update the aggregate query method in PointHistoryRepository
to return Long, and keep the cap calculation in Long throughout its callers;
convert the final value to Int only at the boundary where an Int is required.
๐Ÿช„ 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a8545e6a-acc5-4bb4-a611-559c8ab61f66

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 41f8278 and 2ed89aa.

๐Ÿ“’ Files selected for processing (12)
  • src/main/kotlin/com/zerost/api/admin/asset/application/AdminAssetGrantService.kt
  • src/main/kotlin/com/zerost/api/gacha/application/GachaExecutionService.kt
  • src/main/kotlin/com/zerost/api/point/application/PointAwardService.kt
  • src/main/kotlin/com/zerost/api/point/application/PointPolicyConfig.kt
  • src/main/kotlin/com/zerost/api/point/application/PointPolicyProperties.kt
  • src/main/kotlin/com/zerost/api/point/domain/PointHistoryRepository.kt
  • src/main/kotlin/com/zerost/api/soup/application/SoupRewardService.kt
  • src/main/resources/application.yaml
  • src/test/kotlin/com/zerost/api/gacha/application/GachaExecutionServiceTest.kt
  • src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt
  • src/test/kotlin/com/zerost/api/soup/application/SoupBrewingServiceTest.kt
  • src/test/kotlin/com/zerost/api/soup/application/SoupRerollServiceTest.kt
๐Ÿšง Files skipped from review as they are similar to previous changes (8)
  • src/main/resources/application.yaml
  • src/main/kotlin/com/zerost/api/point/application/PointPolicyConfig.kt
  • src/main/kotlin/com/zerost/api/gacha/application/GachaExecutionService.kt
  • src/main/kotlin/com/zerost/api/point/application/PointAwardService.kt
  • src/test/kotlin/com/zerost/api/soup/application/SoupRerollServiceTest.kt
  • src/test/kotlin/com/zerost/api/gacha/application/GachaExecutionServiceTest.kt
  • src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt
  • src/main/kotlin/com/zerost/api/soup/application/SoupRewardService.kt

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

๐Ÿงน Nitpick comments (1)
src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt (1)

34-36: ๐Ÿ—„๏ธ Data Integrity & Integration | ๐Ÿ”ต Trivial | โšก Quick win

Assert the persisted history contents, not only the save call.

Capture the saved PointHistory and verify its amount matches the granted amount (500 and 100) and that sourceType/sourceId are preserved. The cumulative cap relies on this history, so save(any()) would miss an incorrect persisted award.

Also applies to: 55-57

๐Ÿค– Prompt for 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.

In `@src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt`
around lines 34 - 36, Update the PointAwardServiceTest assertions around
pointHistoryRepository.save in both affected cases to capture the persisted
PointHistory argument and verify its amount matches the granted award (500 and
100), while also asserting sourceType and sourceId are preserved. Replace the
save(any())-only verification with content assertions.
๐Ÿค– 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 `@src/main/kotlin/com/zerost/api/point/application/PointAwardService.kt`:
- Around line 53-58: Update the award flow in PointAwardService so calculating
currentEarnedAmount, enforcing remainingAmount, and persisting the balance and
earning history execute atomically per user. Use the repository/database
transaction with row locking or an equivalent conditional update, and ensure
concurrent awards for the same user cannot exceed
maxCumulativeEarnAmountPerUser.

---

Nitpick comments:
In `@src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt`:
- Around line 34-36: Update the PointAwardServiceTest assertions around
pointHistoryRepository.save in both affected cases to capture the persisted
PointHistory argument and verify its amount matches the granted award (500 and
100), while also asserting sourceType and sourceId are preserved. Replace the
save(any())-only verification with content assertions.
๐Ÿช„ 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 73aaaf2e-c94f-4e79-b0d3-23891767f758

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 2ed89aa and 18124ee.

๐Ÿ“’ Files selected for processing (4)
  • src/main/kotlin/com/zerost/api/point/application/PointAwardService.kt
  • src/main/kotlin/com/zerost/api/point/application/PointPolicyProperties.kt
  • src/main/kotlin/com/zerost/api/point/domain/PointHistoryRepository.kt
  • src/test/kotlin/com/zerost/api/point/application/PointAwardServiceTest.kt
๐Ÿšง Files skipped from review as they are similar to previous changes (1)
  • src/main/kotlin/com/zerost/api/point/domain/PointHistoryRepository.kt

@JoonKyoLee
JoonKyoLee merged commit 943ca2f into develop Jul 24, 2026
2 checks passed
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.

๐Ÿ’ซ [feature] ํ…Œ์ŠคํŠธ ๊ธฐ๊ฐ„ ํฌ์ธํŠธ ์ง€๊ธ‰ ์ƒํ•œ ์ •์ฑ… ์ ์šฉ

1 participant