fix(kpi): reject malformed threshold input bytes - #127
Conversation
|
Warning Review limit reached
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 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 #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
mainc85d710804139c0697d7ef8fa47d02b1389e6d84;fix/check-kpi-fatal-utf8;85a9ce68f346a4281b539bcc45df607a6e4ea66d;85463e4e18750af27aac8ea35ee1680e7b360661;main, merge base exactly the live protected head;scripts/check-kpi.mjs,test/check-kpi-input-integrity.test.ts.RCA -> RED -> GREEN
Protected
scripts/check-kpi.mjsusedawait fs.readFile(inputPath, "utf8"), so malformed retained bytes could be replacement-decoded before JSON parsing. A byte-invalid/exchangerecord could therefore influence failure-rate, p95 latency and required-window semantics.The RED regression injects malformed UTF-8 into an otherwise valid
/exchangerecord 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:ci31443518948: terminal success;reviewer-ci31443518901: terminal success;Security Scan31443518918: terminal success;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