fix(ci): ReproSpec.ci.skip —— 让 Windows-only / 手工预置类 spec 在 Ubuntu CI 上自报豁免 (closes #3) - #4
Merged
Merged
Conversation
issue #3 Gap 1 的纯函数:把发现的 ReproSpec 按 ci.skip 分桶, included 喂 pr-review.yml 的 repro matrix,excluded 喂 verdict job 的豁免列表(让 hook-moment-block 这类需手工预置的 spec 在 CI 上被显式豁免,而不是 fail)。 TDD 红→绿 7 个 case 覆盖:空数组 / 无 ci / ci.skip=false / 仅 reason / skip+reason / skip 无 reason / 混合保序。 下一步:repro-types.ts 加 ReproSpec.ci 字段、list-ci-specs.ts IO 壳、pr-review.yml list-specs job 调用。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
issue #3 Gap 1 类型层:加 optional ci?: SpecCi 字段到 ReproSpec, 让 spec 自报「在 CI 上能不能跑」,而不是 CI workflow 硬 grep 文件。 SpecCi 与 scripts/verify/list-specs-core.ts 的 SpecCi 是同构(后者 在 functional core 不能依赖 ReproSpec 全部类型),behaviorally 等价。 无功能影响 —— 现有 spec 不带 ci 字段 = 行为不变。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
issue #3 Gap 1 IO 壳 + 首个真受益 spec: scripts/verify/list-ci-specs.ts: readdir fixtures/repro-specs/*.ts → 动态 import → 抽 spec.ci → 调 list-specs-core.filterCiSpecs → 把 { included, excluded } JSON 打到 stdout。给 pr-review.yml 的 list-specs job 读。 fixtures/repro-specs/hook-moment-block.ts: 加 ci: { skip: true, reason: '需 $TA_DEMO_STAGE 下两份知识库目录 预置 + 录 GIF 仅 Win32 可行' }。本地 Windows 手工跑仍然有效;CI 上 会被 list-specs 过滤掉,verdict 把它当显式豁免。 Smoke-test: $ tsx scripts/verify/list-ci-specs.ts {"included":[],"excluded":[{"file":"fixtures/repro-specs/hook-moment-block.ts", "reason":"需 $TA_DEMO_STAGE ... 录 GIF 仅 Win32 可行"}]} 下一步:pr-review.yml 改用此 CLI。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
issue #3 Gap 1 最后一拼:把 list-specs job 从「inline bash find」改成 「调 scripts/verify/list-ci-specs.ts 读 spec.ci.skip 分桶」。 变更: - 拆出 label-shortcut step:skip-repro label 命中即早退,不必再装 pnpm/node 跑 list-ci-specs(优化) - 没命中标签 → 跑 setup-repo composite 装依赖 → npx tsx list-ci-specs.ts → 解析 JSON 输出 specs/excludedSpecs/skipReason 三个 output - verdict job 拿 excludedSpecs 拼成 `显式豁免: file (reason); ...` 附在 repro_summary 后,verdict comment 上一眼可见哪些 spec 被豁免 行为差异(对 hook-moment-block 这种 ci.skip=true 的 spec): before: list-specs 把它放进 matrix → repro job Ubuntu 上跑 → fail → verdict=fail after: list-specs 把它放进 excluded → repro matrix 为空 → repro job skipped(skipReason 非空) → repro_ok=true → verdict 不再因它 fail skip-repro label(PR 级豁免)语义不变;新增的 spec.ci.skip(spec 级豁免) 是 PR 级豁免的补集。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
❌ 远程评审 verdict: failcommit
要修这个失败,请在本地按 |
This was referenced May 15, 2026
libz-renlab-ai
pushed a commit
that referenced
this pull request
May 15, 2026
PR #7 v2 dogfood 第三个 sub-gap:tests + tree-clean 都修过后,verdict job 在 'Post comment + set status' step 仍崩: Error: update comment 失败: gh: Not Found (HTTP 404) 根因(本 session PR #2 引入的 post-pr-comment.ts bug): - line 71: `gh pr view --json comments` 返回 GraphQL node ID(IC_kwDOI...) - line 81: `gh api repos/.../issues/comments/{id}` PATCH 要 REST integer id - 不匹配 → PATCH 404 为什么 PR #2 / #4 没炸:每个 PR 只跑过一次 verdict → 没现成评论可更新 → 只走 CREATE 路径(line 87 `gh pr comment`)→ 没暴露。PR #7 是本仓库 第一个 multi-commit PR:v1 (2798a32) 创了评论 → v2 (1aa98e3) 想更新 → 404。 修复: - 列评论改用 `gh api repos/.../issues/{pr}/comments` —— 返回 REST id, 跟 PATCH 端点格式一致 - CREATE 也改走 REST POST(对称;新评论的 id 直接是 REST 制式,下次能 正确 UPDATE) 这是 dogfood 的核心价值 —— 第一次真有 multi-commit PR 跑流水线就揪出了 首次 ship 时遗漏的 code path bug。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
fix(ci): ReproSpec.ci.skip —— 让 Windows-only / 手工预置类 spec 在 Ubuntu CI 上自报豁免
关闭 issue #3 Gap 1。
背景
PR #2 落地远程评审 workflow 后,首次 dogfood 跑出 verdict=fail —— 因为唯一现存 spec
fixtures/repro-specs/hook-moment-block.ts是「数据驱动差异」(baseline.ref="HEAD",两侧靠 env 切的$TA_DEMO_STAGE/home-empty|loaded切知识库),Ubuntu runner 上既没那俩目录也没TA_DEMO_STAGE,必然 fail。本 PR 让这类 spec 自报「我在 CI 上跑不了」,被 list-specs job 显式过滤掉,verdict 把它当豁免。变更
scripts/verify/list-specs-core.ts(新)filterCiSpecs(specs)—— 按ci.skip把 spec 列表分成included与excluded。Functional Core,严禁 IO importscripts/verify/list-specs-core.test.ts(新)node:test7 个 case:空数组 / 无 ci /ci.skip=false/ 仅 reason /skip+reason/skip无 reason 默认值 / 混合保序scripts/verify/repro-types.tsReproSpec加 optionalci?: SpecCi({skip?, reason?})scripts/verify/list-ci-specs.ts(新)readdirSync(fixtures/repro-specs)→pathToFileURL+ 动态import→ 抽spec.ci→filterCiSpecs→ JSON to stdoutfixtures/repro-specs/hook-moment-block.tsci: { skip: true, reason: "需 $TA_DEMO_STAGE 下两份知识库目录预置 + 录 GIF 仅 Win32 可行" }.github/workflows/pr-review.ymllist-specsjob 拆label-shortcutstep(skip-repro label 早退,不必装 pnpm/node)+setup-repo+npx tsx scripts/verify/list-ci-specs.ts;新加excludedSpecsoutput;verdictjob 把豁免列表附在repro_summary后,verdict comment 上一眼可见哪些 spec 被豁免架构遵守
list-specs-core.ts纯函数,严禁 import fs;IO 在list-ci-specs.ts。list-specs-core.test.ts先写,跑红 → 实现 → 跑绿(7/7)。每个 commit 都跑得通、测试绿。list-specs-core红→绿、ReproSpec.ci类型、list-ci-specsIO 壳 + spec 标记、pr-review.yml接入。验证
预期 dogfood 表现
本 PR 一开,会触发的
pr-review.yml跑应该:list-specsjob —— 读 specci.skip=true→specs=[]+excludedSpecs=[{...}]+skipReason="all-specs-ci-skip: ..."+ 注解 warningrepromatrix ——specs=[]→ 整个 jobskippedtestsjob —— 预期仍 fail(21 个 Matrix baseline 预存失败,不在本 PR 范围,issue [follow-up] PR #2 dogfood 揭示两个预存问题:CI repro 豁免 + Matrix baseline pnpm test 失败 #3 Gap 2)verdictjob ——repro_ok=true(豁免)+tests_ok=false→verdict=fail,但只挂 tests-and-merge-clean 一条,不再因 repro 错挂把「repro 不该挂」的部分修干净,留 Gap 2 作下一个独立 PR。
合并方式
无 Visual proof of work 章节 →
can-auto-merge.ts不会因此豁免;但tests-and-merge-clean还会 fail →can-auto-merge.ts:52仍会因reviewVerdictState !== "success"拒绝自动合 → 回落到 human-merge(等 Gap 2 修了之后,本类纯 CI fixup PR 才能享受全自动)。关联
🤖 Generated with Claude Code