Repository navigation
ci(showcase-smoke): 诊断产物按真实 outputDir 上传,失败无产物即报错 (#4931 第 2 缺陷) - #5913
Merged
Merged
Conversation
Showcase Smoke 的上传步骤配的是 examples/app-showcase/playwright-report/, 而这个目录在 CI 下从来不会被创建 —— examples/app-showcase/playwright.config.ts 的 reporter 是 `[['github'], ['list']]`(实测 CI=1 求值),两个都只写 stdout, 没有 html reporter。于是不是「路径写偏了一层」,而是「路径指向一个不存在的 产物」。加上 upload-artifact 的 `if-no-files-found` 缺省为 warn,错配只降成 一条 warning:run 30796529117(2026-08-03,3 failed)的日志里是 ##[warning]No files were found with the provided path: examples/app-showcase/playwright-report/. No artifacts will be uploaded. 该 run 的 artifacts 总数为 0,上传步骤自身仍判绿 —— 每一次失败的截图、trace、 error-context 都随 runner 回收丢掉,这正是一个半数失败的探针长期无从定位的 直接原因。 改动(仅本 workflow 文件): - 上传路径改为 examples/app-showcase/test-results/ —— 由 Playwright 自己解析 确认的 outputDir 绝对路径落点(config 未声明 outputDir,取默认值并按 config 所在目录解析);upload-artifact 的 `path` 按仓库根解析,故保留完整前缀。 未把 playwright-report/ 一并列上:它今天不可能有内容,列上等于留一条永远 为空的死声明。补 html reporter 属 config 面改动,已另行立单。 - 失败路径 `if-no-files-found: error`,并把前提从宽泛的 `failure()` 收窄到 `steps.smoke.outcome == 'failure'`:smoke 失败就一定留下了证据,空的 test-results/ 本身该报警;而更早的步骤倒下时本就无物可收,不该再叠一条 误导性的红。条件保留 `failure()` 是因为不含状态函数的 `if:` 会被套上隐式 `success()`,那样条件永远为假。 - 新增一条绿色路径上传(`ignore`,不会把夜跑弄红):CI 下 `retries: 1`, 「重试后才绿」的 run 会在 test-results/…-retry1/ 留下第一次尝试的 trace, 而那恰是第 1 缺陷最需要的证据 —— 只在 red 时收会永远错过 flaky-green。 验证边界:workflow 无法本地执行。已做 YAML 解析 + 步骤断言、 pnpm check:workflow-status-functions、pnpm check:nul-bytes,并用 Playwright 自身求值确认 outputDir/reporter/retries;真实产物验证发生在下一次夜跑。 本 PR 只修第 2 缺陷,不动探测条件与 spec 文件,故不 Close 本单。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GX3sL71LFq8m2usg6VqTSE
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
os-zhuang
marked this pull request as ready for review
August 6, 2026 11:38
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.
Part 2 of #4931(第 1 缺陷待本修复产出的 trace 到位后另行诊断)
Showcase Smoke 的诊断产物从未上传成功。本 PR 只修这一条(#4931 的第 2 缺陷),
不碰第 1 缺陷:探测条件与
e2e/showcase-smoke.spec.ts一行未动。实测到的真实成因(比 issue 描述更糟一层)
issue 说「路径写偏了:配的是
playwright-report/,Playwright 实际写在test-results/」。按origin/main实测,前半句成立,但错配的性质不是「偏了一层目录」,而是指向一个在 CI 下永远不会被创建的产物:
outputDir未声明 → 取默认test-results/,按 config 所在目录解析playwright test --list --reporter=json,读config.projects[].outputDir/…/examples/app-showcase/test-resultsCI=1求值playwright.config.ts[["github"],["list"]]—— 两个都只写 stdoutretries在 CI 下为 11(⇒ 存在「重试后才绿」的状态)path按仓库根解析,不受working-directory影响examples/app-showcase/…if-no-files-found缺省即warn,可取erroractions/upload-artifact@v7的action.ymlwarn(default)/error/ignore也就是说:
playwright-report/是 html reporter 的输出目录,而 CI 从来不加载 htmlreporter,所以那个目录不是「装错了东西」,而是空气。叠上
if-no-files-found的缺省
warn,错配只降成一条 warning —— run30796529117
(2026-08-03,3 failed)的日志:
同一 run 的 artifacts 总数 0,而「Upload report on failure」这一步的
conclusion 是 success。而同一份日志里 Playwright 自己把落点报得很清楚:
于是每一次失败的截图 / trace / error-context 都随 runner 回收丢掉 —— 这正是一个
半数失败的探针长期无从定位的直接原因。
改动(仅
.github/workflows/showcase-smoke.yml)outputDir:examples/app-showcase/test-results/。没有把
playwright-report/一并列上:它今天不可能有内容,列上等于留一条永远为空的死声明,还会让下一个读者以为存在一份可浏览的 HTML 报告。补 html
reporter 属
playwright.config.ts面的改动,超出本单文件面,已按Prime Directive chore: version packages #10 另行立单(见下)。
if-no-files-found: error,且前提从宽泛的failure()收窄到failure() && steps.smoke.outcome == 'failure'(给 smoke 步骤加了id: smoke)。理由是两侧都要成立:smoke 失败就一定留下了证据,空的
test-results/本身就该报警;但若倒在更早的步骤(
pnpm install/ vendor Console),这里本来就无物可收,不该再叠一条误导性的红。条件里保留
failure()不是装饰 ——GitHub 会给任何不含状态函数的
if:套一层隐式success(),写成if: steps.smoke.outcome == 'failure'会让条件永远为假。这条推理正是scripts/check-workflow-status-functions.mjs写下的规则(该 gate 的 scope 有意只覆盖 job 级,step 级在其射程外,所以这里靠人写对 + 注释留证)。
if: success()+if-no-files-found: ignore,永远不会把夜跑弄红):CI 下
retries: 1,「重试后才绿」的 run 会在test-results/…-retry1/留下第一次尝试的 trace,而那恰是第 1 缺陷(图表面板时红时绿)最需要的证据。只在 red 时收会永远错过 flaky-green —— 而最近三次
夜跑(08-04/05/06)都是绿,下一次是绿的概率不低,所以这条不是锦上添花:
它决定了「下一次夜跑产出 artifacts」这个重启条件在绿色路径上也能满足。
产物名一并从
showcase-smoke-report改为showcase-smoke-diagnostics/showcase-smoke-flaky-diagnostics:收的是原始诊断件,不是 report。全仓无任何消费方引用旧名(仅本 workflow 自身出现过)。
验证与验证边界
workflow 无法本地执行,所以把能测的都测了,不能测的写清边界:
which actionlint空,node_modules/.bin无),故以YAML 解析 + 步骤级断言替代:11 个 step 全部解析,两条上传步骤的
if/path/if-no-files-found逐字回读一致。pnpm check:workflow-status-functions:✓ --self-test: 34 assertions+OK (scanned 22 workflow file(s), 39 job(s), 21 job-level if: …)。pnpm check:nul-bytes:OK (scanned 5704 tracked text file(s));另对改动文件做了控制字节自扫,clean。
猜测,也不是照抄文档。
workflow_dispatch触发器本就存在,但手动跑一次要 14 分钟并且只有在 smoke 恰好失败时才能验证
error分支;真实产物验证发生在下一次夜跑(每日 07:00 UTC)。若那次是绿,验证的是第 3 条(flaky 分支或静默跳过);若是
红,验证的是第 2 条(artifacts 非空)。
.github/,不发布任何东西 ⇒ 打skip-changeset。范围与后续
examples/app-showcase/e2e/showcase-smoke.spec.ts、未动探测条件、未动content/docs/releases/**。不可诊断,按 issue 自己的排序等本修复的产物到位后再回来定性。
Generated by Claude Code