Repository navigation
fix(commerce-pdp-management): resolve scope-only rules, debounce product picker, fix review queue filter - #48
Merged
Conversation
…ead of dropping them Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… stale responses Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ew queue Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…tion, and picker search Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
plsrd
had a problem deploying
to
agentic-localization
September 3, 2026 19:28 — with
GitHub Actions
Error
plsrd
had a problem deploying
to
agentic-localization
September 3, 2026 19:28 — with
GitHub Actions
Failure
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Looks good @plsrd ! |
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What this PR does
Fixes three bugs from the internal review of the
commerce-pdp-managementstarter: attribute rules that only appear in a product-type scope were silently dropped by the resolver, the Studio product picker could show stale Shopify results, and a rule sent back todraftafter approval never reappeared in the Review queue. Docs are updated where the behavior an editor relies on changed.Changes
1. Scope-only attribute rules resolve instead of being dropped
What was wrong:
selectPriorityListbuilt its id map from the globalcontrolPlane.priorityListonly, and thecontrolPlaneQueryprojected eachproductTypeScopeas bareruleIds. A rule referenced only by a scope was looked up in a map it was never in, so it vanished with no signal to the merchandiser.What changed:
frontend/sanity/queries.tsdereferences each scope'spriorityListwith the same rule projection as the global list.ProductTypeScopenow carriespriorityList: Array<AttributeRule | null>(GROQ returnsnullfor a deleted or unpublished reference), andControlPlane.priorityListis typed the same way.resolvePdp.tsputs the scope's own rules first (in scope order, including scope-only rules) and appends the remaining global rules. Unresolvable entries are skipped with aconsole.warnnaming the list they came from.packages/@starter/sanity-types/sanity.types.tsregenerated for the new query shape.2. Product picker search is debounced and sequenced
What was wrong:
ProductPickerInputcalledsearchShopifydirectly on every keystroke with no debounce or request ordering, so a slow earlier response could overwrite the suggestions for a later, more specific term.What changed: New
studio/hooks/useDebouncedSearch.ts(no existing debounce utility in this starter to reuse) debounces keystrokes (250ms), numbers each request, aborts the previous one viaAbortController, and only applies the result for the latest request.searchShopifytakes thesignal; the component now just callssearch(term).studio/tsconfig.jsonincludes the newhooks/dir.3. Review queue shows everything not yet approved; review-stamp resets
What was wrong: The Review queue filtered
attributeRuleonstatus == "in-review"only, so flipping an approved rule back todraftremoved it from the queue entirely. MeanwhileskuEnrichmentuseddraftas its queue state, so the two types behaved inconsistently. The README describes the queue as where "drafts land ... before anything reaches a customer", so the queue now matches that.What changed:
studio/structure.tsfilter is_type in ["attributeRule", "skuEnrichment"] && status != "approved".functions/review-stamp/index.tsnow also clearsaiEnrichment.reviewedAtwhen a rule leavesapproved, so a re-approval gets a fresh timestamp instead of keeping the old one. Both patches are guarded on current state so neither re-fires itself. The blueprint event filter already covered all publishedattributeRuleupdates; no blueprint change needed.AGENT.mddocuments the status flow, the new queue semantics, scope resolution, and the picker hook.Testing
Run from
commerce-pdp-management/with dummySANITY_STUDIO_PROJECT_ID/SANITY_STUDIO_DATASETset:pnpm typegen— regenerated types (3 queries, 23 schema types)pnpm -r typecheck— passes infunctions,packages/@starter/commerce,studio,frontendpnpm lint— cleanpnpm format:check— clean (rootnpx oxfmtalso run via the pre-commit hook)pnpm --filter @starter/functions build— both bundles buildpnpm validate— template validatednode:testsuite againstresolveAttributeRules(not committed; the starter has no test runner): scope-only rule resolves and wins its category, non-matching product type falls back to global, scope reorders shared rules and appends unscoped globals,nullrefs skipped with one warning per list, null/empty control plane yields[]. 5/5 pass.Not verified live: the Studio picker UI against a real Shopify store, and the
review-stampFunction against a deployed dataset (logic is a straightforward extension of the existing guarded patch).🤖 Generated with Claude Code