jackwener / jackwener/OpenCLI

[autofix] taobao/add-cart: SPEC_SELECTION

Open
#2,428 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
29.5k
Forks
2.9k
Avg merge
15h 36m
Merged PRs (30d)
70

Description

## Summary
OpenCLI autofix repaired this adapter locally, and the retry passed.

## Adapter
- Site: taobao
- Command: add-cart
- OpenCLI version: 1.8.7

## Original failure
- Error code: SPEC_SELECTION

```
add-cart always returned "✗ 需要选择更多规格" even when the spec
argument matched a valid SKU option. dry-run matched, but the real run
never completed the SKU form.
```

## Local fix summary

Two bugs were fixed in the SKU selection logic:

1. Dimension grouping: `closest('[class*="skuItem--"]')` matched the
shared wrapper that covers every SKU dimension, so all options were
collapsed into a single group and only the first match was clicked.
Fix: prefer the per-dimension container `[class*="skuItemClipX--"]`
and use the DOM element itself as the Map key instead of a
className-prefix string.

2. Sequential clicks: clicking one spec triggers a full re-render of the
Taobao SKU panel, which wipes selections made earlier. Fix: click one
dimension at a time, wait for the re-render (900ms), re-query the DOM,
then move to the next; read the final isSelected state from the page
instead of trusting what we clicked.

_Issue filed by OpenCLI autofix after a verified local repair._

Contributor guide

Open the contributing guide

Research direction

Start with the taobao add-cart adapter and trace its SKU selection logic, using the SPEC_SELECTION failure and the selectors described in the issue as search terms. Reproduce the command with a valid spec and compare dry-run with the real run; done means the SKU form completes without returning "需要选择更多规格".

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.