fix(ci): 数组解析被注释里的 ) 截断 —— 一道门 exit 2,孪生的那道静默把 11 算成 7 - #933
Merged
Conversation
两个 checker 用同一个正则从 `scripts/qa.sh` 里取数组:
re.search(rf"{name}=\(([^)]*)\)", text, re.S)
`[^)]*` 在**第一个** `)` 处停下。而 bash 数组里注释是合法的,注释里出现 `)`
也是合法的。#835 往 L1_TESTS 顶部加了一行:
L1_TESTS=(
# (注册这一步不是可选的 —— 一个没被任何东西调用的套件等于不存在。)
"test823-l1-concurrency-cap"
...
正则在那个 `)` 处截断,捕获内容里**一个套件名都没有**。
🔴 **判据完全正确,塌的是取集。**
## 两道门吃同一个洞,表现完全不同 —— 这才是要紧的部分
把那行注释注入 `origin/main` 的 qa.sh,A/B 跑:
| checker | 未修复 | 修复后 |
|---|---|---|
| `check-l1-paths-sync.py` | **exit 2**「found no L1_TESTS entries — parse regression, refusing to pass」 | rc=0,17 个套件 |
| `check-qa-trigger-coverage.py` | **rc=0**,`CI-executed: 7` | rc=0,`CI-executed: 11` |
**第二个静默判绿,并且把 11 个套件悄悄算成了 7 个** —— 少的正是
test686 / test746 / test765 / test766(它们只出现在 L1_TESTS 里)。
它照常打印「all 7 CI-executed test directory/ies can re-trigger qa.yml」,
**一句真话,建立在一个塌掉的分母上。**
同一个 bug,一个 fail-closed 所以被看见,一个 fail-open 所以不会。
**看见它的那个救了另一个** —— 否则 trigger-coverage 会带着 7/11 的分母
一直绿下去,而它存在的全部意义就是那个分母。
## 修法
加 `_strip_comments()`:按行剥掉 `#` 之后的内容再匹配。数组元素是 kebab-case
的套件名,不含 `#`,按行剥是安全的。
## 见红
selftest 加两条夹具(照着实际撞红的那行写),然后把 `_strip_comments` 变成
恒等函数(`return text`)验证它们真的守着这件事:
正常: selftest: 10/10 ok rc=0
变异: FAIL 注释里的 ) 不截断数组 → 1 case(s) rc=1
另一条「数组后面别处的 `)` 不影响」用来钉住剥注释没有把范围放宽。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
vansin
pushed a commit
that referenced
this pull request
Aug 18, 2026
冲突两处。
## 一、build-arg 推导:两边各解决一半,取并集
main 侧:从**套件自己的 Dockerfile** 读 `ARG (SOURCE_COMMIT|TESTNNN_SOURCE_COMMIT)`
—— 权威,不靠套件名猜;但只取 `head -1`,**不供给 RUNSH_BLOB**
#835 侧:按套件名推导并**两套命名都传** + 供给 RUNSH_BLOB + git 调用非致命
哪一边都不能单取:
- 只取 main:test823 的 Dockerfile 要 `SOURCE_COMMIT` **和** `RUNSH_BLOB`,
后者拿不到 → 套件在自检第二步 fail-closed,本 PR 的门自己起不来;
- 只取 #835:回退到按名字猜,而 test224/test597 那种不带前缀的 `ARG SOURCE_COMMIT`
是名字推导表达不了的形状。
并集 = main 的 Dockerfile 推导 + 「Dockerfile 声明了 ARG RUNSH_BLOB 才供给」+
#835 的非致命 git。
🔴 非致命 git 不是防御性编程,是硬需求:test823 会在一个**只装了
bash/coreutils/procps、没有 git** 的容器里重放这个脚本(它桩了 docker 和 npm,
没桩 git)。直接 `$(git rev-parse HEAD)` → 127 → `set -e` 当场中断 →
docker 桩一次都没被调用 → 峰值恒为 0 → **闸门自己的回归"通过"得毫无意义**。
逐套件核过推导结果(18 个 L1 套件):
test823-l1-concurrency-cap --build-arg SOURCE_COMMIT=… --build-arg RUNSH_BLOB=…
test686 / test765 / test766 / test746 --build-arg TESTNNN_SOURCE_COMMIT=…
其余 13 个 qa-* (不传)
**只有 test823 多拿一个 RUNSH_BLOB,其余 17 个与 main 逐字相同。**
## 二、`jobs` 那段注释:取 main
main 上是我合 #823 时更正过的版本(原文「恒为 0」不准确,实测采样是
`0 1 1 1 0 1 0 1` —— 不是恒 0,是从来到不了上限值)。
## 顺带记一笔
本 PR 往 L1_TESTS 里加的那行注释含一个 `)`,把 `check-l1-paths-sync` 的数组
正则 `[^)]*` 截断了(exit 2)。那是**那道门的取集缺陷**,不是本 PR 的问题,
已由 #933 单独修掉 —— 并且在那里发现它的孪生 checker 吃同一个洞却**静默判绿**,
把 11 个套件算成 7 个。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
vansin
pushed a commit
that referenced
this pull request
Aug 18, 2026
合完 #933(修好数组解析)之后,`check-l1-paths-sync` 立刻报出本 PR 的一个真缺口: ::error file=scripts/qa.sh::L1 suite 'test823-l1-concurrency-cap' is run by qa.sh but no `paths:` entry in .github/workflows/qa.yml matches tests/test823-l1-concurrency-cap/. Editing that suite will not trigger the workflow that runs it, and nothing else would report that. 也就是:**套件注册进了 L1_TESTS,但改这个套件不会触发跑它的那条 workflow。** 对一个「测这道闸门自己」的套件来说,这一格尤其要命 —— 改坏了它自己不会响。 `pull_request.paths` 与 `push.paths` 各补一条。 复核: check-l1-paths-sync.py 18 个 L1 套件 / 21 条 path,全部有触发 rc=0 check-qa-trigger-coverage.py CI-executed 12 个,全部能重触发 qa.yml rc=0 🔴 时间顺序值得记一笔:这个缺口在 #933 之前**是看不见的** —— 那时解析器被 注释里的 `)` 截断,`l1_suites()` 返回空,门 exit 2 报的是「parse regression」。 修好取集之后,它报的才是真正的问题。**门坏掉的时候,它连自己在漏什么都说不出来。** Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
vansin
pushed a commit
that referenced
this pull request
Aug 18, 2026
三处冲突: .github/scripts/check-l1-paths-sync.py 取 main .github/scripts/check-qa-trigger-coverage.py 取 main .github/workflows/qa.yml 并集 前两个:main 上已经有 `_strip_comments()`(#933 修的:数组正则 `[^)]*` 被注释里的 `)` 截断)。本分支带的是修之前那版,取 main 不丢任何东西。 qa.yml:本分支往 `paths:` 加了 4 条 docs-site 相关的,main 侧那一段没有改动 (冲突块的 theirs 侧是**空的**)。取并集 = main 的全部 + 本分支这 4 条,零重复。 🔴 记一笔:我第一版的解冲突脚本正则写成 `<<<<<<< HEAD\n(.*?)\n=======\n(.*?)\n>>>>>>>`,要求两侧**各至少一行**; 而这次 theirs 侧是空的(`=======` 紧接 `>>>>>>>`),于是**一处都没匹配上**, 断言 `'<<<<<<<' not in s2` 当场红,文件被写成了带标记的坏 YAML。 `check-l1-paths-sync` 立刻报 `yaml.scanner.ScannerError` —— **门在这里替我兜住了**。 正则改成 `(.*?)=======\n(.*?)>>>>>>>`(不强制两侧非空)。 合并后跑过: yaml.safe_load OK,6 个 job 名两两不同 pr paths 24 条,零重复 check-l1-paths-sync.py rc=0(17 个 L1 套件 / 24 条 path) check-qa-trigger-coverage.py rc=0 scripts/check-doc-source-pins.py OK(失效 pin 4 / 基线 4) scripts/check-mcp-tool-anchor-sections.py OK(67 条锚串全部落在对的 tool 段) .github/scripts/check-doc-symbol-anchors.py OK Co-Authored-By: Claude Opus 5 <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): bash 数组解析器被注释里的
)截断 —— 一道门 exit 2,它的孪生兄弟静默判绿两个 checker 用同一个正则从
scripts/qa.sh里取数组:[^)]*在第一个)处停下。而 bash 数组里注释是合法的,注释里出现)也是合法的。#835 往 L1_TESTS 顶部加了一行:
正则在那个
)处截断,捕获内容里一个套件名都没有。🔴 判据完全正确,塌的是取集。
两道门吃同一个洞,表现完全不同 —— 这才是要紧的部分
把那行注释注入
origin/main的 qa.sh,A/B 跑:check-l1-paths-sync.pycheck-qa-trigger-coverage.pyCI-executed: 7CI-executed: 11第二个静默判绿,并且把 11 个套件悄悄算成了 7 个 —— 少的正是
test686 / test746 / test765 / test766(它们只出现在 L1_TESTS 里)。
它照常打印「all 7 CI-executed test directory/ies can re-trigger qa.yml」,
一句真话,建立在一个塌掉的分母上。
同一个 bug,一个 fail-closed 所以被看见,一个 fail-open 所以不会。
看见它的那个救了另一个 —— 否则 trigger-coverage 会带着 7/11 的分母
一直绿下去,而它存在的全部意义就是那个分母。
修法
加
_strip_comments():按行剥掉#之后的内容再匹配。数组元素是 kebab-case的套件名,不含
#,按行剥是安全的。见红
selftest 加两条夹具(照着实际撞红的那行写),然后把
_strip_comments变成恒等函数(
return text)验证它们真的守着这件事:另一条「数组后面别处的
)不影响」用来钉住剥注释没有把范围放宽。Co-Authored-By: Claude Opus 5 noreply@anthropic.com