Skip to content

fix(twitter): match localized delete menu and poll for late-hydrating article (#2001)#2026

Open
LeoLin990405 wants to merge 1 commit into
jackwener:mainfrom
LeoLin990405:fix/twitter-delete-localized-menu-and-hydration
Open

fix(twitter): match localized delete menu and poll for late-hydrating article (#2001)#2026
LeoLin990405 wants to merge 1 commit into
jackwener:mainfrom
LeoLin990405:fix/twitter-delete-localized-menu-and-hydration

Conversation

@LeoLin990405

Copy link
Copy Markdown
Contributor

What

opencli twitter delete fails on a Simplified-Chinese X UI from a tweet detail page — two cascading issues plus a localized menu item. Closes #2001.

Root cause & fix (all inside buildDeleteScript)

  1. Localized "More" caret — the caret was matched by aria-label === 'More', but X localizes it (zh-Hans 更多), so the exact English match never hit. → Prefer the language-agnostic [data-testid="caret"] (kept scoped to the matched targetArticle), falling back to a multilingual /^(More|更多)/ aria-label match.
  2. Late hydrationfindTargetArticle() ran right after primaryColumn appeared, but the article's self-referential /status/<id> link (what the matcher keys on) hydrates later on slow networks. → Poll findTargetArticle() for ~5s (20 × 250ms) before giving up.
  3. Localized Delete item — broaden the menu match to Delete/删除 and exclude the Lists item in both languages (List/列表), so 从列表中删除 / Remove from Lists is never clicked.

Article-scoping is preserved (exact-id match via the shared helper), so we still act only on the matched tweet.

Test

Extended clis/twitter/delete.test.js with assertions for the data-testid="caret" primary selector, the /^(More|更多)/ fallback, the poll bound, and the localized Delete/删除 + 列表 exclusion. vitest run clis/twitter/delete.test.js → 4 passed; check:typed-error-lint / check:silent-column-drop → no new violations.

Reported by OpenCLI autofix (locally verified); this implements the same repair with tests.

… article (jackwener#2001)

twitter delete failed on a Simplified-Chinese X detail page: (1) the More
caret was matched by aria-label === 'More', which X localizes (zh-Hans 更多),
and (2) findTargetArticle() ran before the article's self-referential
/status/<id> link hydrated on slow networks. Inside buildDeleteScript:

- Prefer the language-agnostic [data-testid="caret"] (scoped to the matched
  article), falling back to a multilingual /^(More|更多)/ aria-label match.
- Poll findTargetArticle() for ~5s (20 x 250ms) before giving up.
- Broaden the Delete menu item to Delete/删除 and exclude the Lists item in
  both languages (List/列表).
wearzdk added a commit to wearzdk/OpenCLI that referenced this pull request Jun 26, 2026
从 jackwener/opencli 123 个开放 PR 中筛选并入与本产品(内容发布)相关的:
- B 核心/daemon/扩展/pipeline 可靠性 23 个
- A twitter/小红书/公众号/tiktok 发布写修复 7 个
- C instagram/linkedin 内容平台读取增强 3 个
跳过 jackwener#2026 jackwener#1960(已被我们 d4e65ab + jackwener#2011 + rednote 适配器取代)。
本地化解决了 4 处冲突,删除 jackwener#1972 冗余 per-command strip。
全量测试 5808 passed,无新增失败(6 个 cli.test.ts 浏览器/守护进程用例为合并前既有、环境相关)。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[autofix] twitter/delete: SELECTOR — localized "更多" aria-label + late article hydration

1 participant