Skip to content

fix(kpi): reject malformed threshold input bytes - #127

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

fix(kpi): reject malformed threshold input bytes#127
seonghobae wants to merge 2 commits into
mainfrom
fix/check-kpi-fatal-utf8

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Purpose

Test-first repair for #126. KPI threshold and window checks must fail closed on malformed retained UTF-8 rather than calculate PASS/FAIL metrics from replacement-decoded bytes.

Exact current identity

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

RCA -> RED -> GREEN

Protected scripts/check-kpi.mjs used await fs.readFile(inputPath, "utf8"), so malformed retained bytes could be replacement-decoded before JSON parsing. A byte-invalid /exchange record could therefore influence failure-rate, p95 latency and required-window semantics.

The RED regression injects malformed UTF-8 into an otherwise valid /exchange record and requires a non-zero result before metric output. A separate valid fixture pins existing threshold semantics and the policy of ignoring syntactically non-JSON/non-Noema lines.

GREEN reads exact bytes and decodes with TextDecoder("utf-8", { fatal: true }) before line, JSON or time-window semantics. Malformed bytes fail closed without KPI output. Threshold, route, latency and timestamp behavior are otherwise unchanged.

Exact current-head proof

For unchanged current head 85463e4e18750af27aac8ea35ee1680e7b360661:

  • application ci 31443518948: terminal success;
  • reviewer-ci 31443518901: terminal success;
  • eligible central Security Scan 31443518918: 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 review evidence and not approval.

Dependency / authority boundary

This is distinct from #122/#123 (kpi:compute) and #104/#105 (strict provenance/snapshot orchestration). Exact-byte provenance does not make lossy semantic decoding safe, and this PR does not modify #105's branch. It does not establish real production KPI provenance or a 30-day operating window, publish a release, deploy, select an outbound license, or create acquisition-readiness evidence. Technical GREEN cannot replace live #27 governance or qualifying independent non-author formal approval under #29.

Related: #3, #27, #29, #104, #105, #122, #123, #126

@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: 33 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: e8a23aff-6f73-4bd6-a41e-3a9d7402ef9c

📥 Commits

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

📒 Files selected for processing (2)
  • scripts/check-kpi.mjs
  • test/check-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