Commit 378561c
fix(node): a test about arithmetic was failing on a timeout
"never exceeds the configured ceiling" made 400 sequential Durable Object
round-trips to drive proof-of-work difficulty past its cap. Reaching the cap
takes 24 — one bit per CREATES_PER_EXTRA_BIT creates, over six bits of headroom
— so the loop was sixteen times longer than the property needed, and slow
enough that a loaded runner blew vitest's 5s default.
Same signature as defect 45: green on CI, red on Deploy staging, same commit.
Two workflows running one suite on differently-loaded runners is the only thing
that separates a test whose runtime decides the result from one whose logic
does.
The number was 400 because CREATES_PER_EXTRA_BIT was module-private, so the
test could not compute the real bound and reached for one comfortably past it.
Exporting it makes the loop derived: (ceiling - floor) * perBit * 2. That is 48
hops instead of 400, 375ms instead of a timeout, and it stays correct if either
bit setting changes — which the magic number did not.
Raising the timeout would have been the wrong fix: it keeps a test that takes
seconds to assert min(a, b), and moves the threshold rather than the cause.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ND8DWQLFchUayY5xeP6vb1 parent 909d67b commit 378561c
3 files changed
Lines changed: 37 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
| 254 | + | |
253 | 255 | | |
254 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
255 | 263 | | |
256 | 264 | | |
257 | | - | |
| 265 | + | |
258 | 266 | | |
259 | 267 | | |
260 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
925 | 925 | | |
926 | 926 | | |
927 | 927 | | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
928 | 947 | | |
929 | 948 | | |
930 | 949 | | |
| |||
0 commit comments