Fix: keep original pattern when no rule matches #7937
+1
−1
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.
Summary
This change preserves the original requested
patternwhenPermissionNext.evaluate()falls back to the defaultaskrule.Previously, the fallback rule always returned
pattern: "*", which could lead to misleading logs, debugging output, and UI display.Changes
patternwhen no permission rule matchesask)What does this PR do?
This PR improves the fallback behavior of PermissionNext.evaluate() when no permission rule matches.
Previously, when the evaluation logic fell back to the default ask rule, the returned result always used pattern: "*", regardless of the actual pattern requested by the caller. While the permission decision itself was correct, this behavior could lead to confusing or misleading information in logs, debugging output, and any UI components that rely on the evaluated permission result.
With this change, the fallback path now preserves the original caller-provided pattern, ensuring that the evaluation result more accurately reflects the real request context. Importantly, this PR does not change any permission decision logic — the system still defaults to ask when no rule matches — it only improves the correctness and clarity of the returned metadata.
How did you verify your code works?
When no permission rule matches, the evaluation result now returns the original input pattern instead of "*".