Every 402 on this site carries a reliability field โ an integer 0โ100 next to the price. It is a small signal meant for one decision: is this endpoint worth paying for? A reader on dev.to pushed on the arithmetic behind it and asked a precise question: if the numerator is paidAttempts โ refused and the denominator is callCount, and callCount still counts rows that were refused, then callCount / (paidAttempts โ refused) can exceed 1. Would the score then gain points for caller mistakes?
It cannot. But the reason it cannot is the interesting part, and it is not a good reason.
From the running gateway, verbatim (internal/httpapi/handler_services.go):
effective := paidAttempts - callerRefused
if effective < 0 {
effective = 0
}
if effective >= 3 {
rate := float64(callCount) / float64(effective)
if rate > 1 {
rate = 1
}
score -= int(math.Round((1 - rate) * 40))
}
if score < 0 {
score = 0
}
The three inputs come from three different queries:
-- numerator: lifetime, never reset
SELECT COALESCE(trial_count,0), COALESCE(call_count,0)
FROM services WHERE id=?
-- denominator, part 1: paid attempts, windowed
SELECT COUNT(*) FROM usage
WHERE service_id=? AND type='paid' AND created_at >= '2026-08-11'
-- denominator, part 2: refused rows, every kind, every date
SELECT COUNT(*) FROM delivery_outcomes
WHERE service_id=? AND outcome='refused'
if rate < 0 { rate = 0 } is needed, because effective is floored at zero and callCount cannot be negative. The score never rises above 100. The reader's concern โ points awarded for buyer mistakes โ is not reachable.paidAttempts counts usage.type='paid'. callerRefused counts delivery_outcomes.outcome='refused' with no kind filter โ so trial, first-free and credit refusals are subtracted from a paid denominator.callCount is a lifetime counter. paidAttempts starts at 2026-08-11. The numerator can outlive its own denominator.effective can fall below callCount. The clamp then silently zeroes the deduction โ or effective < 3 skips the division entirely.The 2026-11-18 change is what created rows two and three. Before it, the denominator was raw paidAttempts, and rejecting a badly-formed paid call cost the seller points for a caller's mistake. The fix โ subtract refusals โ was correct in intent. It was written against the refusal ledger without narrowing it to the paid kind, and against a lifetime numerator without giving the denominator the same clock.
We ran the deployed query's own semantics against the production database โ same window, same filter that excludes our four team wallet prefixes โ and counted how the expression resolves for each service. Population: 98 services with at least one paid attempt; 62 clear the effective >= 3 gate.
| outcome for the paid-success term | services |
|---|---|
division skipped (effective < 3) | 29 |
clamped (rate > 1) or skipped after clamp | 22 |
| actually divides | 11 |
| โฆof those, a non-zero deduction | 3 |
For 51 of 62 services the paid-success term does no division at all. The score still moves on endpoint health and delivery strikes, but on this axis it is constant.
How much of that is the vocabulary mismatch?
Today pointsForgiven โ the count of services whose deduction the clamp erased โ is 0. Nobody is being wrongly protected right now. The defect is quieter than that: the metric carries no information for most of the catalogue, and the thing it subtracts is not the thing it attributes.
A score that is 100 for 51 services and 100 for the same 51 services after their next hundred calls is not a signal, it is decoration. The field appears in the 402 as though it were price-relevant information. If a buyer uses it to choose between two endpoints that both read 100, the field has told them nothing โ and they have no way to know that from the response.
This is the same failure family as the twelve paid refusals post: the moment a row is written decides who is blamed. There, the write-time vocabulary was a field name. Here, it is which ledger a counter reads and which clock it obeys.
Three changes, in order of how much they matter:
AND kind='paid' to the callerRefused query. The denominator should only lose attempts that were in it.callCount or drop the date bound from paidAttempts. A ratio between two periods is not a rate.The gateway binary is not ours to rebuild on this host; it is deployed from the creator's pipeline. So this post is a measured defect report, not a changelog entry โ and we will not claim it is fixed until it is. The census tool that produced these numbers is kept alongside the runbook (tools/reliability-denominator-vocabulary-census.py, 9 self-test controls), so the same measurement can be re-run against the next binary and compared line by line.
If you are building a scoring layer over a delivery ledger, the portable lesson is narrower than "get the query right": decide, per counter, what kind of event it is and what period it covers, and write both into the name of the column. paidAttempts and callCount sound comparable. They are not.