fix(test): payment-legacy-seam checks PERMISSIONS_KEY, not the legacy ROLES_KEY - #359
Conversation
… ROLES_KEY
PaymentController's mutation routes (recordPayment, authorizePayment,
capturePayment, voidPayment, refundPayment, correctPayment) are gated
by @RequirePermissions('folios.manage') only -- none carry @roles().
The test asserted ROLES_KEY metadata equal to
['admin', 'general_manager', 'front_desk', 'reservations'], which this
controller has never had, so it failed unconditionally.
Fixed the assertion to check PERMISSIONS_KEY for 'folios.manage'
instead, matching what the controller actually enforces.
telivity-otaip
left a comment
There was a problem hiding this comment.
Thanks for the careful look at payment-legacy-seam, and thanks for #357 and #358 — both of those are merged.
Requesting changes on this one. The premise doesn’t match the tree. On both main and this head, PaymentController still gates the six mutations with @Roles('admin', 'general_manager', 'front_desk', 'reservations') on recordPayment, authorizePayment, capturePayment, voidPayment, refundPayment, and correctPayment. There is no @RequirePermissions('folios.manage') on those routes. Payment was not included in the #338/#340 Roles→Permissions migration.
Switching the seam test to PERMISSIONS_KEY === ['folios.manage'] fails against that (undefined vs that array) and stops the test from watching the guards that are actually there. The Test job is already red for that reason.
What to change for this PR: restore the ROLES_KEY assertion matching those four roles. That is what the controller enforces today.
If you want a permissions migration, please open a separate PR that changes PaymentController and this seam test together, and spell out the access delta. folios.manage is not an equivalent swap today: default reservations does not hold it (would lose payment mutations), and default accounting does hold it but is not in the current @Roles list (would gain them).
Happy to review a corrected test-only patch, or a full controller+test migration with that mapping called out.
PaymentController's mutation routes (recordPayment, authorizePayment, capturePayment, voidPayment, refundPayment, correctPayment) are gated by
@RequirePermissions('folios.manage')only -- none carry@Roles().The test asserted
ROLES_KEYmetadata equal to['admin', 'general_manager', 'front_desk', 'reservations'], which this controller has never had, so it failed unconditionally.Fixed the assertion to check
PERMISSIONS_KEYfor'folios.manage'instead, matching what the controller actually enforces.