Repository navigation
Conversation
Change-Id: Iaefffce0a2955c3df4369affc6335fb9313151df
Change-Id: Ie7f15d5ef3968dd177b8eddfbf43b566f72fca3c
Change-Id: Id285de92d3bb3e553198a9823b3b9afb51b67538
…improving validation Change-Id: I61c181257475a3311c9b775de7488963ad6a4a70
Change-Id: Idebe3ddca986d7e88884d28f3e000ffc566c4d1b
…r_access.rb Change-Id: Ic23d5af07d153674d7336edb0d4fdb6193c7aeaa
Change-Id: I0f5ecf8159a2534b6ae36cbb331020636ab2bf6d
…ndling, and restore config
Summary of Review & Applied OptimizationsI reviewed the changes in PR #555 and pushed a commit directly to
|
| multi_party_auth_review.customer_user_access_review.new_customer_user_access, | ||
| multi_party_auth_review.customer_user_access_invitation_review.new_customer_user_access_invitation | ||
| FROM multi_party_auth_review | ||
| WHERE multi_party_auth_review.review_status = 'PENDING' |
There was a problem hiding this comment.
Consider adding ORDER BY multi_party_auth_review.creation_date_time ASC to the query. Because fetch_and_approve_pending_multi_party_auth_reviews approves pending_reviews.first, ordering explicitly by creation date ensures deterministic FIFO approval of the oldest pending review.
| puts "\tOld resource name: #{access_review&.old_customer_user_access}." | ||
| end | ||
| elsif mpa_review.target_resource == :CUSTOMER_USER_ACCESS_INVITATION | ||
| new_invite = mpa_review.customer_user_access_invitation_review&.new_customer_user_access_invitation |
There was a problem hiding this comment.
Defensive check suggestion: if an MPA review corresponds to an invitation removal/revocation or if new_customer_user_access_invitation is not populated, new_invite&.email_address and new_invite&.access_role will be nil, resulting in Invitation email address: , Role: ..
Consider wrapping this in if new_invite before logging to avoid printing empty fields:
if new_invite
puts "\tInvitation email address: #{new_invite.email_address}, " \
"Role: #{new_invite.access_role}."
end| elsif result_or_error&.partial_failure_error | ||
| # Partial failure error | ||
| errors_count = 0 | ||
| failures = client.decode_partial_failure_error(result_or_error.partial_failure_error) || [] |
There was a problem hiding this comment.
If client.decode_partial_failure_error returns an empty array or no inner errors are unpacked, errors_count will remain 0, printing 0 partial failure error(s) occurred even though partial_failure_error was present. Consider checking if failures.empty? or adding a fallback message to avoid confusing logs.
| ) | ||
|
|
||
| result = response.first.customer_user_access | ||
| result = response.first&.customer_user_access |
There was a problem hiding this comment.
Optimization suggestion: in get_user_id, consider appending LIMIT 1 to query (line 66) since each email address can have at most one customer_user_access record in an account. This avoids unnecessary scanning overhead.
| "access changes. See advanced_operations/fetch_and_approve_pending_multi_party_auth_reviews.rb " \ | ||
| "for an example on how to approve an MPA auth review using the API." | ||
| else | ||
| puts "Successfully updated customer user access with resource name " \ |
There was a problem hiding this comment.
Defensive formatting: if response.result is unexpectedly nil, response.result&.resource_name renders as an empty string, yielding "... resource name .". Consider providing a fallback (e.g. #{response.result&.resource_name || 'N/A'}) or checking if response.result.
| "for an example on how to approve an MPA auth review using the API." | ||
| else | ||
| # Print out information of the created invitation. | ||
| puts "Customer user access invitation was sent for customerId = #{customer_id} " \ |
There was a problem hiding this comment.
Defensive formatting: if response.result is unexpectedly nil, response.result&.resource_name renders as an empty string, yielding "... resource name .". Consider providing a fallback (e.g. #{response.result&.resource_name || 'N/A'}) or checking if response.result.
Change-Id: Iaefffce0a2955c3df4369affc6335fb9313151df