Skip to content

fix(analytics): reject invalid KPI numeric evidence - #389

Closed
seonghobae wants to merge 2 commits into
mainfrom
fix/kpi-snapshot-numeric-validity-main-20260812
Closed

fix(analytics): reject invalid KPI numeric evidence#389
seonghobae wants to merge 2 commits into
mainfrom
fix/kpi-snapshot-numeric-validity-main-20260812

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Objective

Advance issue #329 by making persisted KPI evidence fail closed when a ledger line contains non-finite/out-of-range conversion rates or negative preview latency. Keep the public invalid-line failure controlled and free of persisted line contents.

Test-first state

This Draft starts intentionally RED at exact test-only head 533dffaa83b91c1859d1ffc668e12cac60388d2e, directly based on protected main 55d7ae8647208e301f282350f076eeddaba61d11.

KpiSnapshotLedgerTest.rejectsNonFiniteOrOutOfRangePersistedKpiEvidence requires replay rejection for NaN, positive/negative infinity, rates outside [0,1], and negative p95 latency. Protected main currently delegates to Double.parseDouble/Long.parseLong, so these structurally parseable invalid values are expected to reach the record instead of failing closed.

Scope

Bounded data-integrity repair under #329. It does not change KPI denominator semantics (#327/#328), tenant-query isolation (#326/#342), canonical documentation owned by #305, or other analytics contracts.

Acceptance

Observe exact-head RED, apply the smallest parse-boundary validation, then require focused/full mvn -B --no-transfer-progress verify, exact 100% owned production line/branch coverage, warning-free public Javadocs, CI/Security Scan/SAST/fuzz, zero valid unresolved findings, fresh exact-head/live-base identity, and qualifying independent approval where live protection requires it.

Summary by CodeRabbit

  • 버그 수정

    • KPI 데이터의 비율 값이 유효한 범위(0~1)인지 검증합니다.
    • 음수 KPI 증거 값과 비유한 값을 잘못된 데이터로 처리합니다.
    • 잘못된 입력에 대해 보다 정확한 오류를 제공합니다.
  • 테스트

    • 비유한 값, 허용 범위를 벗어난 값, 음수 값에 대한 검증을 추가했습니다.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e2c08ae-2314-4fef-b18f-2477a8256536

📥 Commits

Reviewing files that changed from the base of the PR and between 55d7ae8 and 8a06267.

📒 Files selected for processing (2)
  • src/main/java/com/clearfolio/viewer/analytics/KpiSnapshotLedger.java
  • src/test/java/com/clearfolio/viewer/analytics/KpiSnapshotLedgerTest.java

📝 Walkthrough

Walkthrough

KPI snapshot ledger가 ratenullableLong의 잘못된 값을 거부하도록 변경되었습니다. 테스트는 비유한율, 허용 범위 위반, 음수 p95 값 및 오류 메시지를 확인합니다.

Changes

KPI 증거 값 검증

Layer / File(s) Summary
Ledger 입력 검증 및 테스트
src/main/java/com/clearfolio/viewer/analytics/KpiSnapshotLedger.java, src/test/java/com/clearfolio/viewer/analytics/KpiSnapshotLedgerTest.java
rate가 유한하며 0.0~1.0 범위인지 확인합니다. nullableLong이 음수가 아닌지 확인합니다. 잘못된 ledger 라인과 오류 메시지를 테스트합니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • 이슈 329: KpiSnapshotLedger.ratenullableLong의 KPI 증거 값 검증 요구를 구현하고 관련 테스트를 추가했습니다.
🚥 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 제목은 KPI 숫자 증거의 잘못된 값을 거부하는 주요 변경 사항을 정확하고 간결하게 설명합니다.
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.
✨ 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 fix/kpi-snapshot-numeric-validity-main-20260812

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.

@seonghobae
seonghobae marked this pull request as ready for review August 11, 2026 17:09
@seonghobae
seonghobae enabled auto-merge (squash) August 11, 2026 19:40
@seonghobae seonghobae closed this Aug 12, 2026
auto-merge was automatically disabled August 12, 2026 09:36

Pull request was closed

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