refactor: decompose rule decoders, and refactor permission decoding#8730
refactor: decompose rule decoders, and refactor permission decoding#8730jeffsmale90 wants to merge 6 commits intomainfrom
Conversation
…rom makePermissionDecoder.
…, just return the config.
…ions from return object
71e997b to
4d784ae
Compare
4d784ae to
98adc20
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f94844b. Configure here.
| if (rule.type === EXECUTION_PERMISSION_EXPIRY_RULE_TYPE) { | ||
| expiry = rule.data.timestamp as number; | ||
| } | ||
| } |
There was a problem hiding this comment.
Expiry now added to rules array, changing API output
Medium Severity
The expiryRule decoder now appends { type: 'expiry', data: { timestamp } } to the rules array of the decoded permission output. Previously, expiry was extracted internally and never surfaced in rules. This changes the shape of DecodedPermission returned to consumers — permissions with a TimestampEnforcer caveat now have a non-empty rules array where they previously had undefined. The PR description states "no functional change" and omits a changelog, but this is an observable API-level change that could affect downstream consumers checking rules.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit f94844b. Configure here.


Explanation
Refactor of permission decoding logic in order to:
decodersrather thanrules- rule is a highly overloaded term)no functional change, therefore no changelog required
References
Checklist
Note
Medium Risk
Refactors core permission-type identification/decoding logic to a new decoder architecture; while intended to be behavior-preserving, mistakes could change how caveats are matched/validated or which
rules/expiryvalues are surfaced to consumers.Overview
Refactors permission decoding to use
PermissionDecoders (and composable per-ruleRuleDecoders) instead of monolithicPermissionRules, updatingGatorPermissionsControllerand thedecodePermissionselection flow accordingly.Adds new composable rule decoders for expiry, redeemer, and payee (native and ERC-20), introduces a new
expiryrule type constant, and rewires all native/ERC-20 permission decoders to assemble these rule decoders while preserving existing validation of caveat terms.Removes the legacy
rules/implementation (makePermissionRule,createPermissionRulesForContracts) and updates/extends tests to cover the new decoder and rule-decoder behavior (including stricter payee caveat error cases and ensuring ERC20 revocation now returns an explicitexpiryrule inrules).Reviewed by Cursor Bugbot for commit 240c8cd. Bugbot is set up for automated code reviews on this repo. Configure here.