fix(wix-manage): correct the store-wide coupon scope - #859
Conversation
The Create Coupon recipe documented an all-products scope as
`{ "namespace": "stores", "group": { "name": "product" } }` with the
`entityId` omitted, in the two request examples, the scope table, the
`SITE` recommendation-mapping row and the error-handling fix column.
The Coupons API rejects that combination for a percentage coupon:
HTTP 400 {"message":"The provided combination of scope and coupon
type is invalid.\nProvided combination:\nnamespace=stores,
group=product, entityId=empty, coupon type=PercentOff\n..."}
`group` is only valid together with its `entityId`; a store-wide coupon
carries the namespace alone. The Valid scope values reference this
recipe already links to says the same — group is optional and "Entity ID
is required only when Group is listed".
An agent following the recipe takes the 400 on its first create call and
has to retry with the group removed. Correct the shape everywhere it is
restated, and add the 400 to the error table.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
EvalForge YAML Gate: eval comparisonGitHub Actions is disabled repository-wide, so the gate does not run as a check here. It was run Group verdict:
|
Scenarios in this directory carry a single area tag. This one also carried `aria`, which selects a separate scheduled run over a different scenario set, so the scenario was being picked up by a sweep it does not belong to. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The defect
ecom-pricing-create-coupon.mddocumented the "all store products" coupon scope aswith the
entityIdomitted — in both store-wide request examples, the Scope values for WixStores table, the
SITErow of the recommendation mapping, and the fix column of the error table.The Coupons API rejects that combination for a percentage coupon. Verbatim, from a recorded run
transcript (
POST https://www.wixapis.com/stores/v2/coupons):(the recorded error body is truncated at that point)
groupis valid only together with itsentityId; a store-wide coupon carries the namespacealone. The Valid scope values
reference this recipe already links to says exactly that — Group is "optional - if not listed, the
coupon will apply to all products/services/events in the namespace", and Entity ID is "required
only when Group is listed". The recipe contradicted the page it cites.
Blast radius
Reproduced on five consecutive nightly runs of the same scenario. In each one the agent read
…/skills/pricing-create-coupon, sent the documented store-wide scope on its first create call,took the 400, then retried with
groupremoved and succeeded. The outcome judge scored 10/10 everytime — the user does get the coupon — while the path judge scored 6–7 and named the scope
combination as the gap.
The recovery is what the recipe cost: one rejected mutating call plus a retry, on the most common
coupon request there is.
The fix
Correct the shape everywhere the recipe already restates it (no new prose about API shape, per
Orchestration, not API shape), and add the 400 to the existing error table:
"scope": { "namespace": "stores" }groupandgroup.entityIdSITEmapping row →{ "namespace": "stores" }+7 / −15 on the recipe. The front-matter
descriptionis unchanged — this corrects a shape, it doesnot extend what the recipe covers, so the retrieval key should not move.
Routing
The failing agent read this recipe —
ReadFullDocsArticleonhttps://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-couponwas the call immediately before the rejected create, and the recipe is the only source of the wrong
shape. The upstream reference is already correct, so there is nothing to fix in the API docs, and
the API's own 400 is already explicit about the supported combinations. The defect is the recipe
restating a shape its own cited reference contradicts, so it is fixed here and only here.
Coverage
New scenario
yaml/wix-manage-evals/ecommerce/pricing-promotions/ecom-pricing-create-coupon-store-wide-scope.yml,three assertions per
docs/eval-scenarios.md:ReadFullDocsArticlecoverage on the recipe's docURL, an
llm_judgeon the outcome, and a gatingllm_judgeon the tool-call path that fails acreate call rejected with this 400 even when a retry recovers. The trigger prompt is the unmodified
request that produced the finding — it names no scope, so an agent with the old content still has
every reason to go wrong.
Validated against
packages/evalforge-core/src/schema.ts(parseScenario), and thearticleUrlagainst the gate's
canonicalDocUrl.Note on checks
GitHub Actions is disabled repository-wide (
actions/permissions→enabled: false), so no checkwill appear on this PR. The gate was run manually against this branch; results are in a comment
below.