feat: build policy simulation sandbox modal for testing transaction rules - #105
Merged
Cjay-Cyber-2 merged 2 commits intoSep 1, 2026
Conversation
…ules Closes ASTROIDX556#58 - Add simulator utility (src/features/policies/utils/simulator.ts) with pure evaluation logic for testing transactions against PolicyRule objects - Add PolicySandboxModal component with React Hook Form + Zod validated inputs for recipient address, amount, and asset type - Support multi-select rule picker with per-rule pass/fail evaluation - Display detailed violation messages and summary with compliance badge - Use existing Dialog component for accessible modal (focus trap, Escape, overlay dismissal) - Export new components from policies feature index
|
@feyibosslady is attempting to deploy a commit to the Cjay's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@feyibosslady Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Needs review Linked to The pull request includes unrequested wallet feature files which are out of scope for issue #58. Reviewed commit: |
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.
Closes #58
Description
Before enforcing spending policies on live AI agents, administrators need a simulation sandbox to test hypothetical transactions against existing Zod-validated rule sets and see whether they pass or trigger approval workflows.
This PR adds a Policy Sandbox Modal where users can input test transaction parameters (recipient address, amount, asset type), select which spending policy rules to evaluate, and run simulations to see clear pass/fail results with detailed violation messages.
Changes
New files:
src/features/policies/utils/simulator.ts— Pure evaluation utility that tests a transaction againstPolicyRuleobjects. Supports all rule fields (Transaction Amount,Asset Identifier,Destination Target,Approved Account Whitelist) and operators (equals,greater_than,less_than,contains,in_whitelist).src/features/policies/components/PolicySandboxModal.tsx— Accessible modal component with:Dialogcomponent for accessibility (focus trap, Escape key, overlay dismissal)Modified files:
src/features/policies/index.ts— ExportsPolicySandboxModalandsimulateTransactionAcceptance Criteria
src/features/policies/components/PolicySandboxModal.tsxDialogcomponent)npm run typecheck&&npm run lint(new files pass cleanly; pre-existing errors intransactions/page.tsxare unrelated)Testing & Validation
npm run typecheckandnpm run lintpass for the new files