Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SA: Create list of authzIDs earlier in NewOrderAndAuthzs #7744

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

jprenken
Copy link
Contributor

@jprenken jprenken commented Oct 4, 2024

Creating the list of authzIDs earlier in NewOrderAndAuthzs:

  • Saves a for loop with duplicated code; we no longer need to range over two different slices, just one.
  • Allows us to create the Order PB later, after more of the data collection logic, without interrupting it. This makes the order of operations slightly easier to follow.

@jprenken jprenken requested a review from a team as a code owner October 4, 2024 20:52
@jprenken jprenken requested a review from jsha October 4, 2024 20:52
Copy link
Contributor

@jsha jsha left a comment

Choose a reason for hiding this comment

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

nits:

The title of the PR doesn't give me a very clear idea what it does. Also, when we're touching a single discrete component we often (not universally) use that component as a prefix. I might say:

sa: create list of authzIDs earlier in NewOrderAndAuthzs

Also, the PR description should mention the movement of addReplacementOrder and getAuthorizationStatuses and have a short explanation of why it's clearer or better.

One thing I noticed related to the reordering: I think you should also be able to move statusForOrder above the res := &corepb.Order{ line too. That would be nice because you can replace res.Status = status with a field assignment inside the object creation (Status: status). And you could also combine the object literal with the return statement:

return &corepb.Order{
    Status: status,
    ...
}, nil

@jprenken jprenken changed the title Move Order PB creation in sa.NewOrderAndAuthzs sa: create Order PB & list of authzIDs earlier in NewOrderAndAuthzs Oct 7, 2024
@jprenken jprenken changed the title sa: create Order PB & list of authzIDs earlier in NewOrderAndAuthzs sa: create list of authzIDs earlier in NewOrderAndAuthzs Oct 7, 2024
@jprenken
Copy link
Contributor Author

jprenken commented Oct 7, 2024

One thing I noticed related to the reordering: I think you should also be able to move statusForOrder above the res := &corepb.Order{ line too. That would be nice because you can replace res.Status = status with a field assignment inside the object creation (Status: status).

Since statusForOrder requires an Order as an argument, I'd need to modify it to remove that requirement - a much bigger change that I didn't intend to take on with this PR.

@jprenken jprenken requested a review from jsha October 7, 2024 20:28
@beautifulentropy beautifulentropy changed the title sa: create list of authzIDs earlier in NewOrderAndAuthzs SA: Create list of authzIDs earlier in NewOrderAndAuthzs Oct 8, 2024
sa/sa.go Outdated Show resolved Hide resolved
aarongable
aarongable previously approved these changes Oct 9, 2024
Copy link
Contributor

@aarongable aarongable left a comment

Choose a reason for hiding this comment

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

LGTM % Phil's comment.

@jprenken jprenken merged commit b0bcbb1 into main Oct 10, 2024
12 checks passed
@jprenken jprenken deleted the neworderauthzs-order branch October 10, 2024 16:55
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.

4 participants