Skip to content

fix(youtube): combine publish scope and timeout hotfixes#30

Closed
mylukin wants to merge 6 commits into
mainfrom
hotfix/youtube-pr26-pr29
Closed

fix(youtube): combine publish scope and timeout hotfixes#30
mylukin wants to merge 6 commits into
mainfrom
hotfix/youtube-pr26-pr29

Conversation

@mylukin

@mylukin mylukin commented May 16, 2026

Copy link
Copy Markdown

做了什么

Acceptance Criteria

  • opencli youtube publish --help 显示 --timeout,默认值为 420。
  • YouTube publish 源码使用 browserLiteral(...) + page.evaluate(...),不再在关键 publish 脚本里依赖 evaluateWithArgs 注入参数。
  • --timeout 会传入 waitForDetailsDialogwaitForYouTubePublishResult
  • node20 /usr/local/bin/opencli 可切到该分支 build 产物用于热更验证。

测试方法

  • npm run build
  • npm run test:adapter -- clis/youtube/publish.test.js(8 passed)
  • opencli youtube publish --help

部署/回滚说明

当前 node20 已热切:/usr/local/bin/opencli -> /Users/lukin/Projects/opencli-youtube-pr26-pr29-hotfix/dist/src/main.js

回滚可将 /usr/local/lib/node_modules/@jackwener/opencli symlink 指回前一个 worktree:/Users/lukin/Projects/opencli-youtube-upload-timeout,然后重启 social-hub backend。

Co-Authored-By: Cody builder.bot@easymeta.au

Lukin and others added 3 commits May 16, 2026 23:35
Co-Authored-By: Cody <builder.bot@easymeta.au>
Co-Authored-By: Cody <builder.bot@easymeta.au>
Co-Authored-By: Cody <builder.bot@easymeta.au>
@mylukin

mylukin commented May 16, 2026

Copy link
Copy Markdown
Author

Review 结论:NEEDS WORK

对抗性检查

  • clis/youtube/publish.js:110 / clis/youtube/publish.js:318--timeout 文案写的是 “full YouTube publish flow”,但实现是 details wait 给一整份 timeout、final publish wait 又给一整份 timeout;setFileInput 前的 selector wait 还固定 45s。用户传 --timeout 420 时,实际最坏不是 420s,而是 45s + 420s + 420s + 其他步骤。这个和 manifest/CLI 语义不一致。

    • 修复:在 publishCommand.func 一开始计算绝对 deadline,例如 deadlineAt = Date.now() + timeoutSeconds * 1000;后续每个阶段只拿 remainingMs()setFileInput / waitForAnySelector 也要接收剩余预算。补测试:timeout: 2 时 selector wait/details/final publish 都不能各自重新拿满 2s。
  • clis/youtube/publish.js:373 / clis/youtube/publish.js:133setFileInput(...) 后没有验证浏览器端实际选中文件,420s 超时后只返回固定文案 YouTube upload details dialog did not appear before timeout。这正好对应 node20 现场失败:我们无法判断是文件没挂上、挂错 input、change 没触发、YouTube modal 报错、还是账号/URL 状态问题。

    • 修复:setFileInput 后立即做 browser-side probe;至少返回 selector、input.files.length、文件 basename 是否匹配、location.href、可见 modal/dialog 文案、upload/error 文案、body 前 500 字。若 files.length === 0 或 basename 不匹配,直接 upload_failed,别等 420s。
  • ⚠️ clis/youtube/publish.test.js:53:现有测试只证明 timeout 传进 details wait;没有锁住“全局预算”、post-file-input 诊断、selector 找不到时受 --timeout 限制、details timeout 带现场信息。建议补 3 类测试:小 timeout 全链路预算;文件设置后 files.length === 0 的失败;details dialog timeout error 包含 URL/files/modal 文案。

Acceptance Criteria

  • ✅ PR fix(youtube): isolate publish browser scripts #26 的 scope fix 已进来:YouTube publish 主路径里的 evaluateWithArgs(...) 已改成 IIFE 内局部 browserLiteral(...) + page.evaluate(...),未看到同类 Identifier has already been declared 风险。
  • ✅ PR fix: 延长 YouTube 发布上传等待 #29 的 timeout 参数已进来:CLI manifest 有 --timeout,details / final publish wait 都接到了该参数。
  • ❌ 但 timeout 语义不是 full flow,且当前现场失败仍不可诊断;这两个必须修,否则这个热更 PR 留存下来后仍会让线上排障继续盲飞。

我本地复验:

  • npm run build
  • npm run test:adapter -- clis/youtube/publish.test.js ✅ 8/8

总结:NEEDS WORK(2 个 blocking)。

— Trent 🏛️

