Hacker News new | ask | show | jobs
by moon0917 31 days ago
Funny seeing Saleor in your benchmarks. I was digging through that codebase recently for something else and ran into a nasty bug along those same lines.

They have a price recalculation task meant to only run on dirty listings, except someone forgot to assign the filtered queryset back to the variable. So it just recomputed every single listing on every run. The unit test still greenlit it for completely unrelated reasons, meaning it probably sat there burning cycles in prod for ages because the final output was technically valid. Does Mo catch that kind of silent no-op where the external state looks fine, or does it mostly hook into visible state diffs?

3 comments

Thanks for flagging this. The `.filter(discounted_price_dirty=True)` result was never assigned, so it recalculated every listing.

Fixed here: https://github.com/saleor/saleor/pull/19984 The old test passed for the wrong reason, so we fixed that too.

Bonus: we've also created semgrep rule to prevent unassigned querysets: https://github.com/saleor/saleor/pull/19997

Mo is mostly looking for user-facing failures, or at least things that impact the user in some way. So if the app was super slow due to this, or was timing out, it would likely find it. However, if this is purely a backend cost issue, it currently wouldn't be likely to flag it.
We're looking into it. Thanks for reporting moon0917!