Found by relay#38's cost measurement, and the first thing it ranked.
authenticate loads the device row to check that the token's cnf key
matches the identity key on file. poll then loaded the same row, by the same
primary key, microseconds later, for the revocation check that answers 410.
Two identical reads on the busiest route in the system, paid once per poll by
every phone with the app open.
authenticated now hands the row back alongside the caller, and poll uses
it. Measured: send-and-collect drops from ten database round trips to nine, a
poll from five to four. docs/COST.md carries the post-fix numbers.
The two checks stay two checks. They are not the same question — the
binding check asks whether this token's key matches what is registered, the
revocation check asks whether the device is registered at all, and it answers
410 rather than 401 because "sign in again" is the wrong instruction for a
device somebody has removed. What is shared is the row, not the decision.
The id comparison kept in the guard cannot fail today: the row was loaded
for the caller's device and the guard above already refuses anything else. It
is there so that reordering those two guards can never quietly turn this into
one device's registration standing in for another's.
The cost budgets were also tightened to sit near the measurements rather than
at double them — a ceiling of twenty against a measured ten would not have
caught the doubling it exists to catch.
631 relay tests in 56 suites green, core paths 7/7.
Found by relay#38's cost measurement, and the first thing it ranked.
`authenticate` loads the device row to check that the token's `cnf` key
matches the identity key on file. `poll` then loaded the same row, by the same
primary key, microseconds later, for the revocation check that answers 410.
Two identical reads on the busiest route in the system, paid once per poll by
every phone with the app open.
`authenticated` now hands the row back alongside the caller, and `poll` uses
it. Measured: send-and-collect drops from ten database round trips to nine, a
poll from five to four. docs/COST.md carries the post-fix numbers.
The two checks stay two checks. They are not the same question — the
binding check asks whether this token's key matches what is registered, the
revocation check asks whether the device is registered at all, and it answers
410 rather than 401 because "sign in again" is the wrong instruction for a
device somebody has removed. What is shared is the row, not the decision.
The id comparison kept in the guard cannot fail today: the row was loaded
for the caller's device and the guard above already refuses anything else. It
is there so that reordering those two guards can never quietly turn this into
one device's registration standing in for another's.
The cost budgets were also tightened to sit near the measurements rather than
at double them — a ceiling of twenty against a measured ten would not have
caught the doubling it exists to catch.
631 relay tests in 56 suites green, core paths 7/7.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found by relay#38's cost measurement, and the first thing it ranked.
authenticateloads the device row to check that the token'scnfkeymatches the identity key on file.
pollthen loaded the same row, by the sameprimary key, microseconds later, for the revocation check that answers 410.
Two identical reads on the busiest route in the system, paid once per poll by
every phone with the app open.
authenticatednow hands the row back alongside the caller, andpollusesit. Measured: send-and-collect drops from ten database round trips to nine, a
poll from five to four. docs/COST.md carries the post-fix numbers.
The two checks stay two checks. They are not the same question — the
binding check asks whether this token's key matches what is registered, the
revocation check asks whether the device is registered at all, and it answers
410 rather than 401 because "sign in again" is the wrong instruction for a
device somebody has removed. What is shared is the row, not the decision.
The id comparison kept in the guard cannot fail today: the row was loaded
for the caller's device and the guard above already refuses anything else. It
is there so that reordering those two guards can never quietly turn this into
one device's registration standing in for another's.
The cost budgets were also tightened to sit near the measurements rather than
at double them — a ceiling of twenty against a measured ten would not have
caught the doubling it exists to catch.
631 relay tests in 56 suites green, core paths 7/7.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
assigned to @paulhitt
deleted the
feat/measure-conversation-costbranch. This merge request now targets themainbranchmentioned in commit
199a474b5dchanged the description