@mylukin

mylukin commented May 16, 2026

Copy link
Copy Markdown
Author

Scope update: per Luke's instruction, PR #30 remains the single vehicle for the YouTube upload failure fix. Do not create another PR; push the global timeout-budget fix and post-setFileInput diagnostics into this branch/PR. — Trent 🏛️

Co-Authored-By: Cody <builder.bot@easymeta.au>
@mylukin

mylukin commented May 16, 2026

Copy link
Copy Markdown
Author

Retry for NEEDS WORK

上次 FAIL 原因:

  1. --timeout 文案是 full flow,但实现把 details wait 和 final publish wait 各自重置为 420s,file selector 还固定 45s。
  2. setFileInput 后没有验证浏览器端 input.files.length / 文件名 / modal / URL,导致 details dialog did not appear before timeout 无法定位根因。

本次修复:

  • --timeout 改为单个 full-flow deadline:YouTube publish 一开始创建 flowDeadlineMs,file input selector、details dialog wait、final publish wait 全部消费同一个剩余时间,不再分阶段重置。
  • setFileInput 之后立即采集并校验上传诊断:input.files.length、文件名、当前 URL、modal title、是否仍在 file picker、是否已经到 details 页面。
  • details dialog 超时时错误信息带诊断摘要,能区分“文件没挂上 / 仍在选择文件页 / 已到 details / 页面状态异常”。

验证:

  • npm run typecheck
  • npm run build
  • npm run test:adapter -- clis/youtube/publish.test.js ✅ 10/10

Commit: d444e948a24e82514eb340448575c8b38eabd664

@mylukin

mylukin commented May 16, 2026

Copy link
Copy Markdown
Author

Retry Review 结论:NEEDS WORK

这轮两个核心修复方向基本对:全局 deadline 已接入 details/final wait,setFileInput 后也有诊断了。但现在 PR 还不能过,CI 红是这次改动直接引入的。

Blocking

  • clis/youtube/publish.js:122collectUploadDiagnostics() 返回的内部诊断对象里含 url,触发 silent-column-drop 审计;CI build (ubuntu-latest) 已失败。
    • 证据:npm run check:silent-column-drop 报:youtube/publish clis/youtube/publish.js missing=[detailsReady, fileInputs, filePickerVisible, modalTitle, text, title]
    • 根因:该审计只要看到对象里有已声明 column(这里是 url),就会把同对象其它 key 当成可能被 CLI 表格吞掉的输出字段。这个对象是内部诊断,不应该用会和公开 columns 重叠的 key。
    • 修复:不要更新 baseline,也不要把这些内部诊断 key 加进 command columns。把内部诊断对象 key 改成不与输出 columns 重叠的名字,例如 pageUrl / pageTitle / dialogTitle / bodyText / inputs / pickerVisible / isDetailsReadyformatUploadDiagnostics() 对应改掉即可。

已验证

  • ✅ 本地 npm run typecheck 通过。
  • ✅ 本地 npm run build 通过。
  • ✅ 本地 npm run test:adapter -- clis/youtube/publish.test.js 通过,10/10。
  • setFileInput 已改为接收剩余 timeout,clis/_shared/video-publish.js 不再固定 45s。
  • ✅ post-file-input 诊断的方向对,能覆盖 input.files.length、文件名、URL/modal/body 文案。

总结:NEEDS WORK(1 个 blocking:CI silent-column-drop)。 修完这个再 @ 我,我只复验 CI gate + 这两个 timeout/诊断点。

— Trent 🏛️

Co-Authored-By: Cody <builder.bot@easymeta.au>
@mylukin

mylukin commented May 16, 2026

Copy link
Copy Markdown
Author

Retry for NEEDS WORK

上次 FAIL 原因:

  • CI build (ubuntu-latest)npm run check:silent-column-drop 红。
  • 根因是 collectUploadDiagnostics() 内部诊断对象使用了公开 column 同名 key(尤其 url),触发 silent-column-drop 审计把其它诊断字段识别成可能被 CLI 表格吞掉的输出字段。

本次修复:

  • 不更新 baseline,不把诊断字段加进 columns。
  • 仅把内部诊断 key 改名避开公开 columns:url/title/text/fileInputs/filePickerVisible/detailsReady/modalTitlepageUrl/pageTitle/bodyText/inputs/pickerVisible/isDetailsReady/dialogTitle
  • formatUploadDiagnostics() 和相关 adapter tests 同步使用新 key,保留同等诊断信息。

验证:

  • npm run check:silent-column-drop ✅ no new violations(提示 resolved baseline entry:twitter/list-add ...,非本 PR 改动;未改 baseline)
  • npm run typecheck
  • npm run build
  • npm run test:adapter -- clis/youtube/publish.test.js ✅ 10/10

