CIT-5223: map checkout-in-progress codes in parseShopError - #905
Merged
Merged
Conversation
The backend refuses basket edits while the lender's own checkout is running, returning checkout_in_progress or shop.checkoutInProgress. Neither was mapped, so parseShopError fell through to its catch-all and returned "An unknown error occurred." with the code rewritten to shop.unknown -- discarding the original, so consumers had nothing left to classify on. Maps both to lender-facing copy, matching the existing basket-error handling in this function. Adds a test pinning both codes OUT of hasBasketExpired. They were already absent, but that list drives createBasket-and-retry in callShopMutation/callShopQuery, and retrying a busy basket would be wrong. The test makes the omission deliberate rather than incidental. CIT-5223 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mcstover
approved these changes
Sep 16, 2026
dyersituations
approved these changes
Sep 16, 2026
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.
CIT-5223 — follow-up to CIT-5181 (kiva/ui#7266), which fixed this in kiva/ui but could not reach the paths that route through this package.
Why
The backend now refuses basket edits while the lender's own checkout is still running, returning
checkout_in_progress(loan reservation path) orshop.checkoutInProgress(donation, Kiva Card and credit paths).Neither was mapped in
parseShopError, so both fell through to the catch-all:Two consequences. The lender sees "An unknown error occurred." — exactly the generic copy CIT-5181 exists to eliminate. And the original code is discarded, rewritten to
shop.unknown, so no consumer downstream can classify it. That second part is why this had to be fixed here rather than in kiva/ui.Reachable today:
ExpressCheckoutTotals.vuein kiva/ui callsapplyKivaCredit/removeKivaCredit→callShopMutation→parseShopError, then renderse?.message.What
Maps both codes to lender-facing copy, in the same shape as the existing
shop.invalidBasketId/shop.basketRequired/shop.alreadyCheckedOutbranch directly above it.Also adds a test pinning both codes out of
hasBasketExpired. They were already absent, so this is a regression guard rather than a behavior change — but that list drivescreateBasket-and-retry insidecallShopMutation/callShopQuery, and retrying against a busy basket would be wrong. The omission should be deliberate, not incidental.Notes for review
MysqlBasketRepo::CHECKOUT_LOCK_TTL_SECONDS), so the wording deliberately avoids implying a permanent state.shop.checkoutInProgressbut doesn't name mutations. Worth confirmingaddCreditByType/removeCreditByTypeactually take the checkout lock. The change is harmless if they don't.Testing
@kiva/kv-shop: 14 suites / 91 tests passing, lint clean.Heads-up for anyone reproducing: on a fresh
npm cithe sibling packages aren't built, which makesoneTimeCheckout.spec.tsfail to resolve@kiva/kv-analyticsand produces 7import/*lint errors from@kiva/kv-components. Both are environment, not code — building those two packages first clears them, and the pre-commit hook needs that too.🤖 Generated with Claude Code