Repository navigation
fix(approvals): replace the opposite rule when one is set - #2149
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
[Medium impact] The PR appears safe to merge; all previous findings are addressed and no new actionable issues remain. Findings
SummarySetting an approval rule now replaces the opposite effect through one shared helper.
All three previous findings are addressed. No new actionable issues were found.
|
…ze opposite saves
This branch was previously deployed
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.
Why
With a
require_approvalrule on a tool, every call shows a card offering "Always allow this tool". Tapping it saved analways_allowrule next to the existing one. Two rules on the same tool resolve to ask, so the card came back on every later call, and the rule list showed both effects for one tool.What changed
A tool, site, connector or category now has one rule effect per user and space. Setting one effect, from the card's "Always allow" button or from
approvalRules.set, deletes the opposite rule in the same transaction, through one shared helper. The delete ignores case, as rule matching does (compared literally, so_in a tool name is not a wildcard), and an advisory lock on the match keeps two opposite saves at once from both landing. No migration: existing pairs are fixed the next time either rule is set.How tested
A new journey test against Postgres sets
require_approval(in mixed case), answers a card with "Always", checks that the next call runs without a card and that the list holds onlyalways_allow, then setsrequire_approvalagain and checks the list holds only that. A second saves opposite rules on several matches at once and checks each keeps one, and a third checks that replacingtool_aleaves a rule ontoolXaalone. Each fails without the change. The answer unit test now checks the delete. Lint and typecheck pass; the unit suite passes except the backup script tests, which fail the same way on main on macOS.