Skip to content

fix(kpi): reject malformed direct KPI input bytes - #123

Closed
seonghobae wants to merge 2 commits into
mainfrom
fix/compute-kpi-fatal-utf8
Closed

fix(kpi): reject malformed direct KPI input bytes#123
seonghobae wants to merge 2 commits into
mainfrom
fix/compute-kpi-fatal-utf8

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Purpose

Test-first repair for #122. The direct kpi:compute operator must not calculate metrics from replacement-decoded malformed UTF-8 bytes.

Exact current identity

  • protected/live base: main c85d710804139c0697d7ef8fa47d02b1389e6d84;
  • branch: fix/compute-kpi-fatal-utf8;
  • RED head: bef6d16f9c99da7a460e755dd51dc5aa0d9a7a2c;
  • GREEN/current head: b93db0492bfe60866504a77aff2fea809fae732d;
  • current compare: 2 commits ahead / 0 behind main, merge base exactly the live protected head;
  • changed paths: scripts/compute-kpi.mjs, test/compute-kpi-input-integrity.test.ts.

RCA -> RED -> GREEN

Protected scripts/compute-kpi.mjs used fs.readFileSync(inputPath, "utf8"), so malformed retained bytes could be replacement-decoded before NDJSON parsing. A byte-invalid /exchange record could therefore still contribute to request, failure and latency metrics.

The RED regression writes that exact byte-invalid shape and requires non-zero process status, no metric output and an explicit invalid-UTF-8 diagnostic. A separate valid fixture pins existing metric behavior and the policy of ignoring syntactically non-JSON lines.

GREEN reads exact bytes and decodes them with TextDecoder("utf-8", { fatal: true }) before line or JSON semantics. Malformed text fails closed before metric computation. Existing route/status/latency semantics are unchanged.

Exact current-head proof

For unchanged current head b93db0492bfe60866504a77aff2fea809fae732d:

  • application ci 31443094646: terminal success;
  • reviewer-ci 31443094668: terminal success;
  • eligible central Security Scan 31443094743: terminal success;
  • formal reviews: 0;
  • inline review threads: 0;
  • GitHub reports the PR Ready and mergeable.

CodeRabbit was rate-limited on this exact base/head; that is non-passing model/review evidence and not approval.

Authority boundary

This changes only the direct KPI computation input-decoding boundary. It does not establish production provenance, prove a 30-day KPI window, modify #105's strict provenance/snapshot work, publish a release, deploy, select an outbound license, or create acquisition-readiness evidence. Technical GREEN cannot substitute for live #27 governance or qualifying independent non-author formal approval under #29.

Related: #3, #27, #29, #104, #105, #118, #120, #122

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f3fff002-6f2a-4668-9855-7a9f6e883dfc

📥 Commits

Reviewing files that changed from the base of the PR and between c85d710 and b93db04.

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

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.

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