Skip to content

Conversation

@aaomidi
Copy link
Contributor

@aaomidi aaomidi commented Dec 6, 2025

In 978877a35 ("Store authzIDs directly in order table"), the modelToOrder function was updated to decode the new Authzs protobuf column, but the decoded values were never assigned to the order's V2Authorizations field. This caused the StoreAuthzsInOrders feature to not work correctly for reads.

The bug meant that even with StoreAuthzsInOrders enabled:

  1. Reads always fell back to querying the orderToAuthz2 table
  2. The Authzs blob was parsed but the result was discarded
  3. Eventually dropping orderToAuthz2 would break all order reads

The fix assigns the decoded authz IDs to V2Authorizations, allowing orders with the new column populated to skip the fallback query.

Also adds TestModelToOrderAuthzs to verify the fix and prevent regression.

In letsencrypt@978877a35 ("Store
authzIDs directly in order table"), the modelToOrder function was
updated to decode the new Authzs protobuf column, but the decoded
values were never assigned to the order's V2Authorizations field.
This caused the StoreAuthzsInOrders feature to not work correctly
for reads.

The bug meant that even with StoreAuthzsInOrders enabled:
1. Reads always fell back to querying the orderToAuthz2 table
2. The Authzs blob was parsed but the result was discarded
3. Eventually dropping orderToAuthz2 would break all order reads

The fix assigns the decoded authz IDs to V2Authorizations, allowing
orders with the new column populated to skip the fallback query.

Also adds TestModelToOrderAuthzs to verify the fix and prevent
regression.
@aaomidi aaomidi requested a review from a team as a code owner December 6, 2025 03:54
@aaomidi aaomidi requested a review from aarongable December 6, 2025 03:54
@jprenken jprenken requested a review from jsha December 6, 2025 03:57
aarongable
aarongable previously approved these changes Dec 8, 2025
sa/model_test.go Outdated
Comment on lines 254 to 255
test.AssertNotError(t, err, "modelToOrder failed")
test.AssertDeepEquals(t, order.V2Authorizations, tc.expectedAuthzIDs)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we're preferring to follow the Go style guide's advice regarding test assertions in new tests. Making these look more like

if err != nil {
  t.Fatalf("modelToOrder(%v) = %s, want success", tc.model, err)
}
if !slices.Equal(order.V2Authorizations, tc.expectedAuthzIDs) {
  t.Errorf("modelToOrder(%v) = %v, want %v", tc.model, order.V2Authorizations, tc.expectedAuthzIDs)
}

would be preferable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cheers and done

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.

Nice catch, thanks for fixing!

@jsha jsha merged commit 4dcb267 into letsencrypt:main Dec 8, 2025
12 checks passed
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.

3 participants