anyone have experience with cross-stack Pulumi deployments and have input on how to do typed outputs?
did a bit of brainstorming - stackReferences are typed as Pulumi.out<any> by default - but would love to figure out a more scalable solution where the consumer / producer cannot drift
One of the funnier engineering stories involving Wrath:
Back in late 2021, we were starting to lose dominance on Shopify, as the flows were more or less the same across top bots. The flow looked something like this (quite similar to how a human interacted with a site; great job @jmwind)
Add to cart (0.5s) -> Load checkout (1s) -> Calculating taxes (1s) -> Submit payment (1s)
Given this, there weren't many places to optimize. We realized we could skip the "Calculating taxes" stage by sending an empty total price when placing order (forcing Shopify to do the calculation themselves), and this was an optimization we used for a bit.
In the Shopify REST API described in @offline 's tweet, there was also an endpoint that allowed you to combine the "Add to cart" and "Load checkout" stages, into one "Update checkout" stage that took ~0.5s, shaving an additional 1s off the checkout time.
Excitedly, we decided to run beta builds with this new flow:
Update checkout (0.5s) -> Submit payment (1s)
However, every single task got blocked by bot protection. Unconfirmed, but I suspect that Shopify tracked antibot violations as a heuristic score (i.e. because we did 2 "suspicious" actions, updating the checkout via an API a human wouldn't usually hit, and omitting the total price, they blocked us).
Seeing this, we decided to look for other ways to optimize. Ultimately, the total price is something that should be relatively predictable given the price of the item/shipping rate & the user's billing address. We hacked together a function to predict it, and this evaded antibot while retaining the skipped "Calculating taxes" stage. (screenshot below - we had to handle edge cases for certain states that are tax exempt up to a threshold, etc.)
We launched this to users and saw major success. However, I happened to be from Michigan, and I would always test with a flat 6% tax rate. This would make shoe amounts come out relatively cleanly (e.g. 190 * 1.06 = $201.40, so no rounding was needed).
Unfortunately, NYC has a tax rate of 8.875%, meaning that 190 * 1.08875 = $206.8625. No matter how long we tried, we couldn't figure out a deterministic direction Shopify's internal API would round (sometimes this would come out to $206.86, sometimes $206.87)...
We didn't really have a solution to this so we ultimately accepted that you'd have a lower chance of buying a shoe depending on if your local sales tax rate was more digits. I'm sorry 😂
if you're ex-sneaker twitter / want to build out of our office pull thru tonight! free coffee & wrath keys will be provided ..
(p.s. @skvrah from nyte is giving free autographs)