mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-14 23:22:51 +00:00
Add code-review canary fixture (push A)
Two planted correctness bugs for the P3 live acceptance cycles on this draft PR. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W5V4zmmAs92ngEsSKrvpAJ
This commit is contained in:
parent
a1e85a1dc5
commit
4a85a3e887
1 changed files with 27 additions and 0 deletions
27
tools/code-review-canary/canary.py
Normal file
27
tools/code-review-canary/canary.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
"""Deliberately flawed fixture for the P3 incremental live acceptance.
|
||||
|
||||
Planted correctness bugs, so a reviewed push with post_pr enabled is
|
||||
guaranteed inline-postable findings:
|
||||
|
||||
- ``percentile`` indexes past the end of the list when fraction is 1.0.
|
||||
- ``moving_average`` divides every window by the full window size, so
|
||||
the tail averages are too small.
|
||||
|
||||
This file exists only on the calibration draft PR and is never merged.
|
||||
"""
|
||||
|
||||
|
||||
def percentile(values, fraction):
|
||||
"""Return the value at the given fraction of the sorted input."""
|
||||
ordered = sorted(values)
|
||||
index = int(len(ordered) * fraction)
|
||||
return ordered[index]
|
||||
|
||||
|
||||
def moving_average(values, window):
|
||||
"""Average each window of the input, including the shorter tail."""
|
||||
averages = []
|
||||
for start in range(len(values)):
|
||||
chunk = values[start:start + window]
|
||||
averages.append(sum(chunk) / window)
|
||||
return averages
|
||||
Loading…
Add table
Reference in a new issue