fix(bytedance): Layer Separation price badge never matches the size widget - #15370
Conversation
The Layer Separation price badge tests `widgets.size in ["1k", "1.5k"]`, but the `size` combo declares ["auto", "1K", "1.5K", "2K"]. JSONata `in` is case-sensitive, so the condition is false for every selectable value and the badge always renders the 0.032-0.064 range, including when the user has explicitly picked 1K or 1.5K. Normalise with $lowercase so the comparison holds regardless of the label casing.
|
❌ Retracting this — I was wrong, and closing it. The premise is false. The frontend lowercases combo widget values before they reach the JSONata context: My reproduction was the bug: I evaluated the raw expression against The real, narrower defect is that Apologies for the noise, @bigcat88 — and please disregard the "price badge is always wrong" framing if it reached you from anywhere else. |
Targets
feat/api-nodes/bytedance-layer-separation, the branch of #15351.The bug
ByteDanceSeedreamLayerSeparationNode's price badge testsagainst a combo declared as
JSONata
inis case-sensitive, so the condition is false for every value the widget can hold. Therange_usdbranch is therefore the only branch that ever renders — a user who explicitly picks1Kor1.5Kstill sees$0.032 - $0.064instead of the flat$0.032.Reproduction
Evaluated with the same
jsonatapackage the frontend uses to render the badge:After this change:
Why
$lowercaserather than rewriting the literals as["1K", "1.5K"]Both fix today's bug.
$lowercaseadditionally survives a label-casing change to the combo, which is exactly the failure mode being fixed. Fallback behaviour for an absent/undefinedwidgets.sizeis unchanged (JSONata propagates undefined, theintest is false, the range branch renders).Not changed — one open question for @bigcat88
2Kcurrently falls into therange_usd 0.032 - 0.064branch. If 2K is a known flat price (the range's max being exactly 2x the min suggests 0.064), the badge should say so. I did not guess at a billing number; please confirm and I will follow up, or fold it into this PR.This is the item Christian raised in Slack (
price badge is "2K" in one place and "2k" in another) and it blocks the pricing checkbox on #15351.Testing
No Python-side test: the expression is JSONata and is only evaluated in the frontend, and this repo has no price-badge test harness. Verified with the
jsonatapackage as shown above.ruff checkclean.API Node PR Checklist
Scope
Pricing & Billing
If Need pricing update:
QA
Comms