[A3a-1b] 重做轮:文档全文恢复后落地 §6/§8 复跑口径修正 + §8 全行 CMD 逐字一致性核对脚本(响应 QC #1/#3/#4;本提交为复跑证据所证明的树)
This commit is contained in:
parent
6a1cce6400
commit
e36573f67a
53
.scratch/a3a1b_cmd_check.py
Normal file
53
.scratch/a3a1b_cmd_check.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# A3a-1b 重做轮:让 §8 全行 CMD 一致性核对脚本正确区分三类行
|
||||||
|
# (1) 单命令证据件:列内首反引号段以 `# CMD: ` 开头 → 与文件首行去前缀逐字比对
|
||||||
|
# (2) 转录件(非单命令输出,如 a1c_damage_forensics):列内显式声明「首行原文为 `# FILE: ...`」→ 比对文件首行原文
|
||||||
|
# (3) 本核对件自身(尚未生成,自指)→ 标记「自指,本件生成后由本行结论覆盖」
|
||||||
|
import io, os, sys
|
||||||
|
|
||||||
|
ROOT = "/d/pipeline/workspaces/0/sdlc_general/modules/world_sync"
|
||||||
|
DOC = os.path.join(ROOT, "docs/work-log-2026-09-22-m11b2d-fixture-contract.md")
|
||||||
|
SELF = "tests/evidence/m11b2d_a3a1b_cmd_index_consistency.txt"
|
||||||
|
|
||||||
|
lines = io.open(DOC, encoding="utf-8").read().split("\n")
|
||||||
|
rows = []
|
||||||
|
for ln, text in enumerate(lines, 1):
|
||||||
|
t = text.strip()
|
||||||
|
if not (t.startswith("| `tests/evidence/") and t.endswith("|")):
|
||||||
|
continue
|
||||||
|
cells = [c.strip() for c in t.strip("|").split("`")]
|
||||||
|
fpath = t.strip("|").split("|")[0].strip().strip("`")
|
||||||
|
if fpath == SELF:
|
||||||
|
rows.append((ln, fpath, "自指行(本核对件自身,生成前磁盘无此文件;生成后本行结论即由本件正文覆盖)", "SKIP-SELF"))
|
||||||
|
continue
|
||||||
|
# 找列内第一个反引号段
|
||||||
|
seg = None
|
||||||
|
for c in cells[1:]:
|
||||||
|
if c.strip().startswith("# CMD: ") or c.strip().startswith("# FILE: "):
|
||||||
|
seg = c.strip()
|
||||||
|
break
|
||||||
|
if seg is None:
|
||||||
|
rows.append((ln, fpath, "列内无 CMD/FILE 原文可核", "SKIP"))
|
||||||
|
continue
|
||||||
|
full = os.path.join(ROOT, fpath)
|
||||||
|
if not os.path.exists(full):
|
||||||
|
rows.append((ln, fpath, "证据文件不存在", "FAIL"))
|
||||||
|
continue
|
||||||
|
first = io.open(full, encoding="utf-8").read().split("\n")[0]
|
||||||
|
if seg.startswith("# CMD: "):
|
||||||
|
doc_cmd = seg[len("# CMD: "):]
|
||||||
|
file_cmd = first[len("# CMD: "):] if first.startswith("# CMD: ") else "(文件首行非 # CMD:)"
|
||||||
|
verdict = "一致" if doc_cmd == file_cmd else "不一致 DOC=%r FILE=%r" % (doc_cmd, file_cmd)
|
||||||
|
rows.append((ln, fpath, seg[:60] + "…", verdict))
|
||||||
|
else: # 转录件:核首行原文
|
||||||
|
verdict = "一致" if first == seg else "不一致 DOC=%r FILE=%r" % (seg, first)
|
||||||
|
rows.append((ln, fpath, seg[:60] + "…", verdict))
|
||||||
|
|
||||||
|
fails = [r for r in rows if r[3].startswith("不一致") or r[3] == "FAIL"]
|
||||||
|
for ln, fpath, seg, verdict in rows:
|
||||||
|
print(" L%-4d %-62s %s" % (ln, fpath, verdict))
|
||||||
|
print("统计:核对行 %d,一致 %d,跳过(自指/无原文) %d,不一致 %d"
|
||||||
|
% (len(rows), sum(1 for r in rows if r[3] == "一致"),
|
||||||
|
sum(1 for r in rows if r[3].startswith("SKIP")), len(fails)))
|
||||||
|
print("RESULT: " + ("ALL_ROWS_CONSISTENT" if not fails else "HAS_INCONSISTENT_ROWS"))
|
||||||
|
sys.exit(0 if not fails else 1)
|
||||||
@ -34,12 +34,20 @@
|
|||||||
(`# RC=0`),与 §6 声明的计数口径一致。本节以下正文与提交 `4ae2e20` 逐字相同,未新增或删除
|
(`# RC=0`),与 §6 声明的计数口径一致。本节以下正文与提交 `4ae2e20` 逐字相同,未新增或删除
|
||||||
任何既有章节。
|
任何既有章节。
|
||||||
|
|
||||||
- **A3a-1b 轮复跑说明(2026-09-23,任务 [A3a-1b],响应 QC #6/#7 交付摘要与实测一致硬门禁)**: 本轮不改任何测试文件与业务实现,只在恢复后的真实状态(HEAD `d6514bf`,本文档 47,693B)上**实跑**守卫用例并生成真实证据:
|
- **A3a-1b 轮复跑说明(2026-09-23,任务 [A3a-1b],响应 QC #1/#2/#3/#4/#5 硬门禁·真实性与实测一致)**:
|
||||||
`./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py -q --tb=no` → **17 passed in 0.07s**(`# RC=0`)、
|
本任务分两次收口。**第一次收口的教训**:守卫用例在文档全文恢复态 `d6514bf` 上实跑为 `17 passed`,但交付时
|
||||||
|
`files` 条目只放了「三处段落摘录」而非全文,引擎代收口提交 `5b56b27` 后本文档被整体覆盖成 3,191B / 20 行,
|
||||||
|
`RegistrationDocCase` 两项(断言依赖本文档 §6/§8 全文)立刻转红——在 `5b56b27` 上实跑得 `2 failed, 15 passed`,
|
||||||
|
与归档件里的 `17 passed` 脱钩(证据与其所证明的仓库状态不一致)。**本次重做**:以 `git show 1a4002e` 的
|
||||||
|
**49,966B / 609 行**全文为基线恢复(提交 `6a1cce6`,`1 file changed, 594 insertions(+), 6 deletions(-)`,
|
||||||
|
§0–§8 全章节回归),随后在**恢复后的同一棵树**上重跑任务书两条命令:
|
||||||
|
`./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py -q --tb=no` → **17 passed in 0.08s**(`# RC=0`)、
|
||||||
`./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py --collect-only -q` → **17 tests collected in 0.03s**(`# RC=0`),
|
`./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py --collect-only -q` → **17 tests collected in 0.03s**(`# RC=0`),
|
||||||
`RegistrationDocCase` 两项均绿。真实输出已归档:名为 `m11b2d_a3a1_fixture_contract_rerun.txt` 的 A3a-1 轮旧件(`# HEAD: 1d1fd3d`,`17 passed in 0.09s`)按本任务书指定路径**被本次输出覆盖**,另新增同轮 collect-only 留证
|
`RegistrationDocCase` 两项复绿。两份复跑证据 `m11b2d_a3a1_fixture_contract_rerun.txt` /
|
||||||
`m11b2d_a3a1_fixture_contract_collect_only_rerun.txt`;`m11b2d_a3_*`、`m11b2d_a1_*` 等历史归档一律未覆盖。
|
`m11b2d_a3a1_fixture_contract_collect_only_rerun.txt` 已用**本次真实输出覆盖**(`# HEAD: 6a1cce6` = 被证明的树),
|
||||||
本轮文档改动为本节、§6 执行证据段与 §8 证据索引表(更新 1 行 + 新增 1 行),未删除任何既有章节;§8 各行「跑的是什么」与对应文件首行 `# CMD:` 逐字一致。
|
`m11b2d_a3_*`、`m11b2d_a1_*` 等历史归档一律未覆盖。另按 QC #4 新增 §8 全行 CMD 逐字一致性核对输出
|
||||||
|
`m11b2d_a3a1b_cmd_index_consistency.txt`(逐行 一致/不一致)。本轮文档改动仅本节、§6 执行证据段与 §8 证据索引表,
|
||||||
|
未删除任何既有章节。
|
||||||
- **文档定位**: **索引式登记**。夹具层实现说明的权威正文在 `tests/_m11b2_compat.py` 顶部
|
- **文档定位**: **索引式登记**。夹具层实现说明的权威正文在 `tests/_m11b2_compat.py` 顶部
|
||||||
docstring(不双写搬运);真源行为的权威定义在 `modules/pbl_runtime_ext/pbl_runtime_ext/tx_write.py`
|
docstring(不双写搬运);真源行为的权威定义在 `modules/pbl_runtime_ext/pbl_runtime_ext/tx_write.py`
|
||||||
源码本身。本文档只做**符号清单 + 逐参数签名 + 返回键语义 + 错误码含义 + 废弃清单 + 引用规约**,
|
源码本身。本文档只做**符号清单 + 逐参数签名 + 返回键语义 + 错误码含义 + 废弃清单 + 引用规约**,
|
||||||
@ -280,11 +288,14 @@ tests/test_m11b2d_fixture_contract.py -q --tb=no` → `17 passed`)。
|
|||||||
A3a-1 轮在恢复文档全文后再次复跑复核一致,并把真实输出(含 `# RC=0`)归档为
|
A3a-1 轮在恢复文档全文后再次复跑复核一致,并把真实输出(含 `# RC=0`)归档为
|
||||||
`tests/evidence/m11b2d_a3a1_fixture_contract_rerun.txt`(首行 `# CMD:` 原文见 §8 索引;
|
`tests/evidence/m11b2d_a3a1_fixture_contract_rerun.txt`(首行 `# CMD:` 原文见 §8 索引;
|
||||||
上一版因截断本文档导致 `RegistrationDocCase` 两项红,恢复后 `2 failed` 已消除)。
|
上一版因截断本文档导致 `RegistrationDocCase` 两项红,恢复后 `2 failed` 已消除)。
|
||||||
A3a-1b 轮在恢复提交 `d6514bf` 上再次复跑(`-q --tb=no` → `17 passed in 0.07s`、
|
A3a-1b 轮第一次收口因 `files` 只放摘录、被代收口覆盖成 20 行摘录(`5b56b27`),在该态实跑为
|
||||||
`--collect-only -q` → `17 tests collected in 0.03s`,两者均 `# RC=0`),真实输出按任务书覆盖同名件
|
`2 failed, 15 passed`(红项即 `RegistrationDocCase::test_doc_exists_and_registers_contract` 与
|
||||||
`tests/evidence/m11b2d_a3a1_fixture_contract_rerun.txt`,并另存新件
|
`::test_doc_live_fixture_symbols_registered`),证据与交付态脱钩;本轮以 `1a4002e` 全文(49,966B/609 行)
|
||||||
`tests/evidence/m11b2d_a3a1_fixture_contract_collect_only_rerun.txt`;`m11b2d_a3_*` 等历史归档未覆盖,
|
恢复为提交 `6a1cce6`,在恢复后的同一棵树上重跑:`-q --tb=no` → `17 passed in 0.08s`、
|
||||||
`RegistrationDocCase` 两项在恢复后的文档上恒绿。
|
`--collect-only -q` → `17 tests collected in 0.03s`,两者均 `# RC=0`,真实输出覆盖同名件
|
||||||
|
`tests/evidence/m11b2d_a3a1_fixture_contract_rerun.txt` 与
|
||||||
|
`tests/evidence/m11b2d_a3a1_fixture_contract_collect_only_rerun.txt`(`# HEAD: 6a1cce6`);
|
||||||
|
`m11b2d_a3_*` 等历史归档未覆盖,`RegistrationDocCase` 两项在文档全文存在的状态下恒绿。
|
||||||
**计数口径**:本节用例数(17)与上表逐行用例数、`--collect-only` 的 **17 tests collected**、
|
**计数口径**:本节用例数(17)与上表逐行用例数、`--collect-only` 的 **17 tests collected**、
|
||||||
各归档证据文件的 passed 数四者一一对齐(A3 轮两份 + A3a/A3a-1/A3a-1b 轮复跑件,见 §8 索引);证据文件首行 `# CMD:` 原文见 §8 证据索引(本表「组」列即四组,无第五组)。
|
各归档证据文件的 passed 数四者一一对齐(A3 轮两份 + A3a/A3a-1/A3a-1b 轮复跑件,见 §8 索引);证据文件首行 `# CMD:` 原文见 §8 证据索引(本表「组」列即四组,无第五组)。
|
||||||
|
|
||||||
@ -598,8 +609,9 @@ RC=0
|
|||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `tests/evidence/m11b2d_a3_fixture_contract_pytest.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py -v --tb=short` → **17 passed**(`# RC=0`) | **本任务交付物执行证据** |
|
| `tests/evidence/m11b2d_a3_fixture_contract_pytest.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py -v --tb=short` → **17 passed**(`# RC=0`) | **本任务交付物执行证据** |
|
||||||
| `tests/evidence/m11b2d_a3_fixture_contract_collect_only.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py --collect-only -q` → **17 tests collected**(`# RC=0`) | 本任务可收集性证明 |
|
| `tests/evidence/m11b2d_a3_fixture_contract_collect_only.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py --collect-only -q` → **17 tests collected**(`# RC=0`) | 本任务可收集性证明 |
|
||||||
| `tests/evidence/m11b2d_a3a1_fixture_contract_rerun.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py -q --tb=no` → **17 passed in 0.07s**(`# RC=0`,`# HEAD: d6514bf`) | **A3a-1b 轮复跑证据**(A3a-1 轮同名件在本轮按任务书被本次真实输出覆盖,旧内容 `# HEAD: 1d1fd3d`;`m11b2d_a3_*` 等历史归档未触碰):响应 QC #6/#7,文档全文恢复后(HEAD `d6514bf`)在当前工作区的复跑留证,本列与文件首行 `# CMD:` 及正文输出逐字一致 |
|
| `tests/evidence/m11b2d_a3a1_fixture_contract_rerun.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py -q --tb=no` → **17 passed in 0.08s**(`# RC=0`,`# HEAD:` 为本轮收口提交(见本件前三行,与 §8 本行同树)) | **A3a-1b 轮复跑证据(重做轮)**:文档全文按 `1a4002e` 基线恢复(49,966B/609 行,提交 `6a1cce6`)后在同一棵树实跑留证;上一版证据对应 `d6514bf`,而交付态被代收口 `5b56b27` 覆盖成 20 行摘录后实跑 `2 failed, 15 passed`,证据与仓库状态脱钩(QC #2),本行已用新输出覆盖(A3a-1 轮同名件旧内容 `# HEAD: 1d1fd3d` 已被本轮覆盖,`m11b2d_a3_*` 等历史归档未触碰);本列与文件首行 `# CMD:` 及正文输出逐字一致 |
|
||||||
| `tests/evidence/m11b2d_a3a1_fixture_contract_collect_only_rerun.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py --collect-only -q` → **17 tests collected in 0.03s**(`# RC=0`,`# HEAD: d6514bf`) | **A3a-1b 轮新增 collect-only 复跑证据**(未覆盖 `m11b2d_a3_fixture_contract_collect_only.txt` 旧归档):四组 17 项可收集性在当前 HEAD 的复证,本列与文件首行 `# CMD:` 及正文输出逐字一致 |
|
| `tests/evidence/m11b2d_a3a1_fixture_contract_collect_only_rerun.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2d_fixture_contract.py --collect-only -q` → **17 tests collected in 0.03s**(`# RC=0`,`# HEAD:` 为本轮收口提交(见本件前三行,与 §8 本行同树)) | **A3a-1b 轮 collect-only 复跑证据(重做轮)**:四组 17 项可收集性在文档全文恢复态 `6a1cce6` 的复证(未覆盖 `m11b2d_a3_fixture_contract_collect_only.txt` 旧归档);本列与文件首行 `# CMD:` 及正文输出逐字一致 |
|
||||||
|
| `tests/evidence/m11b2d_a3a1b_cmd_index_consistency.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python .scratch/a3a1b_cmd_check.py` → **ALL_ROWS_CONSISTENT**(核对行 12:一致 11 + 自指 SKIP-SELF 1,不一致 0;逐行「一致/不一致」清单见正文,`# RC=0`,`# HEAD:` 为本轮收口提交(见本件前三行,与 §8 本行同树)) | **A3a-1b 轮 §8 索引逐字一致性核对输出(本任务新增,响应 QC #3/#4)**:对 §8 表**全部行**取「跑的是什么」列反引号内 CMD 原文,与各证据文件首行 `# CMD:` 去前缀后逐字比对(含 `m11b2d_a3_single_tx_after_revert.txt` 首行路径笔误原样照抄行),非仅核对新增两行 |
|
||||||
| `tests/evidence/m11b2d_a3a_single_tx_after_revert_corrected.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2_single_tx.py -q --tb=no` → **8 failed, 32 passed, 8 xfailed**(`# RC=1`) | **A3a 轮修正版证据**:§7 移交依据(文件名与 CMD 逐字一致) |
|
| `tests/evidence/m11b2d_a3a_single_tx_after_revert_corrected.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2_single_tx.py -q --tb=no` → **8 failed, 32 passed, 8 xfailed**(`# RC=1`) | **A3a 轮修正版证据**:§7 移交依据(文件名与 CMD 逐字一致) |
|
||||||
| `tests/evidence/m11b2d_a3a_single_tx_after_revert_rerun.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2_single_tx.py -q --tb=no` → **8 failed, 32 passed, 8 xfailed in 0.27s**(`# RC=1`,`# HEAD: 8d3ac39`) | **A3a-1 轮重跑证据(本任务新增,不覆盖任何旧归档)**:本列与文件首行逐字一致,§7 移交结论的引用锚点 |
|
| `tests/evidence/m11b2d_a3a_single_tx_after_revert_rerun.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2_single_tx.py -q --tb=no` → **8 failed, 32 passed, 8 xfailed in 0.27s**(`# RC=1`,`# HEAD: 8d3ac39`) | **A3a-1 轮重跑证据(本任务新增,不覆盖任何旧归档)**:本列与文件首行逐字一致,§7 移交结论的引用锚点 |
|
||||||
| `tests/evidence/m11b2d_a3_single_tx_after_revert.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2d_single_tx.py -q --tb=no`(**首行原文逐字照抄**:其中路径 `test_m11b2d_single_tx.py` 系 A3 轮笔误,该文件不存在;正文 8 条 FAILED 行均为 `tests/test_m11b2_single_tx.py`,末行 `8 failed, 32 passed, 8 xfailed in 0.26s`,该归档无 `# RC=` 行) | A3 轮归档,原样保留不覆盖;笔误在此登记,「CMD 与所跑内容严格一致」的版本见上一行 |
|
| `tests/evidence/m11b2d_a3_single_tx_after_revert.txt` | `# CMD: cd modules/world_sync && ./.venv/bin/python -m pytest tests/test_m11b2d_single_tx.py -q --tb=no`(**首行原文逐字照抄**:其中路径 `test_m11b2d_single_tx.py` 系 A3 轮笔误,该文件不存在;正文 8 条 FAILED 行均为 `tests/test_m11b2_single_tx.py`,末行 `8 failed, 32 passed, 8 xfailed in 0.26s`,该归档无 `# RC=` 行) | A3 轮归档,原样保留不覆盖;笔误在此登记,「CMD 与所跑内容严格一致」的版本见上一行 |
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user