Commit: c9bee3fba23b2d9ef3f47c1755cf7670f4285a6f

@mylukin

mylukin commented May 16, 2026

Copy link
Copy Markdown
Author

Retry Review 结论:NEEDS WORK

silent-column-drop 这个 blocker 已修掉,但 PR 现在仍然不能 PASS:CI 又被 typed-error lint 卡住了,还是这次诊断字符串引入的问题。

Blocking

  • clis/youtube/publish.js:150 / clis/youtube/publish.js:151formatUploadDiagnostics() 里用了 || 'unknown' sentinel fallback。
    • 证据:GitHub build (ubuntu-latest) 失败在 npm run check:typed-error-lint;本地复现同样失败:
      • silent-sentinel youtube/publish clis/youtube/publish.js:150`pageUrl=${diagnostics.pageUrl || 'unknown'}`
      • silent-sentinel youtube/publish clis/youtube/publish.js:151`dialogTitle=${diagnostics.dialogTitle || 'unknown'}`
    • 修复:不要更新 baseline。这里是诊断字符串,不需要伪造 unknown。最小改法:用 helper 只在字段有值时输出,例如 diagnostics.pageUrl ? \pageUrl=${diagnostics.pageUrl}` : ''diagnostics.dialogTitle ? ... : '',或者统一 formatOptional(label, value)` 返回空字符串。

已验证

  • npm run check:silent-column-drop 通过:new=0,只提示既有 twitter/list-add resolved baseline,和本 PR 无关。
  • npm run typecheck 通过。
  • npm run build 通过。
  • npm run test:adapter -- clis/youtube/publish.test.js 通过,10/10。
  • ✅ 原两个 gate 没回退:full-flow deadline 还在;setFileInput 后诊断还在。

总结:NEEDS WORK(1 个 blocker:typed-error lint)。 修完后请跑完整 CI gate 里的两个检查:npm run check:silent-column-dropnpm run check:typed-error-lint

— Trent 🏛️

Co-Authored-By: Cody <builder.bot@easymeta.au>
@mylukin

mylukin commented May 16, 2026

Copy link
Copy Markdown
Author

Retry for NEEDS WORK

上次 FAIL 原因:

  • npm run check:typed-error-lint 发现 formatUploadDiagnostics()pageUrl=${diagnostics.pageUrl || 'unknown'} / dialogTitle=${diagnostics.dialogTitle || 'unknown'} 使用 silent sentinel fallback。

本次修复:

  • 不更新 baseline。
  • 仅改诊断格式化:pageUrl / dialogTitle 有值才输出,缺失时跳过字段,不再伪造 unknown
  • 原 full-flow deadline 和 setFileInput 后诊断逻辑未回退。

验证:

  • npm run check:silent-column-drop ✅ no new violations
  • npm run check:typed-error-lint ✅ no new violations
  • npm run typecheck
  • npm run build
  • npm run test:adapter -- clis/youtube/publish.test.js ✅ 10/10

Commit: b4d72afd5b8badefa27acca00b206aea181cfd1b

@mylukin

mylukin commented May 16, 2026

Copy link
Copy Markdown
Author

Retry Review 结论:PASS(Trent 技术复核通过)

这轮我只复验上次剩余 blocker 和前两个 gate,没有发现新的 blocking 问题。

复验结果

  • npm run check:silent-column-drop:通过,new=0;只提示既有 twitter/list-add resolved baseline,和本 PR 无关。
  • npm run check:typed-error-lint:通过,new=0
  • npm run typecheck:通过。
  • npm run build:通过。
  • npm run test:adapter -- clis/youtube/publish.test.js:通过,10/10。

原 blocking 回归

  • ✅ full-flow timeout:--timeout 现在创建统一 deadline,file selector / details dialog / final publish 共用剩余时间,不再每段各等一整份 timeout。
  • ✅ setFileInput 后诊断:文件挂载校验和 timeout 诊断仍在,且内部诊断字段已避开公开 columns,也没有再用 unknown sentinel。
  • ✅ scope fix:YouTube publish 关键 browser script 仍使用局部 browserLiteral(...) + page.evaluate(...),没有回退到易污染的 evaluateWithArgs 模式。

CI 状态

  • GitHub CI 关键项当前:build ubuntu/mac/windows ✅,unit tests ✅;doc/audit/bun 仍 queued,所以 PR merge state 还是 UNSTABLE
  • 技术 review 结论是 PASS;是否等全部 GitHub checks 出完再合并,交给 Human Gate。

— Trent 🏛️

@myluke myluke closed this May 17, 2026
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.

2 participants