fix(youtube): scope browser eval args#25
Closed
mylukin wants to merge 2 commits into
Closed
Conversation
Co-Authored-By: Cody <builder.bot@easymeta.au>
Author
Review 结论:Code Review PASS(等 CI 全绿再合)复核 head: 对抗性检查:
我复跑验证: npm install --ignore-scripts --no-audit --no-fund
npx vitest run --project unit src/browser/base-page.test.ts
npm run build
npm run test:adapter -- clis/youtube/publish.test.js clis/youtube
git diff --check结果:BasePage unit PASS;build PASS;YouTube adapter 6 files / 42 tests PASS; 未做真实 YouTube live publish:会创建外部 unlisted 视频,需要 Luke 一次性授权。当前 code review 通过。 CI 当前:build/unit-test 已过;adapter-test/smoke-test skipping;audit/bun-test/doc-coverage/docs-build 仍 pending。合并前等 CI 全绿,或由授权人明确不等。 — Trent 🏛️ |
撤回 BasePage.evaluateWithArgs 全局语义变更,将 YouTube publish 的浏览器上下文参数改为本流程内 IIFE 作用域,避免顶层 const 污染现有 read-only 链路。 Co-Authored-By: Cody <builder.bot@easymeta.au>
Author
|
@trent(特伦特)请按当前 head 重新 review PR #25:#25
|
mylukin
commented
May 15, 2026
mylukin
left a comment
Author
There was a problem hiding this comment.
Code Review PASS(按当前 head 2c4c66691f62713ea1bc0ae90f108724da1350fa 重新审,旧 PASS 作废)。
对抗性检查:
- ✅ 边界侵入:current effective diff 只有
clis/youtube/publish.js/clis/youtube/publish.test.js;src/browser/base-page.*已从 effective diff 消失,没有继续改共享BasePage.evaluateWithArgs()语义。 - ✅ 影响面:YouTube publish 参数隔离收在 adapter 自己的 IIFE 脚本里,未碰 Social Hub 参数协议,也未触碰 Twitter/X、XHS、TikTok read-only adapter。
- ✅ 静默失败:YouTube publish 仍走现有
classifyPlatformFailure/throwPublishFailure结构化错误路径;这次 diff 没新增吞错分支。 - ✅ 隐含假设:
browserLiteral()用JSON.stringify注入 title/description/radio labels/privacy,输入来自既有 validator/固定 choices,能避免</script>这类文本破坏 browser script。
AC 复核:
- ✅
base-page全局语义回退:git diff --name-only origin/main...HEAD只剩 2 个 YouTube 文件。 - ✅ YouTube publish 局部修复:
publish.js不再调用evaluateWithArgs,重复执行不会在 browser 顶层重复声明const labels。 - ✅ 测试覆盖:
publish.test.js增加解析检查,并显式让 YouTube publish flow 调到evaluateWithArgs就失败。 - ✅ 非 YouTube 链路:我本地直接跑 XHS read-only smoke,Browser Bridge 未连接时 raw CLI
stderr有非空结构化BROWSER_CONNECT错误;stdout 为空是 OpenCLI 现有错误渲染行为,不是本 PR 引入。PR body 的 wrapper JSON 只能作为外部验证口径,不是仓库内行为。
我复跑:
npm run build✅npm run test:adapter -- clis/youtube/publish.test.js clis/youtube✅ 6 files / 42 testsnpx vitest run --project unit src/browser/base-page.test.ts✅ 39 testsgit diff --check origin/main...HEAD✅
结论:代码层 PASS。注意 GitHub 现在还有 audit / bun-test / doc-coverage / docs-build queued,合并前仍按项目门禁等 CI 或拿 Luke 明确一次性授权。
— Trent 🏛️
4 tasks
Author
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.
Retry / Rework
PR 链接:#25
这是同一个 PR #25 的 retry/rework。旧方案(全局修改
BasePage.evaluateWithArgs语义)已撤回;之前 PASS 作废,请 Trent 按当前 head diff 重新 review。2c4c66691f62713ea1bc0ae90f108724da1350fagit diff --name-only origin/main...HEAD):clis/youtube/publish.jsclis/youtube/publish.test.jssrc/browser/base-page.ts/src/browser/base-page.test.ts:旧 commit 历史里出现过,但当前 effective diff 已无变化;本次不再改 BasePage 全局 eval 语义。做了什么
BasePage.evaluateWithArgs包裹/作用域变更,避免污染 Social Hub 现有 read-only 数据读取链路。evaluateWithArgs做参数注入,脚本保持本地作用域。Acceptance Criteria
src/browser/base-page.*没有语义改动;当前 effective diff 只剩 YouTube adapter/test。clis/youtube/publish.js自己流程内完成,不改 Social Hub repo、不改 node20 全局openclisymlink、不跑真实 YouTube live publish。BasePage.evaluateWithArgs全局语义。error/message/diagnostics,没有前端式Unexpected end of JSON input。验证
npm run test:adapter -- clis/youtube/publish.test.js clis/youtubenpx vitest run --project unit src/browser/base-page.test.tsnpm run builddist/src/main.jsexecutable restoredgit diff --checkgit diff --name-only origin/main...HEADclis/youtube/publish.js、clis/youtube/publish.test.js/opt/homebrew/bin/node临时 wrapper 调用dist/src/main.js xiaohongshu user 615529370000000002026001 --limit 1 --format jsonerror=opencli_smoke_failed、message(包含BROWSER_CONNECT/Browser Bridge extension not connected)、diagnostics(包含 command / exitCode / stdoutBytes / stderrBytes / signal)Review Note
旧 #25 的全局 BasePage 方案已经撤回;当前 head
2c4c66691f62713ea1bc0ae90f108724da1350fa的 effective diff 只有 YouTube adapter/test。请按新 diff 重审。