The Shipping Quote That Was Still Yesterday's Price
The carrier rate was cached without a window, so the checkout charged the old price, and the difference was the store's, and the reconciliation found it at…
Between the off and the reconciliation sit 6 quiet assumptions, and the incident is the story of one of them failing.
Strip the cached third-party price down and one property makes it a silent loss: the quote is valid at the moment it is fetched and the cache extends it past its validity, so the checkout charges a price the carrier no longer honours.
This was Shopify with a carrier rate API, and the mechanics are the same for any external price cached without an expiry tied to the source's change frequency.
Why the cache had no window
The cache was the performance, and the performance was the carrier's latency, and the latency was the checkout's slow, and the slow was the abandonment, and the abandonment was the cache's reason, and the reason was the legitimate, and the legitimate was the no TTL, and the no TTL was the forever, and the forever was the stale, and the stale was the incident.
The TTL was the omitted, and the omitted was the not the decision, and the not decision was the oversight, and the oversight was the cache's default, and the default was the permanent, and the permanent was the wrong, because the price is the time-varying, and the time-varying is the window's requirement, and the requirement was the absent, and the absent was the incident.
The cache is the right tool and the wrong configuration, and the configuration is the TTL, and the TTL is the source's change frequency, and the frequency is the carrier's, and the carrier's is the daily or the weekly, and the daily is the window, and the window is the fix, and the fix is the one setting.
Why the loss was invisible
The quote was the shown, and the shown was the charged, and the charged was the customer's payment, and the payment was the complete, and the complete was the no error, and the no error was the invisible, and the invisible was the month, and the month was the reconciliation, and the reconciliation was the spreadsheet, and the spreadsheet was the nobody, and the nobody was the delay, and the delay was the loss's growth.
The customer saw the correct experience, and the correct experience was the price's consistency, and the consistency was the not the accuracy, and the not accuracy was the store's cost, and the cost was the silent, and the silent was the reason the cached price needs the freshness check, because the user cannot detect the stale quote and neither can the checkout.
This is the same staleness as the cache headers and which one wins, and the common root is the property, not the platform.
The fixes
Set the TTL to the carrier's rate change frequency. The TTL was the hours, and the hours was the bounded stale, and the bounded was the small loss, and the small was the fix, and the fix was the one setting, and the setting was the discipline, because the unbounded cache is the unbounded loss.
Re-quoted at the checkout step rather than the cart step. The checkout was the commitment, and the commitment was the fresh quote, and the fresh was the accurate, and the accurate was the fix, and the fix was the timing, and the timing was the discipline, because the cart is the browse and the checkout is the charge.
Compared the charged against the invoiced. The comparison was the drift, and the drift was the alert, and the alert was the detection, and the detection was the fix, and the fix was the daily job, and the job was the discipline, because the month-end reconciliation is the late detection and the late is the accumulated loss.
Absorbed or passed the difference explicitly. The policy was the decision, and the decision was the margin's protection or the customer's price, and the two were the explicit, and the explicit was the fix, and the fix was the business rule, and the rule was the discipline, because the undecided difference is the store's by default.
Logged the quote's age at the charge. The age was the recorded, and the recorded was the audit, and the audit was the diagnosis, and the diagnosis was the fix, and the fix was the field, and the field was the discipline, because the unrecorded quote age is the unmeasurable staleness.
What I now do
A cached third-party price is only valid for as long as the source guarantees it, so the TTL must match the carrier's rate change frequency and the quote must be refreshed at the commitment step. Re-quote at checkout rather than at the cart, compare the charged against the invoiced daily, and decide explicitly who absorbs the difference.
The store charged yesterday's shipping rate for a month and nobody noticed, because the carrier quote was cached with no expiry and the checkout trusted the cached value. The lesson I keep is the property, not the incident.
Published on debugly.dev by Rohit Bhadani | Founder of Krova Cloud