chore(flags): wait for the test server in rate-limit tests - #95854
Draft
posthog[bot] wants to merge 1 commit into
Draft
chore(flags): wait for the test server in rate-limit tests#95854posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
The rate-limiting integration tests posted to /flags immediately after spawning the server. If the spawned task failed during startup, the listener was dropped and the first request failed with a bare connection error, which gives no clue about the cause. Each test now polls /_readiness first. The readiness route is outside the rate-limited router, so it consumes no tokens. Generated-By: PostHog Desktop Task-Id: 4fc356bd-b80d-49db-8ac4-ed1418a38cec
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Contributor
Author
Contributor
🤖 CI report✅ Trunk lane — non-backend laneThis PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes. |
There was a problem hiding this comment.
Approved.
Test-only, additive change: adds an existing readiness-wait helper before the first request in 20 rate-limit tests, matching the description exactly. No risky territory touched, no outstanding comments or in-flight reviews.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 0L, 0F substantive, 20L/1F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T0 auto-approve: T0-deterministic (20L, 1F, single-area, chore) |
| stamphog 2.0.0b4 | .stamphog/policy.yml @ 124c132 · reviewed head 124c132 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
test_rate_limit_replenishmentwas quarantined again on 2026-09-07, so the /flags rate-limit guard no longer blocks a regression in CI./flagsright afterServerHandle::for_config_*, which starts the server intokio::spawn. No test in this file waits for the server.servereturns early and drops the listener. The first request then fails with a bare transport error and no assertion text — which is what the Trunk event for this test shows.Changes
rust/feature-flags/tests/test_rate_limiting.rscallsserver.wait_until_ready().awaitbefore its first request. The helper already existed and is used by four other test files.Server failed to become ready within 5 secondsinstead of a transport error, so the next flake names its own cause.How did you test this code?
Automated only. No manual product testing applies to a test-only change.
cargo test -p feature-flags --test test_rate_limiting— 20 passed.cargo test -p feature-flags --test test_rate_limiting test_rate_limit_replenishment— 8 consecutive runs, all passed.Failure-mode comparison, forced by removing a local startup asset
Server init fails in both runs. The difference is what the test reports.
client error (SendRequest)→connection error→Connection reset by peer (os error 104)Server failed to become ready within 5 secondsNot checked: whether Trunk clears the quarantine. That needs several green runs on master after this lands.
Automatic notifications
Docs update
None. The change touches test code only.
🤖 Agent context
Autonomy: Fully autonomous
gh pr list --state open --searchfortest_rate_limitingand for the flaky test name returned nothing.Created with PostHog Desktop from this inbox report.