Repository navigation
fix(checkout): index categories from the catalog items lookup - #58
Merged
mekedron merged 1 commit intoOct 17, 2026
Merged
Conversation
The items lookup that Build runs for the basket's ids maps each item to its category through categories[].item_ids; the item records themselves carry no category field. That payload was only searched item by item, so the mapping was never used. When the item page came back empty and the search by the basket's line name (localized, e.g. English for a Czech venue) found nothing, checkout preview failed with "unable to resolve category_id". Index the lookup payloads like the item page, search and venue content payloads, so the category resolves without the extra search.
mekedron
approved these changes
Oct 17, 2026
mekedron
left a comment
Owner
There was a problem hiding this comment.
Thanks! Reviewed and verified locally:
- The new test fails on main with the same
unable to resolve category_iderror and passes with the fix. - Precedence is unchanged where it matters: category fields on the basket line and the item page still win, and the assortment index is merged first, so the lookup mapping only fills gaps.
- Full pre-push gate (build, version check, golangci-lint, go test, go test -race) and the read-only live smoke pass.
Owner
|
Thanks a lot for the fix and for such a clear write-up, @vsem-azamat! The real payload shapes in the test and the live check made this an easy review. It's merged and shipped in v2.5.1. Also thanks for digging into the multi-count pricing in #59. I'll take that one in a separate PR, so no need to open one for it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
wolt checkout(andwolt_checkout_previewover MCP) fails for a Tesco Hypermarket basket in Prague:For this venue:
order-xp/web/v1/pages/venue/<id>/item/<item>) returns{"id": …, "venue_id": …, "sections": []}, with no category;POST …/assortment/itemswithitem_ids) returns the mapping only ascategories: [{"id": "0ff8ad8c…", "item_ids": ["1dfd4b06…"]}], and the item records have no category field;Franz Josef Kaiser Exclusive Green Olives Stuffed with Blue Cheese Paste 300g) while the venue catalog is Czech, so the search finds nothing.Buildsearched the items-lookup payload item by item throughresolveCheckoutCategoryIDFromCatalogPayload, which only reads fields on the item. Itscategories[].item_idsmapping was never indexed. Items whose name search happened to match still worked; in the same basket the cucumber resolved and the olives did not.Fix
Run
buildCheckoutCategoryIDIndexover the items-lookup payloads too: the caller-supplied current catalog and any fetched lookup. This is the same treatment the item page, search and venue content payloads already get. The category then resolves from the lookup that is already made, without the extra search.Tests
TestBuildResolvesCategoryFromCatalogItemsCategoryListuses the real payload shapes: an empty item page, a lookup withcategories[].item_idsonly, and a search that finds nothing. It fails onmainwith the sameunable to resolve category_iderror and passes with the fix. It also asserts that no search request is needed.go build ./..., version check,golangci-lint run(v2.4.0 config, 0 issues),go test ./...andgo test -race ./...all pass.wolt checkout --venue-id 6539247b9eecd6092fb9e117returns a preview for the 17-line basket that failed before.