feat(notification): notification 도메인 구성 #28 - #65
Conversation
📝 Walkthrough사용자는 공지사항, FAQ, 전형요강을 조회할 수 있는 애플리케이션 기반을 사용할 수 있습니다. REST API와 실제 저장소 연동은 포함하지 않습니다. 주요 변경
위험 영역
마이그레이션 및 호환성
검증 체크리스트 및 롤아웃
Walkthrough공지사항, FAQ, 채용 안내의 도메인 모델과 조회 계약을 추가했습니다. Changes알림 조회 기능
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant NotificationPort
participant NotificationService
participant NoticeRepository
NotificationPort->>NotificationService: getNotices(ReadNotificationPageCommand)
NotificationService->>NoticeRepository: findAll()
NoticeRepository-->>NotificationService: List<Notice>
NotificationService-->>NotificationPort: PageResult<NoticeSummaryResult>
🚥 Pre-merge checks | ✅ 5 | ❌ 5❌ Failed checks (5 warnings)
✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
|
@coderabbitai review |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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
`@systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/command/ReadNotificationPageCommand.kt`:
- Around line 3-6: NotificationService.toPage calculates page * size as an
overflowing Int, allowing negative indices to reach subList. Update toPage to
perform offset arithmetic in Long, clamp the resulting offset to the available
list-size range, and preserve valid pagination behavior; add a regression test
covering page = Int.MAX_VALUE with size = 2.
In
`@systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/NoticeRepository.kt`:
- Around line 5-7: Replace the all-items repository contracts with paginated
queries that accept page parameters and return both the page contents and total
count; in NoticeRepository, define deterministic createdAt DESC, id DESC
ordering. Apply this to
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/NoticeRepository.kt
lines 5-7 and FaqRepository.kt lines 5-7. Update NotificationService in
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.kt
lines 26-38 to map the repository page directly into the result DTO, removing
full-list sorting and subList pagination.
In
`@systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.kt`:
- Around line 103-107: Update the pagination index calculation in the
notification service method containing fromIndex and toIndex to perform page ×
size using Long before coercing to the collection size, preventing Int overflow
and invalid subList indices. Inspect ReadNotificationPageCommand validation and
add or preserve appropriate upper-bound validation for page and size if absent,
while keeping nonnegative page and positive size requirements.
- Around line 18-20: Remove the org.springframework.stereotype.Service import
and `@Service` annotation from NotificationService so it remains a plain Kotlin
class; register it as a bean from bootstrap configuration or a factory. Also
remove the Spring Boot starter dependency from
systems/notification/notification-application/deps.bzl (lines 1-4) after
eliminating the application-layer Spring usage.
🪄 Autofix
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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 95749a1b-42fd-4067-9da6-1baff28ffed6
📒 Files selected for processing (15)
systems/notification/notification-application/deps.bzlsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/exception/NotificationNotFoundException.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/NotificationPort.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/command/ReadNotificationPageCommand.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/FaqResults.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/NoticeResults.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/PageResult.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/RecruitmentGuidelineResult.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/FaqRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/NoticeRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/RecruitmentGuidelineRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Faq.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Notice.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/RecruitmentGuideline.kt
📜 Review details
🧰 Additional context used
📓 Path-based instructions (7)
**/{BUILD.bazel,*.bzl}
📄 CodeRabbit inference engine (Custom checks)
In BUILD.bazel and .bzl files, require buildifier-compatible formatting and stable target naming
Files:
systems/notification/notification-application/deps.bzl
**/*.bzl
⚙️ CodeRabbit configuration file
**/*.bzl: Apply Bazel Starlark (.bzl) style guidance.Readability and docs:
- Keep file/module docstrings and docstrings for public functions/macros.
- Use descriptive parameter names and document attribute intent.
API design:
- Macros should take a
nameargument and derive generated target names from it.- Prefer keyword arguments when calling macros for clarity and stability.
- Keep macro side effects predictable and visible.
Encapsulation:
- Use private visibility for helper targets created by macros unless explicitly public.
- Avoid exposing internal implementation targets unintentionally.
Tooling:
- Enforce buildifier formatting and lint compliance.
Files:
systems/notification/notification-application/deps.bzl
**/*.{kt,go}
📄 CodeRabbit inference engine (Custom checks)
If production logic is changed in Kotlin or Go files, require corresponding test updates in the same subsystem unless the PR description explicitly justifies why tests are unnecessary
Files:
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/FaqRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/PageResult.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Faq.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/RecruitmentGuideline.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/exception/NotificationNotFoundException.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/command/ReadNotificationPageCommand.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/NotificationPort.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Notice.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/NoticeResults.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/NoticeRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/RecruitmentGuidelineResult.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/RecruitmentGuidelineRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/FaqResults.kt
**/*-application/**/*.{java,kt,scala,groovy}
📄 CodeRabbit inference engine (Custom checks)
For files under *-application modules, flag direct dependency on infrastructure-specific framework classes unless justified
Files:
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/FaqRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/PageResult.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/exception/NotificationNotFoundException.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/command/ReadNotificationPageCommand.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/NotificationPort.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/NoticeResults.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/NoticeRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/RecruitmentGuidelineResult.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/RecruitmentGuidelineRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/FaqResults.kt
**/*.{java,kt,scala,groovy,go,js,ts,tsx,jsx,py,rb,rs,cpp,c,h,hpp,cs}
📄 CodeRabbit inference engine (Custom checks)
Flag TODO/FIXME comments introduced by this PR that do not include an issue reference in the form
#123or a full tracker key like PROJ-123
Files:
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/FaqRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/PageResult.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Faq.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/RecruitmentGuideline.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/exception/NotificationNotFoundException.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/command/ReadNotificationPageCommand.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/NotificationPort.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Notice.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/NoticeResults.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/NoticeRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/RecruitmentGuidelineResult.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/RecruitmentGuidelineRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/FaqResults.kt
**/*.kt
⚙️ CodeRabbit configuration file
**/*.kt: Apply Kotlin Official Coding Conventions.Formatting and structure:
- Use 4 spaces for indentation; no tabs.
- Keep files focused and readable; avoid horizontal alignment for spacing.
- Place related declarations together and keep overloads adjacent.
- Keep implementation member order stable and logical for readability.
Naming:
- Package names are lowercase and do not use underscores.
- Class/object names use UpperCamelCase.
- Functions/properties/local variables use lowerCamelCase.
- Constants use UPPER_SNAKE_CASE only for true constants.
API and null-safety:
- Avoid platform type leakage in public APIs.
- Use explicit types in public APIs when inference obscures meaning.
- Prefer immutable values (
val) over mutable values (var) unless mutation is required.- Flag nullable flows that can be replaced with safer modeling.
Imports and idioms:
- Avoid wildcard imports unless justified by language/tooling conventions.
- Prefer expression bodies for short, clear functions.
- Prefer standard library idioms over custom utility wrappers when equivalent.
Architecture and tests:
- Respect module boundaries (domain/application/adapter/bootstrap layering).
- Highlight behavior-changing code that lacks corresponding unit/integration tests.
- Ask for deterministic tests and meaningful assertions, not only happy-path checks.
Files:
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/FaqRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/PageResult.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Faq.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/RecruitmentGuideline.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/exception/NotificationNotFoundException.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/command/ReadNotificationPageCommand.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/NotificationPort.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Notice.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/NoticeResults.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/NoticeRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/RecruitmentGuidelineResult.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/RecruitmentGuidelineRepository.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.ktsystems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/FaqResults.kt
**/*-domain/**/*.{java,kt,scala,groovy}
📄 CodeRabbit inference engine (Custom checks)
For files under *-domain modules, fail if imports reference adapter or bootstrap packages
Files:
systems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Faq.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/RecruitmentGuideline.ktsystems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Notice.kt
🔇 Additional comments (10)
systems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Faq.kt (1)
1-13: LGTM!systems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/Notice.kt (1)
1-13: LGTM!systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/RecruitmentGuidelineRepository.kt (1)
1-7: LGTM!systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/exception/NotificationNotFoundException.kt (1)
1-5: LGTM!systems/notification/notification-domain/src/main/kotlin/hs/kr/entrydsm/notification/domain/model/RecruitmentGuideline.kt (1)
1-19: LGTM!systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/PageResult.kt (1)
1-10: LGTM!systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/NoticeResults.kt (1)
1-20: LGTM!systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/FaqResults.kt (1)
1-20: LGTM!systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/result/RecruitmentGuidelineResult.kt (1)
1-19: LGTM!systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/NotificationPort.kt (1)
1-17: LGTM!
| data class ReadNotificationPageCommand( | ||
| val page: Int = 0, | ||
| val size: Int = 10, | ||
| ) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
페이지 오프셋 계산의 Int 오버플로를 방지하세요.
ReadNotificationPageCommand는 page * size가 Int 범위를 넘지 않는다는 보장을 제공하지 않습니다. 제공된 NotificationService.toPage는 page >= 0과 size > 0만 확인한 뒤 command.page * command.size를 Int로 계산합니다. page = Int.MAX_VALUE, size = 2는 검증을 통과하지만 곱셈 결과가 -2가 됩니다. coerceAtMost(size)는 하한을 보정하지 않으므로 음수 인덱스가 subList로 전달되고 IndexOutOfBoundsException이 발생합니다.
NotificationService.toPage에서 오프셋 계산을 Long으로 수행한 뒤 목록 크기 범위로 제한하세요. 또는 command 생성 시 안전한 page * size 범위를 검증하세요. 해당 경계 입력에 대한 회귀 테스트도 추가하세요.
수정 예시
- val fromIndex = (command.page * command.size).coerceAtMost(size)
- val toIndex = (fromIndex + command.size).coerceAtMost(size)
+ val totalSize = size.toLong()
+ val fromIndex = (command.page.toLong() * command.size)
+ .coerceIn(0L, totalSize)
+ .toInt()
+ val toIndex = (fromIndex.toLong() + command.size)
+ .coerceIn(fromIndex.toLong(), totalSize)
+ .toInt()경계값 검증 스크립트
#!/bin/bash
set -euo pipefail
command_file="$(fd -t f 'ReadNotificationPageCommand.kt' . | head -n 1)"
service_file="$(fd -t f 'NotificationService.kt' . | head -n 1)"
rg -n -C 4 \
'ReadNotificationPageCommand|fromIndex|toIndex|subList|command\.page|command\.size' \
"$command_file" "$service_file"
python - <<'PY'
import ctypes
page = 2**31 - 1
size = 2
product = ctypes.c_int32(page * size).value
assert product == -2
print(f"32-bit product: {product}")
PY🤖 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
`@systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/command/ReadNotificationPageCommand.kt`
around lines 3 - 6, NotificationService.toPage calculates page * size as an
overflowing Int, allowing negative indices to reach subList. Update toPage to
perform offset arithmetic in Long, clamp the resulting offset to the available
list-size range, and preserve valid pagination behavior; add a regression test
covering page = Int.MAX_VALUE with size = 2.
| interface NoticeRepository { | ||
| fun findAll(): List<Notice> | ||
| fun findById(id: Long): Notice? |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift
페이지 조회를 repository 계약으로 내려야 합니다.
현재 포트는 모든 공지와 FAQ를 반환합니다. 서비스는 전체 목록을 정렬한 뒤 일부만 반환합니다. 실제 persistence adapter는 LIMIT, OFFSET, 정렬, 전체 건수를 데이터 저장소에서 처리할 수 없습니다. 데이터가 증가하면 요청마다 메모리와 CPU 사용량이 전체 데이터 크기에 비례합니다.
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/NoticeRepository.kt#L5-L7: 페이지 인자와 전체 건수를 포함하는 페이지 조회 계약으로findAll()을 대체하십시오. 공지 정렬은createdAt DESC, id DESC처럼 결정적으로 정의하십시오.systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/FaqRepository.kt#L5-L7: 페이지 인자와 전체 건수를 포함하는 페이지 조회 계약으로findAll()을 대체하십시오.systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.kt#L26-L38: repository가 반환한 페이지를 결과 DTO로 변환하십시오. 전체 목록 정렬과subList()페이지 처리를 제거하십시오.
📍 Affects 3 files
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/NoticeRepository.kt#L5-L7(this comment)systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/FaqRepository.kt#L5-L7systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.kt#L26-L38
🤖 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
`@systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/NoticeRepository.kt`
around lines 5 - 7, Replace the all-items repository contracts with paginated
queries that accept page parameters and return both the page contents and total
count; in NoticeRepository, define deterministic createdAt DESC, id DESC
ordering. Apply this to
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/out/NoticeRepository.kt
lines 5-7 and FaqRepository.kt lines 5-7. Update NotificationService in
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.kt
lines 26-38 to map the repository page directly into the result DTO, removing
full-list sorting and subList pagination.
| import org.springframework.stereotype.Service | ||
|
|
||
| @Service |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
application 계층에서 Spring 의존성을 제거해야 합니다.
NotificationService는 Spring @Service에 직접 의존합니다. 이 변경 때문에 application 모듈도 Spring Boot starter에 의존합니다. 서비스는 일반 Kotlin 클래스로 유지하고, bootstrap 모듈의 configuration 또는 factory에서 bean으로 등록해야 합니다.
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.kt#L18-L20:org.springframework.stereotype.Serviceimport와@Service를 제거하십시오.systems/notification/notification-application/deps.bzl#L1-L4: application 서비스에서 Spring 사용을 제거한 뒤 Spring Boot starter 의존성을 제거하십시오.
코딩 가이드라인에 따라 “For files under *-application modules, flag direct dependency on infrastructure-specific framework classes unless justified” 규칙을 적용했습니다.
#!/bin/bash
set -euo pipefail
fd -e kt . -x rg -n -C 3 'import org\.springframework|`@Service`|`@Configuration`|`@Bean`' {}📍 Affects 2 files
systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.kt#L18-L20(this comment)systems/notification/notification-application/deps.bzl#L1-L4
🤖 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
`@systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.kt`
around lines 18 - 20, Remove the org.springframework.stereotype.Service import
and `@Service` annotation from NotificationService so it remains a plain Kotlin
class; register it as a bean from bootstrap configuration or a factory. Also
remove the Spring Boot starter dependency from
systems/notification/notification-application/deps.bzl (lines 1-4) after
eliminating the application-layer Spring usage.
| require(command.page >= 0) { "page must be greater than or equal to 0" } | ||
| require(command.size > 0) { "size must be greater than 0" } | ||
|
|
||
| val fromIndex = (command.page * command.size).coerceAtMost(size) | ||
| val toIndex = (fromIndex + command.size).coerceAtMost(size) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win
페이지 인덱스 계산을 Long으로 변경해야 합니다.
Line 106은 command.page * command.size를 Int로 계산합니다. 두 값이 모두 검증을 통과해도 곱셈은 overflow할 수 있습니다. 이 경우 음수 인덱스가 subList()에 전달되어 요청이 실패합니다.
수정 예시
- val fromIndex = (command.page * command.size).coerceAtMost(size)
- val toIndex = (fromIndex + command.size).coerceAtMost(size)
+ val fromIndex = (command.page.toLong() * command.size)
+ .coerceAtMost(size.toLong())
+ .toInt()
+ val toIndex = (fromIndex.toLong() + command.size)
+ .coerceAtMost(size.toLong())
+ .toInt()ReadNotificationPageCommand에 상한 검증이 있는지도 함께 확인해야 합니다.
#!/bin/bash
set -euo pipefail
ast-grep outline systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/command/ReadNotificationPageCommand.kt --items all
rg -n -C 3 'page:|size:|require\(' systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/port/in/command/ReadNotificationPageCommand.kt🤖 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
`@systems/notification/notification-application/src/main/kotlin/hs/kr/entrydsm/notification/application/service/NotificationService.kt`
around lines 103 - 107, Update the pagination index calculation in the
notification service method containing fromIndex and toIndex to perform page ×
size using Long before coercing to the collection size, preventing Int overflow
and invalid subList indices. Inspect ReadNotificationPageCommand validation and
add or preserve appropriate upper-bound validation for page and size if absent,
while keeping nonnegative page and positive size requirements.
Summary
notification 조회 기능의 domain/application 기반을 구성했습니다.
공지, QnA, 전형요강 domain model을 추가했습니다.
조회 use case를 위한 input/output port, command/result, service, exception을 정의했습니다.
Related Issue
Closes #28
Scope
In scope:
Out of scope:
Implementation
공지 목록/상세, QnA 목록/상세, 전형요강 조회 흐름을 application service로 구성했습니다.
NotificationService는 repository port에만 의존하도록 구성했습니다.
공지 등록, 수정, 삭제는 admin API 범위이므로 포함하지 않았습니다.
이 PR은 현재 전달받은 notification 조회 API 명세와 ERD 기준으로 공지/QnA/전형요강 조회에 필요한 도메인 골격을 우선 구성했습니다.
이슈 원문에 포함된 게시 예약, 상태 변경, 도메인 이벤트는 admin 등록/수정/삭제 API 범위와 함께 후속 작업으로 분리합니다.
Testing
Deployment Notes
Feature flag: 없음
Migration required: 없음
Rollout considerations:
Checklist