fix(etl): refresh amount validation on current develop - #316
Conversation
📝 WalkthroughWalkthrough
ChangesETL 금액 무결성
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: 🟠 High · up to The change adds AMOUNT validation, but null, object, and array values can still bypass the check and be stored, creating a concrete data-integrity risk; merge should wait until this validation path is corrected. The idempotent-request documentation also needs to clarify whether validation must occur before its first database call. Possibly related issues
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
etl-service/src/test/java/com/xtrmetl/etl/service/EtlServiceAmountIntegrityTest.java (1)
32-48: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win실제 0 값의 회귀 경로를 추가하세요.
현재 parameterized test는 모두 거부해야 하는 입력만 검증합니다. 런북과 변경 로그는 잘못된 입력과 실제 0 값의 구분을 계약으로 선언합니다.
amount:"0"이AMOUNT:0.00으로 저장되고 JDBC가 한 번 호출되는지 추가로 검증하세요.🤖 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 `@etl-service/src/test/java/com/xtrmetl/etl/service/EtlServiceAmountIntegrityTest.java` around lines 32 - 48, Extend the amount integrity tests around rejectsInvalidOrUnsupportedAmountsBeforeJdbc with a separate valid-zero case for amount "0". Verify processing succeeds, the persisted AMOUNT is 0.00, and jdbcTemplate is invoked exactly once, while keeping zero excluded from the rejection inputs.
🤖 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 `@docs/etl/bounded-atomic-batches.md`:
- Around line 47-48: 문서의 “첫 JDBC 호출 전” 계약이 적용되는 경로를 명시하세요. 현재
processDataIdempotently는 prepareBatch 전에 requestLock.tryLock 및
findStoredIdempotencyRecord를 호출하므로, 계약을 processData에만 제한한다면 문서에 그 범위를 분명히 적고, 멱등
요청에도 적용하려면 ledger 조회 전에 배치 검증을 수행하도록 processDataIdempotently 흐름을 변경한 뒤 잘못된
AMOUNT가 target write를 차단하는 테스트를 추가하세요.
In `@etl-service/src/main/java/com/xtrmetl/etl/service/EtlService.java`:
- Around line 403-415: Update the AMOUNT handling in transformValue to validate
the JSON node type before null or container values are returned, accepting only
numeric nodes and numeric strings and rejecting null, objects, arrays, and other
types with invalidRecord(). Add tests covering each rejected JSON type and valid
numeric inputs.
---
Nitpick comments:
In
`@etl-service/src/test/java/com/xtrmetl/etl/service/EtlServiceAmountIntegrityTest.java`:
- Around line 32-48: Extend the amount integrity tests around
rejectsInvalidOrUnsupportedAmountsBeforeJdbc with a separate valid-zero case for
amount "0". Verify processing succeeds, the persisted AMOUNT is 0.00, and
jdbcTemplate is invoked exactly once, while keeping zero excluded from the
rejection inputs.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c74b4d6a-dd5a-450c-9e91-66f131762054
📒 Files selected for processing (7)
CHANGELOG.mddocs/etl/bounded-atomic-batches.mdetl-service/src/main/java/com/xtrmetl/etl/service/EtlService.javaetl-service/src/test/java/com/xtrmetl/etl/documentation/EtlBatchDocsAlignmentTest.javaetl-service/src/test/java/com/xtrmetl/etl/service/EtlServiceAmountIntegrityTest.javaetl-service/src/test/java/com/xtrmetl/etl/service/EtlServiceBatchSafetyTest.javaetl-service/src/test/java/com/xtrmetl/etl/service/EtlServiceTest.java
|
@coderabbitai review |
Rate Limit Exceeded
|
Purpose
Preserve monetary data integrity at the synchronous ETL boundary. Invalid or unsupported
AMOUNTinputs fail closed instead of being converted into the legitimate value0.00; one invalid amount rejects the complete batch before anyprocessed_datatarget write.Exact current identity
develop@d6c6665163eabe1b5eca80556c6963bafd6b2625;repair/amount-integrity-feaea5d;3e58774a7517a7a359b6e7327b4c851d8e00c14e;dcd671488d6a72e886dd557816c18ed303668751without rewriting history;No predecessor-head check, review, or approval transfers to the current source head.
Implemented boundary
AMOUNTaccepts numeric JSON values and numeric strings only;INVALID_RECORD;0.00;processed_datawrites for the whole batch;BigDecimal, bounded precision/scale,HALF_UP, scale 2, andtoPlainString()remain the deterministic representation contract;Review remediation
The current source already addresses the CodeRabbit JSON-type finding with focused null, object, array, boolean, numeric, numeric-string, and genuine-zero tests. The latest documentation follow-up also resolves the remaining JDBC-order finding without changing replay semantics:
processed_datatarget write and no successful idempotency replay record;Both current review threads are resolved. A fresh exact-head independent review is still required.
Current verification state
Fresh exact-current-head CI, Dependency Review, CycloneDX SBOM, SAST Semgrep, and Security Scan were triggered by the review remediation. Pending or predecessor-head results are not accepted as passing.
Keep Draft until the unchanged exact head has terminal-success applicable checks, non-vacuous owned-production coverage, zero valid unresolved findings, and qualifying independent formal review where live governance requires it. Stale predecessor PR #310 remains historical until exact unique-work preservation and supersession are revalidated.