Skip to content

test(lexitar): stop the leaf-regen spec racing the regen queue's depth - #28

Merged
pedalion-ci[bot] merged 1 commit into
devfrom
test/leaf-regen-queue-depth-flake
Oct 30, 2026
Merged

pedalion-ci[bot] merged 1 commit into
devfrom
test/leaf-regen-queue-depth-flake

Conversation

@pablo-tech

Copy link
Copy Markdown
Contributor

shell-leaf-regen.spec.ts's last assertion gave one treatmentAssessment post a 10 s wall-clock
budget, and that budget was competing with the background regen queue rather than with the app.
corpus-lane.ts serializes every unprompted regen through a single chained promise — a lane of one,
deliberately, because each such request can hold tens of megabytes of corpus in one Pages Function
isolate — and a fresh patient opens with every node stale, so each save in this test queues a sweep
ahead of the next one. By the final save the lane is deep and drains at whatever rate the machine is
loaded at.

Measured rather than guessed. The same commit failed this poll once in CI and once in a local
full-suite run, and passed in CI and locally on the next run with no code change in between. It also
passes every time the file is run alone, which is the queue being shallow rather than the logic being
different.

So wait for the queue to go quiet — no new post for a second — and only then measure. The poll after
it becomes a measurement of one round trip, which is what it was written to assert, and the final
groupPosts() === 1 gets stricter rather than looser: a second treatmentGroups arriving late
would previously have landed after the assertion read the count.

Why this branch and not the one the commit was written on. It was held off deliberately so it
could not reset the promotion soak clock a third time, and that promote has now landed
(tinytars/lexi #27, merged 2026-10-27). fix/dep-bumps-and-port-drift carried it, but that branch
predates #26 and merging it now would resurrect three deleted documents and revert the About copy
change — so the commit is cherry-picked onto current dev instead and that stale branch is not the
one proposed. One file, 33 lines added, nothing else differs from dev.

🤖 Generated with Claude Code

The last assertion in shell-leaf-regen.spec.ts gave one treatmentAssessment post
a 10 s wall-clock budget, and that budget was competing with the background regen
queue rather than with the app. corpus-lane.ts serializes every unprompted regen
through a single chained promise - a lane of one, deliberately, because each such
request can hold tens of megabytes of corpus in one Pages Function isolate - and
a fresh patient opens with every node stale, so each save in this test queues a
sweep ahead of the next one. By the final save the lane is deep, and it drains at
whatever rate the machine is loaded at.

Measured rather than guessed: the same commit failed this poll once in CI and once
in a local full-suite run, and passed in CI and locally on the next run with no
code change in between. It also passes every time the file is run alone, which is
the queue being shallow rather than the logic being different.

So wait for the queue to go quiet - no new post for a second - and only then
measure. The poll after it is now a measurement of one round trip, which is what
it was written to assert, and the final `groupPosts() === 1` gets stricter rather
than looser: a second treatmentGroups arriving late would previously have landed
after the assertion read the count.

Signed-off-by: Pablo Rodriguez <contact@promontory.studio>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 4bea70d)
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying health-dash-main with  Cloudflare Pages  Cloudflare Pages

Latest commit: dcd1a50
Status: ✅  Deploy successful!
Preview URL: https://f8d49e02.health-dash-prod.pages.dev
Branch Preview URL: https://test-leaf-regen-queue-depth.health-dash-prod.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying health-dash-dev with  Cloudflare Pages  Cloudflare Pages

Latest commit: dcd1a50
Status: ✅  Deploy successful!
Preview URL: https://b195c2aa.health-dash-aex.pages.dev
Branch Preview URL: https://test-leaf-regen-queue-depth.health-dash-aex.pages.dev

View logs

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test-only change; checked the settle helper's logic (first tick always resets, 200 ms intervals, 1 s quiet window, no false-positive on a never-incrementing counter), its placement between the groupPosts==1 assertion and the unrelated-save block, that draining the lane first can't invalidate the later assertions (the mocked {groups: []} merge already lands before the settle, and the final treatmentAssessment check reads treatment history, which background nodes don't touch), and that the corpus-lane.ts rationale in the comment matches the code (lane of one, shared with the corpus warmer). Non-blocking nit: the helper's 45_000 ms poll timeout exceeds the 30_000 ms per-test budget in playwright.config.ts:5, so it can never fire — a queue that never goes quiet will surface as an opaque "Test timeout of 30000ms exceeded" rather than this helper's own failure; worth lowering it (or adding test.setTimeout) so the diagnostic matches the intent.

@pedalion-ci
pedalion-ci Bot merged commit 03496b0 into dev Oct 30, 2026
17 checks passed
@pedalion-ci
pedalion-ci Bot deleted the test/leaf-regen-queue-depth-flake branch October 30, 2026 20:09
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