fix(kpi): reject malformed direct KPI input bytes - #123
Conversation
|
Warning Review limit reached
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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 |
Purpose
Test-first repair for #122. The direct
kpi:computeoperator must not calculate metrics from replacement-decoded malformed UTF-8 bytes.Exact current identity
mainc85d710804139c0697d7ef8fa47d02b1389e6d84;fix/compute-kpi-fatal-utf8;bef6d16f9c99da7a460e755dd51dc5aa0d9a7a2c;b93db0492bfe60866504a77aff2fea809fae732d;main, merge base exactly the live protected head;scripts/compute-kpi.mjs,test/compute-kpi-input-integrity.test.ts.RCA -> RED -> GREEN
Protected
scripts/compute-kpi.mjsusedfs.readFileSync(inputPath, "utf8"), so malformed retained bytes could be replacement-decoded before NDJSON parsing. A byte-invalid/exchangerecord 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:ci31443094646: terminal success;reviewer-ci31443094668: terminal success;Security Scan31443094743: terminal success;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