feat(actions): resolve select-all selections for approval-required actions - #374
Conversation
…tions When an approval-required action is triggered on a "select all" selection, resolve it to concrete record ids and return them through CustomActionRequiresApprovalError (data.recordIds), so the frontend can store the full target set in the approval request. The resolution is capped by the new max_records_for_approval setting (default 500, matching the Forest server's authoritative cap); above it the trigger is rejected with ApprovalSelectionTooLargeError (422). The error data now also carries roleIdsAllowedToApprove, the key the frontend reads for the approver roles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (1)
🛟 Help
|
…nd clamp the cap The checker already holds the collection, caller and filter, so resolving the selection there removes the resolver threading through Permissions#can_smart_action? and the checker constructor (their signatures are back to the original ones). max_records_for_approval is now clamped to the Forest server's authoritative cap of 500 instead of trusting the configured value. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A global action targets no specific records: resolving (and capping) the selection would reject a previously-working flow with a 422 above the cap, and snapshot the whole collection below it. The schema scope now rides along with the permission data so the checker can skip resolution (mirrors the agent-nodejs fix). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
8d7e211 ports the Global-scope fix from agent-nodejs#1847: a global approval-required action triggered with |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review findings — select-all approval on agent-rubyRuby port of agent-nodejs#1847, cross-checked against the whole PRD-934 chain. No critical issues — the cap itself can't be silently bypassed (Ruby's 🟠 Important
Happy to open follow-up tickets if useful. |
…scope wiring A negative max_records_for_approval reached the datasource as a negative LIMIT (unlimited on some of them) and a non-numeric value raised an uncaught ArgumentError: anything but a positive Integer now falls back to the 500 default. The schema-scope merge in Permissions#can_smart_action? — what feeds the global-action skip — is now exercised at its integration point instead of only by hand-set values on the checker. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Addressed the review in d92d810: Unvalidated Schema-scope merge unexercised — fixed: a new
Full suite: 1163 examples, 0 failures; rubocop clean. |
# [1.40.0](v1.39.4...v1.40.0) (2026-08-27) ### Bug Fixes * **datasource-active-record:** skip unrepresentable has_many/has_one :through relations and deprecate silent identity joins ([#370](#370)) ([#378](#378)) ([9d02bf5](9d02bf5)) ### Features * **actions:** resolve select-all selections for approval-required actions ([#374](#374)) ([d2071aa](d2071aa))
|
🎉 This PR is included in version 1.40.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |

Summary
Ruby port of ForestAdmin/agent-nodejs#1847 — enabling bulk actions with approval on "select all" selections.
all_records: true, the route resolves the selection (caller filter, primary keys only, cap+1 fetch) and hands the ids back throughCustomActionRequiresApprovalError→errors[0].data.recordIds, so the frontend stores the full target set in the approval request.max_records_for_approvalsetting (default 500, matching the Forest server's authoritative cap on approval record ids); above it the trigger is rejected withApprovalSelectionTooLargeError(422). Normal executes are never capped.route → can_smart_action? → SmartActionCheckerand invoked at raise time, mirroring the agent-nodejs design.roleIdsAllowedToApprove— the key the frontend actually reads (it was only sent asuser_approval_enabledbefore, which the frontend ignores).Related PRs
data.recordIds, with a fetch-based backport for agents without this feature): ForestAdmin/forestadmin#9924fixes PRD-934
Test plan
actions_spec.rbfails 8/8 on main (pre-existing breakage in route construction); the resolution logic is covered through the checker specs and mirrors the tested agent-nodejs implementation.🤖 Generated with Claude Code
Note
Resolve select-all record IDs for approval-required actions in
SmartActionCheckerall_records: truenow resolve targeted record IDs from the database when the action scope is notGLOBAL. The resolved IDs are included in theCustomActionRequiresApprovalErrordetails.resolve_select_all_record_idstoSmartActionChecker, which fetches primary keys up to a configurable limit. Addsmax_records_for_approvaltoForestAdminRailsconfig, defaulting to 500 and clamped to a hard cap of 500.roleIdsAllowedToApprovein the approval error details for frontend consumption.MAX_RECORDS_FOR_APPROVAL(500) records now raiseApprovalSelectionTooLargeErrorinstead of triggering the approval flow.Macroscope summarized d92d810.