Skip to content

fix(test): payment-legacy-seam checks PERMISSIONS_KEY, not the legacy ROLES_KEY - #359

Open
modernitconsultants wants to merge 3 commits into
TelivityAI:mainfrom
modernit-com-au:fix-payment-test-stale-assertions
Open

fix(test): payment-legacy-seam checks PERMISSIONS_KEY, not the legacy ROLES_KEY#359
modernitconsultants wants to merge 3 commits into
TelivityAI:mainfrom
modernit-com-au:fix-payment-test-stale-assertions

Conversation

@modernitconsultants

Copy link
Copy Markdown
Collaborator

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.

… 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 telivity-otaip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants