Skip to content

Rate regulator: release the keep count in keepCountSlices slices of the window (E93) - #118

Merged
talwgx merged 2 commits into
mainfrom
feat/e93-keep-count-slices
Oct 27, 2026
Merged

talwgx merged 2 commits into
mainfrom
feat/e93-keep-count-slices

Conversation

@talwgx

@talwgx talwgx commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Engineering ask E93, as ruled 2026-10-25 (D then B, keepCountSlices 4), revised per marketing/vp/REVIEW_E93_SLICES_2026-10-26.md. Needs log-10x/modules#159 (the declaration) and engine 1.1.152 (log-10x/l1x-inc#238). Not to merge until Tal says.

Change (keep blocks byte-identical: rate-object-cap.js:268-288, rate-object-lookup-cap.js:244-264)

  • One counter, rg_kc_<key>, the counter the mute path also counts on (rate-object-lookup-cap.js:173). In slice i = floor((now mod windowMs) x S / windowMs), a line passes while the counter is under the cumulative allowance floor(K x (i + 1) / S): 12, 25, 37, 50 for K = 50, S = 4. Mute and regulator lines share K per window, unused lines carry forward, and a window never passes more than K, whatever the sweep phase.
  • A line the keep test refuses hands its increment back (getAndInc(..., 0 - 1, windowMs)), as the rg_pas_ reservation does. Without it the counter counts lines tried: the review's sketch alone passed 12, 0, 0, 0, 12 on k5.
  • S = TenXMath.parseDouble(TenXEnv.get("rateReceiverKeepCountSlices", 4), 1), then floored. This is the rate objects' string-to-number idiom (TenXMath.parseDouble(keepRaw), rate-object-cap.js:208). Engine LongUtil.parseDouble (LongUtil.java:209-227) returns a number unchanged, parses a string and returns the default 1 otherwise. A value below 1 acts as 1.
  • rg_kx_ and the sample are unchanged. With S = 1, every decision is today's.

Gate: log10x/edge-10x:1.1.152 (sha256:ab3345e4)

case main fix
k5-slices, ERROR per minute FAIL 50,0,0,0,50 PASS 12,13,12,13,12
k6-slices-mute FAIL 50,0,0,0,50 PASS 12,13,12,13,12
k7-mute-ends (entry ends at +89 s) PASS 50,0,0,0,50 PASS 50,0,0,0,12 (before = previous head 015d155: FAIL, 87 in the window)
k8-slices-two (rateReceiverKeepCountSlices 2 on the command line) n/a PASS 25 / 25 / 25 per 120 s
d1-defaults ERROR (8+12 to 8+50) PASS 58 PASS 58 (replay in minute 4)
all 23 other cases PASS PASS, same counts

🤖 Generated with Claude Code

talwgx and others added 2 commits October 26, 2026 18:00
…he window (E93)

keepCountSlices (option rateReceiverKeepCountSlices, default 4, 1 = the
whole count at the window start) in both cap-file regulators: slice
floor((now mod window) x S / window) of a window passes floor(K / S)
keep-count lines of a held pattern, one more while the slice index is
under K mod S, on counter rg_kc_<key>_<slice> registered with the window
interval. The count per window stays K; rg_kx_ past the total and the
mute-entry path are unchanged. config.yaml adds the key; schema.json
carries the modules declaration.

tests/regulator: k5-slices and k6-slices-mute send a steady ERROR storm
over a full window and the next window's first minute and check the
lines kept per minute; paced cases start on a window edge (windows sit
on epoch multiples from engine 1.1.152, now the default image); k1, k4
and t1 run the fix with one slice, and d1 expects one slice's share.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…unter (E93 review)

Both cap-file regulators go back to the single counter rg_kc_<key>, which
the mute path also counts on, and compare it with floor(K x (i + 1) / S)
in slice i, so mute and regulator lines share K per window, unused lines
carry forward, and a window never passes more than K whatever the sweep
phase. A line the keep test refuses hands its increment back, as the
service-total reservation does, so the counter holds lines passed, not
lines tried. S goes through TenXMath.parseDouble with a default of 1 and
is floored, so a string, a fraction or a value below 1 cannot pass more
than K or switch slicing off silently. The keep blocks of the two files
are byte-identical.

tests/regulator: k5 and k6 expect 12, 13, 12, 13 and 12 a minute; k7 ends
the storm pattern's mute entry mid-window (at most 50 for the window);
k8 sets 2 slices on the command line (25 per half); d1 expects 8 + 12 to
8 + 50.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@talwgx
talwgx merged commit be3dccc into main Oct 27, 2026
6 checks passed
@talwgx
talwgx deleted the feat/e93-keep-count-slices branch October 27, 2026 00:43
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