From ca2e355f6490acb4dd237798296f85d808506e8e Mon Sep 17 00:00:00 2001 From: inpac Date: Wed, 18 Nov 2026 18:20:49 +0100 Subject: [PATCH 1/3] ci: accept the GitHub co-author suffix in DCO trailer checks (#204) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: #204(P1-q)。`main` 上的 `dco` 在 `ece86b5` 失败,日志为 `FAIL: ece86b536bef on main has no Signed-off-by trailer`。 ## Change - `scripts/check-dco.py`:新增 `without_coauthor_suffix()`,剥离 GitHub 在 squash 合并时追加到说明末尾的固定一段——一行恰好 9 个 `-`、空一行、逐位 `Co-authored-by: 姓名 <邮箱>`,末尾可有空行。`trailers()` 在调用 `git interpret-trailers --parse` 之前先剥离,正文检查与推送检查因此读到 后缀之上的签名;两者本来就共用这个函数。 - 只剥离这一种形状:分隔行不是恰好 9 个 `-`、分隔行两侧没有空行、后缀里混入 非 `Co-authored-by` 的行、或共同作者行不在最末尾,都原样返回,判定与之前 一致。`---` 补丁分隔行、签名名单、fork 逐提交检查均未改动。 - `tests/repository_hardening/test_check_dco.py`:新增 `CoauthorSuffixTests`, 用 `ece86b5` 的真实说明作夹具(以 `--cleanup=verbatim` 提交,避免 `git commit -m` 的清理把空行折叠掉而掩盖被测形状),并覆盖多个共同作者、 后缀之上没有签名、8/10/9 加空格的三种分隔行、后缀中混入其他 trailer、 分隔行紧贴上一行、共同作者行之后还有正文、签名者不在名单内、CRLF。 正文与推送共用解析的用例新增 5 个后缀子用例。 - `tests/repository_hardening/dco_pr_simulation.py`:新增 5 个工作流形态的后缀 场景。 - `CONTRIBUTING.md` §11、`docs/08-governance/parallel-workflow.md` §5.5、 `docs/07-roadmap/current-status.md` §9:记录该后缀、合并人无需手动删除, 以及签名仍须在正文末尾。 - `SINGLEHOST-SHA256SUMS`:按 `update-manifests.py` 刷新。 ## Problem / counterexample PR 中的提交有多位作者时,GitHub 在合并那一刻把后缀追加到说明末尾,后缀成为 最后一个 trailer 段,`git interpret-trailers --parse` 因此只返回 `Co-authored-by: dsh `,维护者写在正文末尾的 `Signed-off-by` 不被计入。PR 阶段的正文检查看不到这段追加(它发生在合并时), 失败于是落到 `main` 上。 ## Status before → after | 位置 | 之前 | 之后 | |---|---|---| | `scripts/check-dco.py` | 后缀被当作最后一个 trailer 段,签名判为缺失 | 先剥离固定后缀再解析 | | 推送检查 `203249d..ece86b5` | 退出 1(`FAIL: ece86b536bef`) | 退出 0(`PASS: 1 commit(s)`) | | 其他 `---` 行、签名名单、fork 逐提交检查 | 各自判定 | 判定不变 | | `tests.repository_hardening.test_check_dco` | 37 项 | 52 项,另有 5 个共用解析子用例 | ## Tests or proofs 基线 `ece86b536bef2ba422708acf86ed5f743dd4d396`;2026-11-18 本次执行: | 命令 | 退出码 | |---|---| | `python3 -B -m unittest tests.repository_hardening.test_check_dco` | 0(52 项通过) | | `python3 -B tests/repository_hardening/dco_pr_simulation.py` | 0(15 个场景) | | `python3 -B scripts/check-dco.py push --before 203249d --after ece86b5` | 0(`PASS: 1 commit(s)`) | | 同上,改用 `HEAD` 的脚本作对照 | 1(复现原失败) | | 新测试在 `HEAD` 的脚本上运行(对照) | 1(6 项失败) | | `make check` | 0 | | `python3 -B scripts/check-repository-evidence.py --repository .` | 0 | | `python3 -B scripts/check-license-coverage.py --require-git` | 0 | | `python3 -B scripts/update-manifests.py --check` | 0 | | `git diff --check origin/main` | 0 | 未跑 `make test` 全量回归。 ## Residual risk - 剥离只认这一种固定格式。GitHub 若改变追加内容(例如在后缀里加入其他 trailer),检查退回旧判定并让 `main` 上的推送检查失败,不会静默放行。 - 分支前缀 `ci/` 按 Issue 指定,不在 PARALLEL-1 §5.1 列出的三种前缀内。 - 本提交不写 `Signed-off-by`;`ece86b5` 的签名补录按计划卡由维护者在合并前 加入 PR 正文。 ## Documents updated `CONTRIBUTING.md`、`docs/08-governance/parallel-workflow.md`、`docs/07-roadmap/current-status.md`、`SINGLEHOST-SHA256SUMS` --- CONTRIBUTING.md | 1 + SINGLEHOST-SHA256SUMS | 6 +- docs/07-roadmap/current-status.md | 1 + docs/08-governance/parallel-workflow.md | 2 +- scripts/check-dco.py | 48 ++- .../repository_hardening/dco_pr_simulation.py | 13 + tests/repository_hardening/test_check_dco.py | 299 ++++++++++++++++++ 7 files changed, 363 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e4ef971..4f29264 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -193,6 +193,7 @@ squash 合并的提交说明取自 PR 正文(`squash_merge_commit_message = PR - **合并前的签名检查(2026-11-18 起,P1-n;P1-p 起签名身份有两个):** `.github/workflows/dco.yml` 在 PR 阶段读取当前 PR 正文,用与推送检查相同的解析方式(`git interpret-trailers --parse`)判断正文最末尾的 trailer 区是否含 `Signed-off-by: 姓名 <邮箱>`,且签名身份属于 `.github/dco-maintainers.txt` 的 `signoff` 一类(目前为维护者 `inpac ` 与维护者授权的人类协作者 `Ankar `)。签名者可以是两者之一,签名即按 DCO 1.1 为该贡献作确认;代理仍不得签名。`dco` 是必需检查,未通过时合并按钮不可用;签名者编辑正文加上签名后,`edited` 事件自动重跑检查。检查脚本与名单都取自目标分支的受信任检出,PR 修改名单不影响它自己的检查;PR 正文是不受信数据,只经环境变量传给脚本,不执行,也不写入 `GITHUB_ENV` 或 `GITHUB_OUTPUT`。 - **签名写法:** 签名作为正文最末尾的独立一段,前面空一行。正文中只含 `---` 的行会让 Git 把之后的内容当作补丁区,写在其后的签名不会被识别(提交 `7232164` 即因此漏签);CRLF 与 LF 的判定相同。 +- **共同作者后缀(2026-11-18 起,P1-q):** PR 中的提交有多位作者时,GitHub 在 squash 合并那一刻按固定格式在说明末尾追加一段:一行恰好 9 个 `-`,空一行,然后逐位 `Co-authored-by: 姓名 <邮箱>`。签名因此落到倒数第二段,而 trailer 只看最后一段——`ece86b5` 就是这样让 `main` 上的推送检查失败。正文检查与推送检查共用同一个函数,识别这一格式并先剥离再解析;分隔行不是恰好 9 个 `-`、后缀里混有其他 trailer、或后缀不在最末尾时都不剥离,判定与之前一致。合并人无需手动删除这段后缀,但要确认签名仍在正文末尾。 - **外部贡献**(来自 fork 的 PR):每个提交都要在提交说明末尾的 trailer 区带有 `Signed-off-by: 姓名 <邮箱>`,邮箱与提交作者一致,合并提交也不例外;写在正文中间的签署行不算数。用 `git commit -s` 即可自动添加。签名者(维护者或签名名单中的协作者)在合并前于 PR 正文末尾加上签名,维护者再在 `main` 的检出里独立核验提交签名与正文签名(命令见本节末;名单从脚本所在检出读取,PR 正文只作为数据载入,不要拼进 shell 命令)。**在仓库公开后用一次 fork PR 实测确认“缺签时合并受阻、补签后最新头部通过”之前,这项检查对外部 PR 只作提示**。 - **本仓库分支上的工作**(维护者、人类协作者与 AI 代理):只检查签名者,不逐提交检查作者与签名。代理产生的提交不加 `Signed-off-by`,代理也不在 PR 正文中写签名。签名者(维护者,或签名名单中由维护者授权的人类协作者)在合并前于 PR 正文末尾加上自己的签名,该行随 squash 合并成为 `main` 上的提交说明,并统一确认该 PR 中的全部提交。人类协作者可以在自己的提交上用 `git commit -s`,不强制。 - **推送兜底:** `dco.yml` 仍检查推送到 `main` 的提交是否带 `Signed-off-by`,用于发现合并时被改掉的签名。 diff --git a/SINGLEHOST-SHA256SUMS b/SINGLEHOST-SHA256SUMS index 61d685c..5e97ca5 100644 --- a/SINGLEHOST-SHA256SUMS +++ b/SINGLEHOST-SHA256SUMS @@ -392,7 +392,7 @@ a530780f7345500677a990a3d0575f65b2a03dcfcdf560ed7fb04cc698e0fe15 scripts/check- c03ed31936b34cddb1f5ff5645d437ceb37bb51ec988d2b6191812b6f1731db6 scripts/check-claim-codec.py d27db0943ae28698408550d1e4e34f3f0b2e319f63cb1db3aa40cfd85754a028 scripts/check-commitment-bindings.py 73b94bf197b2813a92103bf7114f93bedfbe635d522157a50197d09a0ba3f1fc scripts/check-creation-bindings.py -bba78a46d85f5499543db2c9de265adfed3d49b4adb0bc0264050f433311b444 scripts/check-dco.py +d37cf56ae737d38e3a3e5a46a23f676454cbc7a0d467509bb6d3f6badb5ce19e scripts/check-dco.py 9a963b5df26f853a6c903890488b167b0fcd487969b41c490383289af963bd63 scripts/check-decision-replay.py 1d5dffcbd4e7100ac869883ebcbfae586507c60428a4df697479c7129a4ac9bd scripts/check-deployment-revocation.py 01f6e85ee8300cdaf5c55f7b27ba6891137910d5c9612c49857c2db321b2e890 scripts/check-environment.py @@ -454,8 +454,8 @@ a8c57b9dbd3cdb205a97d90cb535a8a167f744d621de039169a70af7cee2160f tests/formal_m 5e19ecd77a8f4160782160333a157438823bafc9ed11d822a92b1b030cd19502 tests/formal_migration/vectors.json 7f6e90e896bc68a61903fef635b4b825a062b43797593e1d6acee28114fc7ac5 tests/migration_evidence/test_evidence.py 4f9b2235c0cdd889490baf2823601f3196aa33d41d6b85488decf83a4ce19888 tests/migration_evidence/test_public_archives.py -967e8669c670dc38d4deefd2128917e3746686c9fa486768e06f69177e70a1d4 tests/repository_hardening/dco_pr_simulation.py -9775fc0fc4973aa45bae69839881d6d97ed76e90891a258426ccf873464839c9 tests/repository_hardening/test_check_dco.py +ba71ba20c842a0f124c93d0866253dda8933b2a3a20338f5b1d44538f97358c7 tests/repository_hardening/dco_pr_simulation.py +4940c696c180943718f7991f4877e307e5a760c2f11a8de1b10564303a9d0f98 tests/repository_hardening/test_check_dco.py 34ed7a109f77efeadf0190ae04cd07e4aa47a1523ca70548a1f16330c789c3a9 tests/repository_hardening/test_git_sources.py 03ff67ffbd4ff2d63e5fd1f18da6e884c8293812191f0c29e49e5a425523a135 tests/repository_hardening/test_hardening.py cdd63154a0bad204e185f86b94e5ba9caea97e711173896f4e36a101fd335d13 tests/verification_model/closed_form_oracle.py diff --git a/docs/07-roadmap/current-status.md b/docs/07-roadmap/current-status.md index e6e4fa3..c219801 100644 --- a/docs/07-roadmap/current-status.md +++ b/docs/07-roadmap/current-status.md @@ -205,6 +205,7 @@ ACLt Protocol v0.5 已完成最小语义基线和文档骨架:两类不可约 | 日期 | 基线 | 变化 | 证据/文档 | 影响的 Gate | |---|---|---|---|---| +| 2026-11-18 | v0.5 | P1-q:`dco` 兼容 GitHub 的共同作者后缀——PR 中的提交有多位作者时,GitHub 在 squash 合并时把 `---------` 分隔行与 `Co-authored-by` 行追加到说明末尾,签名落到倒数第二段,于是 `main` 上的推送检查把它判成漏签(`ece86b5`);正文检查与推送检查共用同一个剥离函数,只在后缀恰为一整行 9 个 `-` 加若干 `Co-authored-by` 行、且该段位于最末尾时剥离,其他 `---` 行、名单校验与 fork 逐提交检查不变;`ece86b5` 的真实说明作为夹具覆盖,原失败记录保留 | `scripts/check-dco.py`、`tests/repository_hardening/test_check_dco.py`、`tests/repository_hardening/dco_pr_simulation.py`、`CONTRIBUTING.md` §11、[PARALLEL-1](../08-governance/parallel-workflow.md)、#204 | 不变 | | 2026-11-18 | v0.5 | P1-p:`dco` 只检查签名者——名单只登记 `signoff` 身份(`inpac ` 与新增的 `Ankar `),删除 `author` 角色与全部 `author` 行,出现未知角色仍然失败;本仓库分支的 PR 不再逐提交检查作者与签名,正文中签名者的签名统一确认整个 PR,fork PR 的逐提交检查与推送到 `main` 的兜底检查不变;签名按 DCO 1.1 为该贡献作确认,代理仍不得签名,合并仍由维护者执行。名单与检查脚本都只从目标分支的受信任检出读取,新名单在合并后才对 `dco` 生效 | `scripts/check-dco.py`、`.github/dco-maintainers.txt`、`.github/workflows/dco.yml`、`CONTRIBUTING.md` §11、[PARALLEL-1](../08-governance/parallel-workflow.md)、`README.md`、`CONTRIBUTORS.md`、[公开仓库设置](../08-governance/public-repository-settings.md)、`tests/repository_hardening/test_check_dco.py`、`tests/repository_hardening/dco_pr_simulation.py`、#202 | 不变 | | 2026-11-18 | v0.5 | 归档阶段 #128 的发布后收尾回验(AUD-20261118-01):报告按原字节入库,审计索引与 `docs/README.md` 同步;报告新增 0 BLOCKER、1 MAJOR(现为 `ACCEPTED_BY_MAINTAINER`)、0 MINOR,未处理 OPEN 为 0,结论为已无未处理的关闭阻断,#196 的历史 DCO 漏签按维护者接受的 PR 正文补签补救 | [回验报告](../08-governance/audits/audit-20261118-01-post-release-closure.md)、[审计索引](../08-governance/audits/README.md)、#128 | 不变 | | 2026-11-18 | v0.5 | P1-o:把发布后定下的协作规则写进 PARALLEL-1——新增 §2 的 2026-11-18 现状(公开仓库、经典分支保护与规则集“Protect main”的读回)、人类协作者角色与 §5.6 的建模分工、worktree 移到仓库外、合并权限为流程约定、同步推送后需重新批准;§8 第 5 步标注完成 | [PARALLEL-1](../08-governance/parallel-workflow.md)、`CONTRIBUTING.md`、[公开仓库设置](../08-governance/public-repository-settings.md)、#198 | 不变 | diff --git a/docs/08-governance/parallel-workflow.md b/docs/08-governance/parallel-workflow.md index f6f7c98..2b45d7b 100644 --- a/docs/08-governance/parallel-workflow.md +++ b/docs/08-governance/parallel-workflow.md @@ -166,7 +166,7 @@ ACLt 检出内只允许出现被跟踪的文件,以及 `make` 产生的构建 ### 5.5 合并与收尾 -签名者(维护者,或签名名单中由维护者授权的人类协作者)把 `Signed-off-by` 另起一段加在 PR 正文最末尾,等 `dco` 检查重跑通过后,再由维护者在 GitHub 上 squash 合并——正文即合并提交说明(DCO,CONTRIBUTING §11)。正文中只含 `---` 的行会让其后的内容不被识别为 trailer,签名因此不算数。合并前确认必需检查通过、分支与最新 `main` 同步,且当前头部有作者以外成员的批准;同步推送过的分支需要重新批准(第 5.4 节)。合并由维护者执行,这是流程约定(第 4 节)。之后由调度会话收尾: +签名者(维护者,或签名名单中由维护者授权的人类协作者)把 `Signed-off-by` 另起一段加在 PR 正文最末尾,等 `dco` 检查重跑通过后,再由维护者在 GitHub 上 squash 合并——正文即合并提交说明(DCO,CONTRIBUTING §11)。正文中只含 `---` 的行会让其后的内容不被识别为 trailer,签名因此不算数。PR 中的提交有多位作者时,GitHub 会在合并那一刻自动在说明末尾追加 `---------` 分隔行与 `Co-authored-by` 行,把签名挤到倒数第二段;`dco` 的正文检查与推送检查都识别并先剥离这一固定格式,签名者不必删除它,但要确认签名仍在正文末尾(其他 `---` 行的判定不变,见 CONTRIBUTING §11)。合并前确认必需检查通过、分支与最新 `main` 同步,且当前头部有作者以外成员的批准;同步推送过的分支需要重新批准(第 5.4 节)。合并由维护者执行,这是流程约定(第 4 节)。之后由调度会话收尾: 1. 通知其他在途条目 `main` 已经前进。它们在轮到自己合并时再同步,不需要立即同步。 2. 确认 Issue 已由 `Closes` 关闭,证据标签已在远端。 diff --git a/scripts/check-dco.py b/scripts/check-dco.py index ebb8a52..c10cfaa 100755 --- a/scripts/check-dco.py +++ b/scripts/check-dco.py @@ -26,7 +26,11 @@ Both the body and commit messages go through the same `git interpret-trailers --parse`: a line containing only `---` starts the patch section, so anything after it is not a trailer, and CRLF is normalised to -LF first so the same text is judged the same way. +LF first so the same text is judged the same way. When a merged pull request +had several authors, GitHub appends a `---------` separator and one +`Co-authored-by` line per author to the squash message; that exact suffix is +stripped before parsing, so the sign-off written above it is read as the last +trailer paragraph again. The sign-off identities live in `.github/dco-maintainers.txt` next to the checkout that holds this script. The workflow runs the script from the trusted @@ -44,6 +48,8 @@ MAINTAINERS = ".github/dco-maintainers.txt" SIGNOFF = re.compile(r"^Signed-off-by:\s*(.+?)\s*<([^<>\s]+@[^<>\s]+)>\s*$", re.MULTILINE) IDENTITY = re.compile(r"^(?P.+?)\s*<(?P[^<>\s]+@[^<>\s]+)>$") +SEPARATOR = "-" * 9 +COAUTHOR = re.compile(r"^Co-authored-by:\s*(?P.+?)\s*<(?P[^<>\s]+@[^<>\s]+)>$") ROLES = {"signoff"} REPO = "." ZERO = "0" * 40 @@ -56,13 +62,49 @@ def git(*args, check=True, stdin=None): return result +def without_coauthor_suffix(text): + """The text minus the co-author block GitHub appends to a squash message. + + A pull request whose commits have more than one author gets a fixed suffix + added to the message GitHub builds from its body: a line of exactly nine + dashes, a blank line, then one `Co-authored-by: name ` line per + co-author. That moves the body sign-off into the second-to-last + paragraph, which `git interpret-trailers --parse` does not read. + + Only that shape is stripped. A separator of any other length, a missing + blank line on either side of the separator, or a line inside the suffix + that is not a `Co-authored-by` trailer all leave the text unchanged, so + every other use of a dash line keeps the verdict it had before. + """ + lines = text.replace("\r\n", "\n").split("\n") + end = len(lines) + while end and not lines[end - 1].strip(): + end -= 1 + first = end + while first and COAUTHOR.match(lines[first - 1]): + first -= 1 + if first == end: + return text + if first < 3 or lines[first - 1].strip() or lines[first - 2] != SEPARATOR: + return text + if lines[first - 3].strip(): + # GitHub writes the separator as its own paragraph; anywhere else the + # line is ordinary body text and keeps its current meaning. + return text + body = "\n".join(lines[:first - 2]) + return body if body.strip() else text + + def trailers(text): """Signed-off-by identities in the text's trailer block, as (name, e-mail).""" # Trailer parsing does not read a repository, so this never consults the # pull request's Git configuration; CRLF becomes LF so both line endings - # reach git as the same bytes. + # reach git as the same bytes, and the co-author suffix is dropped first so + # the sign-off above it is still the last trailer paragraph. The body and + # the commit checks both call this function, so they judge a text alike. result = subprocess.run(["git", "interpret-trailers", "--parse"], - capture_output=True, text=True, input=text.replace("\r\n", "\n")) + capture_output=True, text=True, + input=without_coauthor_suffix(text.replace("\r\n", "\n"))) if result.returncode != 0: raise SystemExit(f"git interpret-trailers --parse failed: {result.stderr.strip()}") return [(name, email.lower()) for name, email in SIGNOFF.findall(result.stdout)] diff --git a/tests/repository_hardening/dco_pr_simulation.py b/tests/repository_hardening/dco_pr_simulation.py index 1f8d782..2592db5 100644 --- a/tests/repository_hardening/dco_pr_simulation.py +++ b/tests/repository_hardening/dco_pr_simulation.py @@ -69,6 +69,19 @@ def scenarios(agent_head, outside_head): "false", agent_head, 1, "no Signed-off-by trailer") yield ("patch separator before the sign-off", "Change: x\n\n---\n\n" + SIGNOFF, "false", agent_head, 1, "patch section") + suffix = "\n\n---------\n\nCo-authored-by: dsh " + yield ("GitHub co-author suffix", "Change: x\n\n" + SIGNOFF + suffix, "false", agent_head, 0, + "signed off by") + yield ("co-author suffix, two authors", "Change: x\n\n" + SIGNOFF + suffix + + "\nCo-authored-by: R ", "false", agent_head, 0, "signed off by") + yield ("co-author suffix, eight dashes", "Change: x\n\n" + SIGNOFF + + suffix.replace("--------", "-------"), "false", agent_head, 1, + "no Signed-off-by trailer") + yield ("co-author suffix, extra trailer", "Change: x\n\n" + SIGNOFF + "\n\n---------\n\n" + "Reviewed-by: R \nCo-authored-by: dsh ", + "false", agent_head, 1, "no Signed-off-by trailer") + yield ("co-author suffix, unsigned above", "Change: x" + suffix, "false", agent_head, 1, + "no Signed-off-by trailer") yield ("CRLF body", "Change: x\r\n\r\n" + SIGNOFF + "\r\n", "false", agent_head, 0, "signed off by") yield ("signer outside the list", "Change: x\n\n" + UNKNOWN, "false", agent_head, 1, "not a sign-off identity") diff --git a/tests/repository_hardening/test_check_dco.py b/tests/repository_hardening/test_check_dco.py index 5bbc8ae..380df8a 100644 --- a/tests/repository_hardening/test_check_dco.py +++ b/tests/repository_hardening/test_check_dco.py @@ -377,6 +377,18 @@ def test_body_check_and_push_check_parse_the_same_text(self): "separator": "Change: x\n\n---\n\n" + SIGNOFF, "middle": "Change: x\n\n" + SIGNOFF + "\n\nmore prose", "crlf": "Change: x\r\n\r\n" + SIGNOFF + "\r\n", + "coauthor suffix": "Change: x\n\n" + SIGNOFF + "\n\n---------\n\n" + "Co-authored-by: dsh ", + "coauthor suffix, two authors": "Change: x\n\n" + SIGNOFF + "\n\n---------\n\n" + "Co-authored-by: dsh \n" + "Co-authored-by: R ", + "coauthor suffix, eight dashes": "Change: x\n\n" + SIGNOFF + "\n\n--------\n\n" + "Co-authored-by: dsh ", + "coauthor suffix, extra trailer": "Change: x\n\n" + SIGNOFF + "\n\n---------\n\n" + "Reviewed-by: R \n" + "Co-authored-by: dsh ", + "coauthor suffix, unsigned above": "Change: x\n\n---------\n\n" + "Co-authored-by: dsh ", } for name, text in cases.items(): with self.subTest(case=name): @@ -391,6 +403,293 @@ def test_body_check_and_push_check_parse_the_same_text(self): self.assertEqual(body_verdict, push_verdict, name) +# The squash message of ece86b5 on main, copied verbatim from +# "git log -1 --format=%B ece86b5" on 2026-11-18. GitHub appended that +# separator and Co-authored-by block after the maintainer's sign-off, so the +# push check read only the appended block and reported +# "FAIL: ece86b536bef on main has no Signed-off-by trailer". Keep the text +# byte-for-byte identical: it is the fixture for that failure. +ECE86B5_MESSAGE = """docs: archive the post-release closure recheck (AUD-20261118-01) (#201) + + + +Closes #200 + +Refs #128 + +## 条目与基线 + +- Issue:#200(归档 AUD-20261118-01,阶段 #128 关闭前的最后一项收尾) +- 分支:`docs/archive-aud-20261118-01` +- 基线:`5b3bc9a065b8c78561d67a76ee6694b2f2de5079`(开分支时);已按 PARALLEL-1 §5.4 +合并 `origin/main` `203249dee46336181d682fd0fb894194669afdd3`(P1-p #203) +- 实现代理:dsh;审计按计划卡不再另开一轮,只归档原报告 +- 提交:`0cd1542`(归档与索引)、`69deb44`(同步 main)、`d54392c`(PRA-201-02 修复) +- 同步只解一处冲突:`docs/07-roadmap/current-status.md` §9 表头下两行并存,P1-p +在上、AUD-20261118-01 在下 + +## Change + +### 归档与索引(`0cd1542`) + +- 新增 +`docs/08-governance/audits/audit-20261118-01-post-release-closure.md`:Codex +交付件逐字节复制,33,272 字节,SHA-256 +`9829ff904f71e262fcb004d839dc5f5a9995a437a61fbf9b0da7d627d21cf194`,`cmp` +退出 0;内容、结论与失败证据保持原文。报告里没有指向仓库外本机路径的链接(本地路径只以纯文本出现在 §1 与 +§10),未触发计划卡允许的唯一改写。 +- `docs/08-governance/audits/README.md`:接 AUD-20261116-02/03 那一段之后新增一段: + +> 2026-11-18 的阶段 #128 发布后收尾回验见 +[AUD-20261118-01](audit-20261118-01-post-release-closure.md)。报告按原字节归档,保留原结论、发现与失败证据;它不是 +PR 审计,也不是 Gate 退出审计。本轮新增 0 BLOCKER、1 MAJOR(现为 +`ACCEPTED_BY_MAINTAINER`)、0 MINOR,未处理 OPEN 为 +0;报告结论为已无未处理的关闭阻断,本报告归档并加入索引后 #128 可由维护者关闭。 + +- `docs/README.md`:接 :295(AUD-20261116-03)之后新增一条: + +> [2026-11-18 阶段 #128 +发布后收尾回验(AUD-20261118-01)](08-governance/audits/audit-20261118-01-post-release-closure.md):新增 +0 BLOCKER、1 MAJOR(现为 `ACCEPTED_BY_MAINTAINER`)、0 MINOR,未处理 OPEN 为 +0;已无未处理的关闭阻断,本报告归档并加入索引后 #128 可由维护者关闭。 + +- `docs/07-roadmap/current-status.md`(热点文件):§9 新增一行,只转述归档事实、结论与计数,Gate +栏“不变”。 + +### 归档字节与文档门禁的兼容(`d54392c`,PRA-201-02) + +- 新增 `docs/08-governance/audits/.gitattributes`:对 `audit-*.md` 声明 +`whitespace=-blank-at-eol`。归档报告是原字节记录,P1-k 之后文档通道无条件运行 `git diff +--check`,保留交付件的 Markdown 硬换行会确定性地让 `local-validation` +失败;这条仓库规则只豁免归档副本,同目录的索引与后续人工撰写的文件仍按默认检查。 +- `scripts/check-license-coverage.py`:把 `.gitattributes` 加入 +`CONFIG_NAMES`(与 `.gitignore` 同类),文件头的类别列表同步。该文件带 SPDX 头,按配置类受检查。 +- `tests/workflow/test_license_coverage.py`:新增 +`test_gitattributes_is_covered_and_declarable`,与 `.gitignore` 的既有用例同构。 +- `docs/07-roadmap/open-questions.md`:OQ-01“关闭证据”补一句,记录 `.gitattributes` +纳入配置类及其用途。 +- `SINGLEHOST-SHA256SUMS`、`WORKFLOW-SHA256SUMS`:脚本与测试是钉住文件,按 +`update-manifests.py` 刷新。 + +## Problem / counterexample + +- 阶段 #128 的发布后收尾回验只存在于代理目录,仓库内没有可引用的归档;审计索引停在 +AUD-20261116-03,`docs/README.md` 的 AUD-20261115 条目仍写“发布后收尾回验另行归档”。 +- **PRA-201-02:** 归档报告第 3–7 行是交付件的 Markdown +硬换行;`.github/workflows/validate.yml` 的文档通道在 `make check-docs` 后无条件执行 +`git diff --check "${BASE}...HEAD"`。按原字节归档会让必需检查 `local-validation` +必然失败,而删掉空格就不再是逐字节副本。 +- `.gitattributes` 是唯一既能保留字节、又能让该检查放行的已跟踪机制;但许可覆盖检查器此前只把 `.gitignore` +列为配置类,`.gitattributes` 会被判为 `unclassified tracked file` 而失败。 +- **PRA-201-01(已解除):** 提交 `0cd1542` 的作者不是受信任身份。P1-p(#203)之后 `dco` 只检查 PR +正文的签名者,该头部已由维护者签署,此问题随同步解除;未改写已推送历史。 + +## Status before → after + +| 位置 | 之前 | 之后 | +|---|---|---| +| 回验报告 | 只在本机代理目录 | 已入库,逐字节等于交付件 | +| 审计索引 | 最后一条为 AUD-20261116-03 | 新增 AUD-20261118-01 一段 | +| `docs/README.md` | 最后一条为 AUD-20261116-03 | 新增 AUD-20261118-01 一条 | +| 状态日志 §9 | 无归档记录 | 新增一行,Gate 不变(同步后与 P1-p 行并存) | +| `git diff --check`(文档通道) | 命中报告 5 行硬换行,退出 2 | 退出 0;归档字节不变 | +| `.gitattributes` | 不能引入(许可覆盖判为未分类) | 按配置类受检查,`covered=352 headers=257 +declared=95 excluded=457 missing=0` | +| DCO | `0cd1542` 作者非受信任身份而失败 | P1-p 后只检查 PR 正文签名者,正文已由维护者签署 | + +## Tests or proofs(本次执行) + +分支头 `d54392c`(基线 `203249d`),2026-11-18: + +| 命令 | 基线 SHA | 退出码 | +|---|---|---| +| `python3 -B -m unittest tests.workflow.test_license_coverage` | +`203249d` | 0(49 项通过) | +| `python3 -B scripts/check-license-coverage.py --require-git` | +`203249d` | 0(PASS:covered=352 headers=257 declared=95 excluded=457 +missing=0) | +| `python3 -B scripts/update-manifests.py` | `203249d` | 0(刷新两份清单) | +| `python3 -B scripts/update-manifests.py --check` | `203249d` | 0(PASS) +| +| `python3 -B scripts/check-repository-evidence.py --repository .` | +`203249d` | 0(PASS,1008 个本地 prose 链接) | +| `cmp <交付件> +docs/08-governance/audits/audit-20261118-01-post-release-closure.md` | +`203249d` | 0(无输出,逐字节相同) | +| `git diff --check origin/main...HEAD` | `203249d` | 0(加 +`.gitattributes` 后不再命中归档硬换行) | +| `make -j"$(nproc)" -O check` | `203249d` | 0(PASS) | + +本次改到检查器与测试,按效率规则跑一次 `make check`;未跑 `make test` 全量回归。CI 因含非 Markdown +文件会走全量通道,结果以 GitHub 为准,不轮询。 + +## Evidence tags + +无。本条目不新增证据提交。 + +## 理论缺口 + +无。本条目不依赖任何未建模性质,也不据此关闭 TG-6(#123)或 SV-62/SV-118 的 partial 缺口。 + +## Residual risk + +- 报告结论原样保留:#196 的历史 DCO 漏签按维护者接受的 PR 正文补签作为补救,原 push DCO 失败仍在;本 PR +不把历史运行写成通过。 +- 报告列出的残余事项(外部贡献者 fork 端到端实测免做、P1-n 合并后线上实测免做、“只有维护者合并”为流程约定、#186 的 DCO +补救)按原记录保留。 +- `.gitattributes` 规则按模式 `audit-*.md` 豁免该目录下所有归档报告,不限于本条目这一份;索引 +`README.md` 与其他文件不受影响。该规则只影响 whitespace 诊断,不改变任何文件字节。 +- 本条目的 PR 正文在维护者签署后被更新(新增归档字节与门禁一节),签名行原样保留在最末尾;若维护者认为需要重新确认,可在正文或评论中说明。 +- #128 是否关闭由维护者决定;本 PR 只把归档与索引这一前置条件落地。 + +## Documents updated + + +`docs/08-governance/audits/audit-20261118-01-post-release-closure.md`、`docs/08-governance/audits/README.md`、`docs/README.md`、`docs/07-roadmap/current-status.md`、`docs/08-governance/audits/.gitattributes`、`scripts/check-license-coverage.py`、`tests/workflow/test_license_coverage.py`、`docs/07-roadmap/open-questions.md`、`SINGLEHOST-SHA256SUMS`、`WORKFLOW-SHA256SUMS` + +## 合并检查 + +- [x] 改动文件都在计划卡的文件集内(#200 已按维护者 2026-11-18 决定同步文件集与目标) +- [x] PARALLEL-1 审计:首轮 0 BLOCKER、1 MAJOR、1 MINOR;PRA-201-01 随 P1-p +解除,PRA-201-02 本 PR 修复,待增量复核 +- [x] 已按 §5.4 合并 `origin/main` `203249d`,重跑通过 +- [x] CI 通过:以 GitHub 为准(本次走全量通道),未轮询 +- [x] DCO:维护者已在本正文最末尾签署 `Signed-off-by`;P1-p 后 `dco` 只检查签名者,提交作者不再单独要求 + + +[![](https://img.shields.io/badge/powered_by-dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white)](https://github.com/deepseek-ai/deepseek-harness) + + + +Signed-off-by: inpac + +--------- + +Co-authored-by: dsh +""" + + +class CoauthorSuffixTests(DcoTestCase): + """GitHub appends the co-author suffix after the body sign-off at merge time. + + The body check and the push check must both read the sign-off through that + suffix, and every other use of a dash line must keep its earlier verdict. + """ + + SIGNED = "Change: x\n\n" + SIGNOFF + SUFFIX = "\n\n---------\n\nCo-authored-by: dsh " + + def commit_verbatim(self, name, message, author=AGENT): + """A commit whose message is stored byte for byte, as GitHub writes it.""" + (self.dir / name).write_text(name + "\n") + (self.dir / "message.txt").write_text(message) + self.git("add", name) + self.git("commit", "-q", "--cleanup=verbatim", "-F", "message.txt", author=author) + return self.git("rev-parse", "HEAD") + + def push_verdict(self, message): + adopt = self.commit("b", "adopt DCO check", with_script=True, author=AGENT) + head = self.commit_verbatim("c", message) + return self.push(adopt, head) + + def test_the_real_squash_message_passes_the_push_check(self): + result = self.push_verdict(ECE86B5_MESSAGE) + self.assertEqual(result.returncode, 0, result.stdout) + self.assertIn("PASS: 1 commit(s)", result.stdout) + + def test_the_real_message_is_the_one_the_trailer_parser_misses(self): + parsed = subprocess.run(["git", "interpret-trailers", "--parse"], + input=ECE86B5_MESSAGE, capture_output=True, text=True) + self.assertEqual(parsed.returncode, 0, parsed.stderr) + self.assertEqual(parsed.stdout.strip(), "Co-authored-by: dsh ") + + def test_the_real_squash_message_passes_the_body_check(self): + base = self.commit("a", "base", author=AGENT) + head = self.commit("b", "agent work", author=AGENT) + result = self.pr(base, head, "false", ECE86B5_MESSAGE) + self.assertEqual(result.returncode, 0, result.stdout) + self.assertIn("signed off by inpac ", result.stdout) + + def test_the_committed_fixture_is_kept_verbatim(self): + # "git commit -m" would strip and collapse blank lines, which would hide + # the very shape under test; this helper commits the bytes as they are. + head = self.commit_verbatim("c", ECE86B5_MESSAGE) + self.assertEqual(self.git("show", "-s", "--format=%B", head), ECE86B5_MESSAGE.rstrip("\n")) + + def test_several_coauthors_pass(self): + message = self.SIGNED + self.SUFFIX + "\nCo-authored-by: Example Author " + result = self.push_verdict(message) + self.assertEqual(result.returncode, 0, result.stdout) + + def test_a_missing_signoff_above_the_suffix_fails(self): + result = self.push_verdict("Change: x" + self.SUFFIX) + self.assertEqual(result.returncode, 1) + self.assertIn("no Signed-off-by trailer", result.stdout) + + def test_a_separator_that_is_not_nine_dashes_keeps_the_earlier_verdict(self): + for separator in ("--------", "----------", "--------- "): + with self.subTest(separator=separator): + self.tearDown() + self.setUp() + suffix = "\n\n" + separator + "\n\nCo-authored-by: dsh " + result = self.push_verdict(self.SIGNED + suffix) + self.assertEqual(result.returncode, 1, result.stdout) + self.assertIn("no Signed-off-by trailer", result.stdout) + + def test_a_suffix_with_another_trailer_is_not_stripped(self): + suffix = ("\n\n---------\n\nReviewed-by: R \n" + "Co-authored-by: dsh ") + result = self.push_verdict(self.SIGNED + suffix) + self.assertEqual(result.returncode, 1, result.stdout) + self.assertIn("no Signed-off-by trailer", result.stdout) + + def test_the_separator_must_open_its_own_paragraph(self): + # GitHub writes the separator as its own paragraph; glued to the line + # above it, the block is ordinary body text and the earlier verdict stands. + message = ("Change: x\n\n" + SIGNOFF + "\n---------\n\n" + "Co-authored-by: dsh ") + result = self.push_verdict(message) + self.assertEqual(result.returncode, 1, result.stdout) + self.assertIn("no Signed-off-by trailer", result.stdout) + + def test_the_coauthor_lines_must_end_the_message(self): + result = self.push_verdict(self.SIGNED + self.SUFFIX + "\nmore prose") + self.assertEqual(result.returncode, 1, result.stdout) + self.assertIn("no Signed-off-by trailer", result.stdout) + + def test_the_suffix_alone_is_not_a_signoff(self): + result = self.push_verdict("Change: x" + self.SUFFIX) + self.assertEqual(result.returncode, 1) + self.assertIn("no Signed-off-by trailer", result.stdout) + + def test_the_signer_must_still_be_on_the_list(self): + base = self.commit("a", "base", author=AGENT) + head = self.commit("b", "agent work", author=AGENT) + body = "Change: x\n\n" + UNKNOWN_SIGNOFF + self.SUFFIX + result = self.pr(base, head, "false", body) + self.assertEqual(result.returncode, 1) + self.assertIn("not a sign-off identity", result.stdout) + + def test_a_listed_signer_passes_the_body_check_through_the_suffix(self): + base = self.commit("a", "base", author=AGENT) + head = self.commit("b", "agent work", author=AGENT) + body = "Change: x\n\n" + SIGNOFF + self.SUFFIX + result = self.pr(base, head, "false", body) + self.assertEqual(result.returncode, 0, result.stdout) + self.assertIn("signed off by inpac ", result.stdout) + + def test_crlf_and_lf_are_judged_identically_through_the_suffix(self): + base = self.commit("a", "base", author=AGENT) + head = self.commit("b", "agent work", author=AGENT) + text = "Change: x\n\n" + SIGNOFF + self.SUFFIX + lf = self.pr(base, head, "false", text) + crlf = self.pr(base, head, "false", text.replace("\n", "\r\n")) + self.assertEqual(lf.returncode, 0, lf.stdout) + self.assertEqual(lf.stdout, crlf.stdout) + + class DcoWorkflowTrustTests(unittest.TestCase): @classmethod def setUpClass(cls): From 752b9c6d9f69b24ed01fa5b729290652754f65ef Mon Sep 17 00:00:00 2001 From: inpac Date: Wed, 18 Nov 2026 18:22:04 +0100 Subject: [PATCH 2/3] test: spell the eight-dash separator literally in the DCO simulation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: #204。 `co-author suffix, eight dashes` 原先用 `suffix.replace("--------", "-------")` 从九 个减号推导八个,读者需要先确认替换只命中分隔行。改为直接写出八个减号的分隔行,与 同一场景在 `test_check_dco.py` 中的写法一致;行为与判定不变。 ## Tests or proofs | 命令 | 退出码 | |---|---| | `python3 -B tests/repository_hardening/dco_pr_simulation.py` | 0(15 个场景) | | `python3 -B -m unittest tests.repository_hardening.test_check_dco` | 0(52 项) | | `python3 -B scripts/update-manifests.py --check` | 0 | ## Documents updated `tests/repository_hardening/dco_pr_simulation.py`、`SINGLEHOST-SHA256SUMS` --- SINGLEHOST-SHA256SUMS | 2 +- tests/repository_hardening/dco_pr_simulation.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SINGLEHOST-SHA256SUMS b/SINGLEHOST-SHA256SUMS index 5e97ca5..d753b54 100644 --- a/SINGLEHOST-SHA256SUMS +++ b/SINGLEHOST-SHA256SUMS @@ -454,7 +454,7 @@ a8c57b9dbd3cdb205a97d90cb535a8a167f744d621de039169a70af7cee2160f tests/formal_m 5e19ecd77a8f4160782160333a157438823bafc9ed11d822a92b1b030cd19502 tests/formal_migration/vectors.json 7f6e90e896bc68a61903fef635b4b825a062b43797593e1d6acee28114fc7ac5 tests/migration_evidence/test_evidence.py 4f9b2235c0cdd889490baf2823601f3196aa33d41d6b85488decf83a4ce19888 tests/migration_evidence/test_public_archives.py -ba71ba20c842a0f124c93d0866253dda8933b2a3a20338f5b1d44538f97358c7 tests/repository_hardening/dco_pr_simulation.py +5a6c2e57115f6eb3b7da484dc5cf313cf44be5f7111d2f6b1a748aa4fb98cdc7 tests/repository_hardening/dco_pr_simulation.py 4940c696c180943718f7991f4877e307e5a760c2f11a8de1b10564303a9d0f98 tests/repository_hardening/test_check_dco.py 34ed7a109f77efeadf0190ae04cd07e4aa47a1523ca70548a1f16330c789c3a9 tests/repository_hardening/test_git_sources.py 03ff67ffbd4ff2d63e5fd1f18da6e884c8293812191f0c29e49e5a425523a135 tests/repository_hardening/test_hardening.py diff --git a/tests/repository_hardening/dco_pr_simulation.py b/tests/repository_hardening/dco_pr_simulation.py index 2592db5..26bf2d9 100644 --- a/tests/repository_hardening/dco_pr_simulation.py +++ b/tests/repository_hardening/dco_pr_simulation.py @@ -74,8 +74,8 @@ def scenarios(agent_head, outside_head): "signed off by") yield ("co-author suffix, two authors", "Change: x\n\n" + SIGNOFF + suffix + "\nCo-authored-by: R ", "false", agent_head, 0, "signed off by") - yield ("co-author suffix, eight dashes", "Change: x\n\n" + SIGNOFF + - suffix.replace("--------", "-------"), "false", agent_head, 1, + yield ("co-author suffix, eight dashes", "Change: x\n\n" + SIGNOFF + "\n\n--------\n\n" + "Co-authored-by: dsh ", "false", agent_head, 1, "no Signed-off-by trailer") yield ("co-author suffix, extra trailer", "Change: x\n\n" + SIGNOFF + "\n\n---------\n\n" "Reviewed-by: R \nCo-authored-by: dsh ", From 07f25f116feef87c927c56fcfb0ec24726dc2a65 Mon Sep 17 00:00:00 2001 From: inpac Date: Wed, 18 Nov 2026 18:22:59 +0100 Subject: [PATCH 3/3] test: drop a duplicate co-author suffix case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: #204。 `test_the_suffix_alone_is_not_a_signoff` 与 `test_a_missing_signoff_above_the_suffix_fails` 用同一段文本 (`"Change: x" + SUFFIX`),判定也相同,属重复用例。删除前者,保留与计划卡 反例“后缀前一段没有签名 → 失败”对应的那个;覆盖范围不变。 ## Tests or proofs | 命令 | 退出码 | |---|---| | `python3 -B -m unittest tests.repository_hardening.test_check_dco` | 0(51 项) | | `python3 -B scripts/update-manifests.py --check` | 0 | ## Documents updated `tests/repository_hardening/test_check_dco.py`、`SINGLEHOST-SHA256SUMS` --- SINGLEHOST-SHA256SUMS | 2 +- tests/repository_hardening/test_check_dco.py | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/SINGLEHOST-SHA256SUMS b/SINGLEHOST-SHA256SUMS index d753b54..8d2e312 100644 --- a/SINGLEHOST-SHA256SUMS +++ b/SINGLEHOST-SHA256SUMS @@ -455,7 +455,7 @@ a8c57b9dbd3cdb205a97d90cb535a8a167f744d621de039169a70af7cee2160f tests/formal_m 7f6e90e896bc68a61903fef635b4b825a062b43797593e1d6acee28114fc7ac5 tests/migration_evidence/test_evidence.py 4f9b2235c0cdd889490baf2823601f3196aa33d41d6b85488decf83a4ce19888 tests/migration_evidence/test_public_archives.py 5a6c2e57115f6eb3b7da484dc5cf313cf44be5f7111d2f6b1a748aa4fb98cdc7 tests/repository_hardening/dco_pr_simulation.py -4940c696c180943718f7991f4877e307e5a760c2f11a8de1b10564303a9d0f98 tests/repository_hardening/test_check_dco.py +621f24564464a40ef38e21b03df77d6519ce83b66bfd695499d5faf2c223e751 tests/repository_hardening/test_check_dco.py 34ed7a109f77efeadf0190ae04cd07e4aa47a1523ca70548a1f16330c789c3a9 tests/repository_hardening/test_git_sources.py 03ff67ffbd4ff2d63e5fd1f18da6e884c8293812191f0c29e49e5a425523a135 tests/repository_hardening/test_hardening.py cdd63154a0bad204e185f86b94e5ba9caea97e711173896f4e36a101fd335d13 tests/verification_model/closed_form_oracle.py diff --git a/tests/repository_hardening/test_check_dco.py b/tests/repository_hardening/test_check_dco.py index 380df8a..afd6b5c 100644 --- a/tests/repository_hardening/test_check_dco.py +++ b/tests/repository_hardening/test_check_dco.py @@ -659,11 +659,6 @@ def test_the_coauthor_lines_must_end_the_message(self): self.assertEqual(result.returncode, 1, result.stdout) self.assertIn("no Signed-off-by trailer", result.stdout) - def test_the_suffix_alone_is_not_a_signoff(self): - result = self.push_verdict("Change: x" + self.SUFFIX) - self.assertEqual(result.returncode, 1) - self.assertIn("no Signed-off-by trailer", result.stdout) - def test_the_signer_must_still_be_on_the_list(self): base = self.commit("a", "base", author=AGENT) head = self.commit("b", "agent work", author=AGENT)