本技能介绍如何使用命令行`gh`只读查看GitHub issue正文和评论,支持通过编号或URL定位,也可指定其他仓库,并说明如何提取大量评论。
- 查看issue正文和评论
- 通过URL读取issue
- 查看其他仓库的issue
本技能帮助判断编译器测试输出差异是否符合代码改动意图,分别审查用户可见的诊断信息和内部输出,查找可能隐藏的回归,并在自动更新后检查测试。
Instructions for judging whether changes to file test output (`// CHECK:STDOUT:` and `// CHECK:STDERR:` lines) are correct, which changes are acceptable churn, and which are regressions in disguise.
实测评分 未实测
查看安装方法本技能介绍如何判断 Carbon 工具链测试中 // CHECK:STDOUT: 和 // CHECK:STDERR: 行的更新是否正确。自动更新后测试可能通过,但这并不能证明新行为符合预期。审查时要为每项变化说明原因,并分别检查用户可见的诊断信息(标准错误)和内部表示(标准输出)。指令、类型和控制流等结构性变化需要逐项解释;重命名和位置编号变化则可能是机械性变化。将诊断变化与更新前的预测对照,并在更新结果收敛后检查测试运行情况和文件名前缀。
测试输出自动更新后,需要判断是否可以接受差异时,可以使用本技能。重构期间检查意外的诊断变化,或确认内部输出变化是否能由代码改动解释时,也适用。
本技能不要求手动编辑 // CHECK:STDOUT: 或 // CHECK:STDERR: 行。检查过程涉及代码库的测试更新流程和运行测试。
本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。
AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。
不计入评分。 由 AI(OpenAI Codex)于 2026年10月26日 评估。仅供参考,安装前请同时查看原文。
安装前可以查看交给 AI 代理的指令内容。
Most toolchain work moves file test output. ./toolchain/autoupdate_testdata.py
rewrites the // CHECK:STDOUT: and // CHECK:STDERR: lines in
toolchain/*/testdata/ to match current behavior, so after running it the tests
pass again whether or not the new behavior is right. Deciding that the new
output is the output you wanted is a separate, manual step, and it is the step
this skill covers.
Three skills divide the work:
[!IMPORTANT] Never hand-edit
// CHECK:STDOUT:or// CHECK:STDERR:lines. Everything below is about changing the code until the generated output is right, never about editing the output to match the code.
Every line of testdata churn must have a cause you can name. Not "it is similar to the other changes", not "the tests pass now" — an actual sentence saying which code change produced it and why that is the intended result.
A diff you cannot narrate is a diff you have not reviewed. Changes you cannot explain are where regressions hide, because a regression and an intended change look exactly alike once the autoupdater has written them down.
[!CAUTION] Autoupdating is destructive to your evidence. Once the autoupdater has run, the previous expectations are gone from the working copy. Read the diff after every autoupdate run, and if something changed for a reason you cannot name, fix the code before autoupdating again. Recovering the old expectations later means reverting and re-running.
Treat them separately; they have different standards of proof.
STDERR is user-visible behavior. These are the diagnostics a Carbon programmer sees. A change here is a change to the language implementation as users experience it, so each one needs an individual justification. For a refactoring, the expected STDERR diff is empty.
STDOUT is internal representation. SemIR dumps, parse trees, LLVM IR. Users never see it. Churn here is normal and often unavoidable, so the standard is not "no change" but "no change I cannot account for".
For a change that is supposed to preserve behavior, write the list of accepted STDERR changes down before you autoupdate, and keep it current. Order matters more than form: written first, the list is a prediction the diff can falsify; written afterwards, it is a description of whatever happened, and describes a regression exactly as well as an intended change.
The list does not have to be a deliverable. Scratch notes you never publish do the job, because the work is in committing to the list, not in presenting it. What a reader needs is not the list but its exceptions: diagnostics that changed without being predicted, and predictions that did not occur. Both are findings. The matches are not, and reporting them buries the two entries that matter.
Sort each STDOUT change into mechanical or structural.
Expected, and cheap to accept in bulk once you have confirmed the pattern:
%x.loc18_46.3 embed a line,
column, and disambiguating index. Two different events move them:
[!TIP] Mechanical churn is usually wide and shallow: the same substitution, repeated across many files. If a "mechanical" pattern needs a different explanation in each file, it is not mechanical.
Each of these needs its own explanation:
[concrete = ...], [symbolic = ...], or other constant-value
annotations.--dump-raw-sem-ir output when you did
not intend to change the id layout.A diff that removes instructions looks like an optimization. Whether it is one depends on what the changed function owes its caller, and two functions can produce the same shrinking diff for opposite reasons:
The instruction count is identical evidence in both cases, so it cannot be the thing you judge. Decide what the function is required to produce; the count follows from that.
The same reasoning runs in reverse: a diff that adds instructions is not automatically a regression.
The fail_ and todo_ prefixes (see
Toolchain tests) say how much the recorded
diagnostics are worth:
fail_... — the test should and does produce errors. The recorded
diagnostic is the specification. Changing it is a user-visible behavior
change and needs justification on its own merits.fail_todo_... — the test produces errors (or crashes) but shouldn't,
or produces the wrong errors. The recorded diagnostic is explicitly not
the specification; the file exists to record that today's behavior is wrong.
Changing it replaces one wrong answer with another. That is acceptable when
you can say why the new message follows from your change and why it is no
further from the intended eventual behavior — which, for many such files, is
no diagnostic at all.todo_fail_... — the test should produce errors but does not. Gaining a
diagnostic here may be progress, not a regression. Either way the file
must be renamed, since the framework requires a fail_ prefix on any file
that errors: fail_... if it now produces the right error, fail_todo_...
if the error is the wrong one. Both renames make the test pass, so record
which case it is instead of letting the rename settle it.todo_... — behavior is wrong but produces no errors, and shouldn't.
Gaining a diagnostic here is a regression unless you can argue otherwise.[!IMPORTANT] This is a reason to look at the filename before judging a diagnostic change, not a license to ignore
todo_files. "It was already broken" does not excuse making it differently broken for no reason.
If your change moves a test between the states above, the prefix must move with
it: when the test is fixed, when it starts failing, and when it starts failing
differently. The correspondence between the fail_ prefix and whether
compilation actually failed is enforced by the test framework, not by the
autoupdater, so it surfaces when you run bazelisk test and not when you
autoupdate. Autoupdating is not a substitute for running the tests.
Only that half of the name is checked. Nothing enforces todo_, so a file whose
behavior you have just fixed can keep its todo_ prefix indefinitely and still
pass. A missing fail_ stops the build; a stale todo_ is silent, and is yours
to catch.
When a fix drops a file's prefix, also check that the file still belongs where it is and that its comments do not still describe the old broken behavior.
When a diagnostic becomes less specific — a general "unsupported" message replacing one that named the problem — that usually means a code path stopped finding information it previously had. Sometimes that is correct: the information was misleading, and the old message was confidently wrong.
Do not accept it silently and do not reject it reflexively. Say which direction it moved and whether the new message is closer to or further from the eventual intended behavior.
If you removed something you believed was doing work and no testdata moved, that is not a missing test run — it is the proof that the thing was a no-op. Say so explicitly; it is one of the strongest pieces of evidence a refactoring can produce.
The converse is also informative. If you expected a path to churn and it didn't, either your model of the code is wrong or that path is untested. Find out which, and consider adding a test before continuing.
Set a rough expectation for the size of the diff before you run the autoupdater, and treat a large mismatch in either direction as a finding.
Editing test input (the Carbon source, not the CHECK lines) to make a diff look better is a behavior change in disguise. Deleting a test that now produces awkward output is worse. If a test's input has to change, that is a separate, explicitly-justified change, not diff cleanup.
NOAUTOUPDATE files. Their expectations are maintained by hand. They
fail under bazelisk test rather than being silently rewritten._test.cpp. When several assertions in one of these break together, often
only the first failure is reported, so fixing it can reveal another. Re-run
until clean rather than assuming one fix was the whole repair.testdata/, and documentation that quotes compiler
output.Autoupdate everything, then read the diff a directory at a time. Passing no paths is the default and updates every file test in the toolchain:
./toolchain/autoupdate_testdata.py
Narrow the scope only while iterating on one subdirectory you know you are not done with, where each round would otherwise regenerate output you have already read:
./toolchain/autoupdate_testdata.py toolchain/check/testdata/SUBDIR/**/*
The globs are expanded by the shell; the script filters its arguments to
.carbon files under a testdata/ directory.
[!TIP] If intermediate states crash on
CARBON_CHECKfailures, pass--non-fatal-checksso you can see the full set of downstream damage in one run instead of one crash at a time.
[!IMPORTANT] Return to the full scope before judging the diff. Whether churn is proportional to the change, and whether a change to one phase moved another phase's testdata, are only visible across everything.
One pass is not always enough, because the autoupdater's output is part of its
own input. // CHECK:STDERR: lines sit inline, immediately above the source
line they describe, and the compiler reads them as comments in the file.
Gaining or losing a diagnostic therefore moves every source line below it.
Within a single run, the compiler has already read the file as it was, so the two kinds of output end up in different states:
[[@LINE+N]], and the autoupdater recomputes N as it
places them.%x.loc18_46.3 embed
an absolute line and column with no filename attached, and the autoupdater
only remaps file.carbon:18-style references. Nothing rewrites the loc,
so it still describes where the instruction was before the diagnostic
lines moved it.Running again compiles the shifted file and the names catch up. The diagnostic set does not change this time, so nothing shifts again and a third run is a no-op. Keep running the autoupdater until it stops changing files: one pass when the diagnostics held still, two when they didn't.
[!WARNING] The intermediate state is self-inconsistent, not just unfinished: its
locnames describe a file layout that no longer exists. Keep reading the diff after every run — that rule does not change — but do not chase positional churn to a cause until the file has converged, and do not present the diff until then either.
The converging pass should be positional renumbering and nothing else. If it
moves an instruction, a type, or a constant value, then something other than a
loc name is sensitive to where lines fall in the file. Find out what before
accepting it.
The file tests do catch a file left unconverged, since each test re-runs the
autoupdate in memory and fails with
Autoupdate would make changes to the file content when the result differs. But
that arrives at bazelisk test time, after you have already read a diff that
was describing a file which had moved out from under it.
Inspect the diagnostics first, since that is the acceptance criterion:
# STDERR-only view, with jj.
jj --no-pager diff --git 'glob:toolchain/*/testdata/**' \
| grep -E '^[-+].*CHECK:STDERR'
# The same, with git.
git diff -- 'toolchain/*/testdata/*' \
| grep -E '^[-+].*CHECK:STDERR'
For a structured view separating test input, STDERR, and STDOUT changes, use the helper from the Summarize testdata changes skill:
jj --no-pager diff --git 'glob:toolchain/*/testdata/**' \
| python3 .agents/skills/summarize_testdata_changes/scripts/parse_diff.py
git diff -- 'toolchain/*/testdata/*' \
| python3 .agents/skills/summarize_testdata_changes/scripts/parse_diff.py
The argument after the tool name is not interchangeable: glob:... is a jj
fileset, -- ... is a git pathspec. --git and --no-pager are jj flags; git
already emits this format and skips the pager when piped.
Then run the tests, which is what catches prefix mismatches and non-autoupdated expectations:
bazelisk test //toolchain/...
See the Bazel usage skill.
Before presenting a testdata diff as finished:
loc
name describes a stale line numbering.还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
本技能介绍如何使用命令行`gh`只读查看GitHub issue正文和评论,支持通过编号或URL定位,也可指定其他仓库,并说明如何提取大量评论。
本技能为在 Carbon 代码库中工作的 AI 助手规定文件查看、搜索和编辑工具,并说明临时文件的存放与清理规则,以及何时可以编写和运行自定义程序。
了解如何在 Carbon 项目中通过 Bazelisk 构建、测试和运行程序,包括指定目标、启用 ASan,以及系统依赖变更后重建缓存。
本技能介绍如何为Carbon编译器添加内置函数,包括类型注册、签名验证、常量求值、运行时LLVM IR生成、Prelude绑定,以及使用最小Prelude编写针对性测试。
了解 Carbon 工具链对 Bazel、C++、Carbon、Markdown 和 Python 文件的格式规范,并查看注释、文档、命名、设计及提交说明的写作要求。
本技能介绍如何在Carbon工具链中添加或修改错误和警告,包括注册诊断类型、用带类型的参数构造消息、为源码位置添加标签和上下文,以及检查措辞规范和测试覆盖。