Repository navigation
node: build the facts-limit test rules without the parser - #845
Merged
aojea merged 1 commit intoNov 1, 2026
Merged
Conversation
authorizerFactLimitRules parsed its 1100 rules one by one, and biscuit-go's parser.FromStringRule builds a new grammar on every call. Under the race detector that took about 12s, inside the 15s context of TestCallMCPTool_ProviderNotGrantedIsNotRetried, so on a busy runner the second tool call ran out of time and failed with "context deadline exceeded" instead of the facts limit. Build the same rules as biscuit.Rule values. The authorizer evaluates exactly the same rules, so both tests still stop at the facts limit.
Contributor
There was a problem hiding this comment.
Code Review
This pull request optimizes the 'authorizerFactLimitRules' test helper by programmatically constructing 'biscuit.Rule' structs instead of parsing them from strings. This avoids rebuilding the grammar for each of the 1100 rules, which previously caused test timeouts under the race detector. I have no further feedback to provide as there are no review comments to evaluate.
Collaborator
|
Thanks for the prompt response, appreciate it |
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.
Fixes the flaky
TestCallMCPTool_ProviderNotGrantedIsNotRetriedreported on #832, introduced by #842.authorizerFactLimitRulesparsed its 1100 rules one by one, and biscuit-go'sparser.FromStringRulebuilds a new grammar on every call. Under-racethat took about 12s, inside the test's 15s context, so on a busy runner the second tool call ran out of time (context canceled during retry/failed to open stream: timed out) before it reached the facts limit.This builds the same rules as
biscuit.Rulevalues. The authorizer evaluates the same rules, so both tests that use the helper still stop atdatalog.ErrWorldRunLimitMaxFacts. No timeout is changed.Measured in Docker (
golang:1.26, 2 CPUs,-race):TestCallMCPTool_ProviderNotGrantedIsNotRetriedTestLabelGateTellsAuthorizerLimitFromDeniedstress -p 4on both testsBoth tests still fail when
checkProviderreports a facts limit asErrProviderNotGrantedagain.go test -race ./internal/node/ ./internal/identity/andgolangci-lintv2.14.0 pass.