fix: deflake //rs/tests/boundary_nodes:rate_limit_canister_test#9706
Open
basvandijk wants to merge 3 commits intomasterfrom
Open
fix: deflake //rs/tests/boundary_nodes:rate_limit_canister_test#9706basvandijk wants to merge 3 commits intomasterfrom
basvandijk wants to merge 3 commits intomasterfrom
Conversation
Use nns_agent (direct to NNS node) instead of api_bn_agent for Step 9's set_rate_limit_rules call. The call adds a self-blocking rule for the rate-limit canister. With api_bn_agent, call_and_wait() first submits the update, then polls read_state for the result. If the API boundary node picks up the new self-blocking rule before polling completes, the poll is rejected with 403 Forbidden, causing a flaky failure. The nns_agent bypasses the API boundary node entirely, avoiding this race condition. Step 11 already used nns_agent for the same reason.
Contributor
There was a problem hiding this comment.
Pull request overview
Deflakes the boundary-node rate limit canister test by avoiding a race where call_and_wait() polls through the API boundary node after the canister has applied a self-blocking rule, causing intermittent 403s during the polling phase.
Changes:
- Switch Step 9
set_rate_limit_rulesto use annns_agent(direct to an NNS node) instead ofapi_bn_agentto avoid thecall_and_wait()polling race. - Move
nns_agentinitialization earlier and reuse it later (Step 11), removing the duplicate agent construction.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
The suggested change just bypasses the API BN. The test is there to ensure that we can make calls through the API BN. While the suggested fix makes the test pass, it makes the test less useful. I think we can improve the test by just adding some retries. Most likely there is some race condition (making the call vs. removing rate-limits). |
…it_canister_test-2026-04-01
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.
The
//rs/tests/boundary_nodes:rate_limit_canister_testflaked in Step 9 with:Root Cause
In Step 9,
set_rate_limit_ruleswas called viaapi_bn_agent(API boundary node agent) usingcall_and_wait(). This works in two phases:read_statefor the result → API BN may have already picked up the new self-blocking rule → returns 403 ForbiddenThis is a race condition: the self-blocking rule can be applied and picked up by the API boundary node between the call and the polling phases.
Fix
Use
nns_agent(direct to NNS node, bypassing the API boundary node) for Step 9, just like Step 11 already does.This PR was created following the steps in
.claude/skills/fix-flaky-tests/SKILL.md.