Skip to content

Commit 8ef486f

Browse files
committed
Name the rate-limit axis that actually binds
A missing rate-limit header reads as 0, and the label compared the two derived capacities directly, so whichever axis was absent won: with no TPM header and an RPM limit, `0 <= by_rpm` printed "TPM-bound" and would send someone to raise a quota that was never the constraint. `fits` already skipped zeros; only the label did not. Report the axis that produced `fits`, and say so explicitly when the other header is missing rather than implying both were read. Greptile flagged this and proposed `by_tpm and by_tpm <= by_rpm`, which fixes the absent-TPM case but still prints "RPM-bound" for the mirror case (a TPM limit and no RPM header), because the `and` short-circuits to the same branch.
1 parent 7cdbf26 commit 8ef486f

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

harness-engineering-bench/scripts/check_keys.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,17 @@ def main() -> int:
101101
by_tpm = tpm // RUN_TPM if tpm else 0
102102
by_rpm = rpm // RUN_RPM if rpm else 0
103103
fits = min(x for x in (by_tpm, by_rpm) if x) if (by_tpm or by_rpm) else 0
104-
bound = "TPM-bound" if by_tpm <= by_rpm else "RPM-bound"
104+
# Name the axis that actually produced `fits`. A missing header reads as
105+
# 0, so comparing the two directly would report whichever axis is absent
106+
# as the binding one and send someone to raise the wrong quota.
107+
if by_tpm and by_rpm:
108+
bound = "TPM-bound" if by_tpm <= by_rpm else "RPM-bound"
109+
elif by_tpm:
110+
bound = "TPM-bound (no RPM limit reported)"
111+
elif by_rpm:
112+
bound = "RPM-bound (no TPM limit reported)"
113+
else:
114+
bound = "no rate-limit headers reported"
105115
total += fits
106116
print(f"{path.name:28s} {fingerprint:10s} {tpm:12,} {rpm:10,} {fits:9d} {bound}")
107117

0 commit comments

Comments
 (0)