Skip to content

refactor(scripts): the argon2 measurement signs in through Plane's route - #146

Merged
aRustyDev merged 2 commits into
mainfrom
refactor/measure-argon2-on-compat
Nov 13, 2026
Merged

aRustyDev merged 2 commits into
mainfrom
refactor/measure-argon2-on-compat

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

Summary

scripts/measure-argon2.sh (spike 0003 K4, run by hand against a deployed Worker) posted to the slice's sign-in, which goes when the slice does. It now posts to Plane's POST /auth/sign-in/, with the same seed body and the same ?run= label. This is step 5a of moving off /api/_slice; it was the last caller outside the contract suite.

What changes besides the path

A miss is a different thing on Plane's route. It looks the email up before it hashes and answers an unknown one with a 400, where the slice's route hashed anyway, so the script's assumption that a miss costs the same one hash no longer holds. Measured on the native server at m=19456 t=2, 20 sign-ins each:

Sign-in Status p50
right password 200 15.9 ms
wrong password 400 15.8 ms
unknown email 400 0.9 ms
unknown email, slice route (old behaviour) 401 16.0 ms

So scripts/measure-argon2-summary.py counts CPU, wall and client time over the 200s only, and shows the CPU of the rest in a p50 miss column, which is a control (about a millisecond, not a hash). A request-1 miss prints - in the first column instead of nan.

Docs: G-26 in docs/src/testing/status.md records the move and drops the "still has to move" clause. research/0012-auth-slice.md §4 gets an "Amended 2026-11-13" note: the recorded table was taken against the slice route and stands un-re-run.

Verification

  • The script's seed and sign-in bodies, sent to a local native memory-adapter server: seed 204, sign-in 200 with both session cookies.
  • The summary on a synthetic five-case output directory, checked against hand-computed values, with main's summary as the failing control (it printed the burst's CPU p50 as 1.0 ms, which is the misses', and listed misses as measurements).
  • sh -n and dash -n on the script.

Not verified

  • No run on a deployed Worker. That needs CLOUDFLARE_ACCOUNT_ID and creates a KV namespace and two Workers on an account, so it was not run. The curl-config assembly was checked for syntax only; the one thing that changed in it is the URL path.
  • The burst is weaker on a re-run. It opens 16 separate connections, and the memory adapter's state is per isolate, so most land on an unseeded isolate and answer a cheap 400 (the recorded run found the user 1 time in 16 on the slice route). Seeding per burst client would fix it but doubles the hashes per connection, and cannot be tested without an account. The script header, G-26 and the research note say so.

Part of #58; this PR does not close it.

🤖 Generated with Claude Code

aRustyDev and others added 2 commits November 13, 2026 12:46
scripts/measure-argon2.sh (spike 0003 K4, run by hand against a deployed Worker) posted to the slice's sign-in, which goes when the slice does (issue #58). It posts to Plane's `POST /auth/sign-in/` now, with the same seed body and the same `?run=` label.

The move changes what a miss is. Plane's route looks the email up before it hashes and answers an unknown one with a 400, where the slice's route hashed anyway, so the script's assumption that a miss costs the same one hash no longer holds. Measured on the native server at m=19456 t=2, 20 sign-ins each: right password 15.9 ms (200), wrong password 15.8 ms (400), unknown email 0.9 ms (400); the slice's unknown email 16.0 ms (401). The summary therefore counts CPU, wall and client time over the 200s only, and shows the CPU of the rest as a control column. On a synthetic output directory of five cases the old summary printed the burst's CPU p50 as 1.0 ms, which is the misses'.

Not run on a deployed Worker: that needs an account and creates a KV namespace and two Workers. The figures recorded in research/0012 section 4 were taken against the slice's route and stand; the note and G-26 say so.

Refs: #58
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit af9e97e into main Nov 13, 2026
35 checks passed
@aRustyDev
aRustyDev deleted the refactor/measure-argon2-on-compat branch November 13, 2026 19:51
aRustyDev added a commit that referenced this pull request Nov 14, 2026
The owner reopened D-023 to check the Cloudflare cpuTime of the first
strength check, the one figure #170 left as a local proxy. This records
it, and changes no behaviour.

On Cloudflare, with the #146 harness (a tail consumer writes cpuTime to
KV), the first zxcvbn call in a fresh isolate costs a median 60.5 ms of
CPU above a cold start of about 25 ms (95% interval 54.5 to 64.0). A
warm check is 1 to 2 ms. 666 requests over 18 fresh Workers, two
requests that are both refused before any hashing, three arms (baseline
build, variant build, variant build with zxcvbn); all six variant-Z
rounds lie above all twelve S rounds. The 2 MiB bigger module costs a
cold start nothing measurable (cold medians 26 and 25 ms).

That misses the bar set before measuring (no more than one argon2 hash,
about 45 ms p50) by about 15 ms at the median. A first call blocks its
isolate, so concurrent requests start more isolates and each builds the
dictionaries again. The local figures understated the platform by 2 to
8 times.

One control did not behave as pre-registered: the first request of a
same-connection sequence on the S arms cost 0 to 45 ms where 0 was
expected, because the new connection sometimes reaches a fresh isolate.
The sequences are therefore not used for the figure, and the note says
why. A first pilot also showed that a redeploy leaks traffic to the
previous version for seconds, so the run uses a new Worker per round.
The 19 Workers and the KV namespace were deleted and checked.

The D-023 row and the doc comment on password_is_strong carry the figure.
D-023 is not changed: the rule stays as confirmed until the owner decides.

Refs: #44

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant