Skip to content

fix(kpi): restack fatal UTF-8 threshold input on current main - #210

Merged
seonghobae merged 2 commits into
mainfrom
fix/check-kpi-fatal-utf8-current-main-v2
Aug 12, 2026
Merged

fix(kpi): restack fatal UTF-8 threshold input on current main#210
seonghobae merged 2 commits into
mainfrom
fix/check-kpi-fatal-utf8-current-main-v2

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fresh protected-main successor for #127 on exact base 15e47db4c4429df3a64d9e5eefb77f9d7598eaf1. No predecessor checks, reviews, scanner output, model judgment, KPI production evidence, or acquisition evidence transfers.

Test-first RED head 6931f55403f51d0b0db8900c20fba77c10866136 adds only the executable malformed-UTF-8 and valid-threshold regressions. Protected scripts/check-kpi.mjs still decodes retained bytes with readFile(..., "utf8"), so malformed bytes can replacement-normalize before threshold/window semantics.

After exact RED proof, the bounded GREEN is to read exact bytes and decode with fatal UTF-8 before line/JSON semantics, preserving threshold, window, route, and non-JSON filtering behavior.

Historical #127 remains open until this successor proves and integrates the complete two-file contract.

Summary by CodeRabbit

  • 버그 수정

    • KPI 로그 처리 시 UTF-8 인코딩을 명시적으로 적용했습니다.
    • 잘못된 UTF-8 입력이 있으면 KPI 계산 전에 오류를 표시하고 안전하게 종료합니다.
  • 테스트

    • 유효한 로그, 비JSON 데이터, 비대상 경로 및 잘못된 인코딩 입력에 대한 검증을 추가했습니다.

@coderabbitai

coderabbitai Bot commented Aug 12, 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: 9021e611-5328-41ff-84eb-68de81a46744

📥 Commits

Reviewing files that changed from the base of the PR and between 15e47db and ee47f52.

📒 Files selected for processing (2)
  • scripts/check-kpi.mjs
  • test/check-kpi-input-integrity.test.ts

📝 Walkthrough

Walkthrough

KPI 검사 스크립트가 로그를 fatal UTF-8로 디코딩합니다. 잘못된 입력은 오류와 함께 종료합니다. 통합 테스트는 잘못된 입력과 유효한 KPI 로그 처리를 검증합니다.

Changes

KPI 입력 무결성

Layer / File(s) Summary
엄격한 UTF-8 디코딩
scripts/check-kpi.mjs
로그를 바이트로 읽고 TextDecoder의 fatal UTF-8 디코딩을 적용합니다. 디코딩 실패 시 파일 경로를 포함한 오류를 출력하고 종료합니다.
입력 무결성 통합 검증
test/check-kpi-input-integrity.test.ts
subprocess로 malformed UTF-8 로그의 사전 거부와 stderr 출력을 검증합니다. 비JSON 라인을 무시하는 유효 입력의 KPI 결과와 임시 파일 정리를 검증합니다.

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

Possibly related issues

Possibly related PRs

  • ContextualWisdomLab/noema#121: 다른 스크립트와 코드 경로에서 strict UTF-8 디코딩 및 malformed 입력 거부 테스트를 추가합니다.

Sequence Diagram(s)

sequenceDiagram
  participant Test
  participant check_kpi_mjs
  participant KPI_Log
  Test->>KPI_Log: 임시 NDJSON 로그 생성
  Test->>check_kpi_mjs: subprocess 실행
  check_kpi_mjs->>KPI_Log: 로그 바이트 읽기
  check_kpi_mjs-->>Test: malformed 입력은 stderr 오류와 실패 상태 반환
  check_kpi_mjs-->>Test: 유효 입력은 KPI 결과와 성공 상태 반환
Loading
🚥 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 입력의 치명적 UTF-8 처리 변경을 나타내며 PR의 주요 변경 내용과 관련됩니다.
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/check-kpi-fatal-utf8-current-main-v2

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 12, 2026 06:14
@seonghobae
seonghobae merged commit 5addf7f into main Aug 12, 2026
16 checks passed
@seonghobae
seonghobae deleted the fix/check-kpi-fatal-utf8-current-main-v2 branch August 12, 2026 06:17
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