Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <inpac@lingmatrix.cn>` 与维护者授权的人类协作者 `Ankar <ankarnassia@lingmatrix.cn>`)。签名者可以是两者之一,签名即按 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`,用于发现合并时被改掉的签名。
Expand Down
6 changes: 3 additions & 3 deletions SINGLEHOST-SHA256SUMS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
5a6c2e57115f6eb3b7da484dc5cf313cf44be5f7111d2f6b1a748aa4fb98cdc7 tests/repository_hardening/dco_pr_simulation.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
Expand Down
1 change: 1 addition & 0 deletions docs/07-roadmap/current-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <inpac@lingmatrix.cn>` 与新增的 `Ankar <ankarnassia@lingmatrix.cn>`),删除 `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 | 不变 |
Expand Down
2 changes: 1 addition & 1 deletion docs/08-governance/parallel-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` 关闭,证据标签已在远端。
Expand Down
48 changes: 45 additions & 3 deletions scripts/check-dco.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<name>.+?)\s*<(?P<email>[^<>\s]+@[^<>\s]+)>$")
SEPARATOR = "-" * 9
COAUTHOR = re.compile(r"^Co-authored-by:\s*(?P<name>.+?)\s*<(?P<email>[^<>\s]+@[^<>\s]+)>$")
ROLES = {"signoff"}
REPO = "."
ZERO = "0" * 40
Expand All @@ -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 <e-mail>` 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)]
Expand Down
13 changes: 13 additions & 0 deletions tests/repository_hardening/dco_pr_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <dsh@localhost>"
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 <r@example.invalid>", "false", agent_head, 0, "signed off by")
yield ("co-author suffix, eight dashes", "Change: x\n\n" + SIGNOFF + "\n\n--------\n\n"
"Co-authored-by: dsh <dsh@localhost>", "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 <r@example.invalid>\nCo-authored-by: dsh <dsh@localhost>",
"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")
Expand Down
Loading
Loading