@walvka-code/proj-doc-builder 4.0.0 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +290 -272
- package/README.zh-CN.md +258 -240
- package/package.json +6 -2
- package/skills/proj-doc-builder/SKILL.md +97 -35
- package/skills/proj-doc-builder/references/audit_script.md +103 -96
- package/skills/proj-doc-builder/references/batch-generation.md +55 -0
- package/skills/proj-doc-builder/references/checklist.md +20 -10
- package/skills/proj-doc-builder/references/exclusions.md +1 -1
- package/skills/proj-doc-builder/references/linking.md +83 -83
- package/skills/proj-doc-builder/references/templates.md +57 -17
- package/skills/proj-doc-builder/tests/claims.json +76 -0
- package/skills/proj-doc-builder/tests/conftest.py +17 -5
- package/skills/proj-doc-builder/tests/test_claims_registry.py +81 -0
- package/skills/proj-doc-builder/tests/test_e2e_fresh_project.py +156 -0
- package/skills/proj-doc-builder/tests/test_load_docs.py +353 -248
- package/skills/proj-doc-builder/tests/test_project_docs_contract.py +32 -1
- package/skills/proj-doc-builder/tests/test_scan_dirs.py +1 -1
- package/skills/proj-doc-builder/tests/test_stage1_stage2_upgrades.py +395 -0
- package/skills/proj-doc-builder/tests/test_sync_project_docs.py +2169 -2169
- package/skills/proj-doc-builder/tests/test_v41_upgrades.py +614 -0
- package/skills/proj-doc-builder/tests/test_v42_upgrades.py +422 -0
- package/skills/proj-doc-builder/tests/test_v43_upgrades.py +198 -0
- package/skills/proj-doc-builder/tests/test_v44_upgrades.py +361 -0
- package/skills/proj-doc-builder/tests/test_v45_upgrades.py +212 -0
- package/skills/proj-doc-builder/tests/test_validate_doc.py +172 -15
- package/skills/proj-doc-builder/tools/_paths.py +39 -0
- package/skills/proj-doc-builder/tools/{claude_doc_index.py → core/claude_doc_index.py} +504 -298
- package/skills/proj-doc-builder/tools/{compute_link.py → core/compute_link.py} +239 -233
- package/skills/proj-doc-builder/tools/core/proj_doc_config.py +460 -0
- package/skills/proj-doc-builder/tools/{project_docs_contract.py → core/project_docs_contract.py} +460 -53
- package/skills/proj-doc-builder/tools/phase4/__init__.py +31 -6
- package/skills/proj-doc-builder/tools/phase4/cas_storage.py +11 -4
- package/skills/proj-doc-builder/tools/phase4/engine.py +17 -2
- package/skills/proj-doc-builder/tools/phase4/journal.py +15 -8
- package/skills/proj-doc-builder/tools/phase4/platform_handles.py +12 -5
- package/skills/proj-doc-builder/tools/phase4_exit.py +153 -47
- package/skills/proj-doc-builder/tools/pipeline/gen_docs_from_scaffold.py +789 -0
- package/skills/proj-doc-builder/tools/{sync_project_docs.py → pipeline/sync_project_docs.py} +5531 -3639
- package/skills/proj-doc-builder/tools/{load_docs.py → reader/load_docs.py} +654 -380
- package/skills/proj-doc-builder/tools/{link_check.py → scan/link_check.py} +203 -152
- package/skills/proj-doc-builder/tools/{normalize_markers.py → scan/normalize_markers.py} +211 -205
- package/skills/proj-doc-builder/tools/{scan_dirs.py → scan/scan_dirs.py} +2735 -2405
- package/skills/proj-doc-builder/tools/{validate_doc.py → validate/validate_doc.py} +1911 -1299
- package/skills/proj-doc-builder/tests/__pycache__/conftest.cpython-314-pytest-9.0.3.pyc +0 -0
- package/skills/proj-doc-builder/tests/__pycache__/test_claude_doc_index.cpython-314-pytest-9.0.3.pyc +0 -0
- package/skills/proj-doc-builder/tests/__pycache__/test_link_tools.cpython-314-pytest-9.0.3.pyc +0 -0
- package/skills/proj-doc-builder/tests/__pycache__/test_load_docs.cpython-314-pytest-9.0.3.pyc +0 -0
- package/skills/proj-doc-builder/tests/__pycache__/test_normalize_markers.cpython-314-pytest-9.0.3.pyc +0 -0
- package/skills/proj-doc-builder/tests/__pycache__/test_phase4_exit.cpython-314-pytest-9.0.3.pyc +0 -0
- package/skills/proj-doc-builder/tests/__pycache__/test_project_docs_contract.cpython-314-pytest-9.0.3.pyc +0 -0
- package/skills/proj-doc-builder/tests/__pycache__/test_scan_dirs.cpython-314-pytest-9.0.3.pyc +0 -0
- package/skills/proj-doc-builder/tests/__pycache__/test_sync_project_docs.cpython-314-pytest-9.0.3.pyc +0 -0
- package/skills/proj-doc-builder/tools/__pycache__/claude_doc_index.cpython-314.pyc +0 -0
- package/skills/proj-doc-builder/tools/__pycache__/compute_link.cpython-314.pyc +0 -0
- package/skills/proj-doc-builder/tools/__pycache__/link_check.cpython-314.pyc +0 -0
- package/skills/proj-doc-builder/tools/__pycache__/load_docs.cpython-314.pyc +0 -0
- package/skills/proj-doc-builder/tools/__pycache__/normalize_markers.cpython-314.pyc +0 -0
- package/skills/proj-doc-builder/tools/__pycache__/phase4_exit.cpython-314.pyc +0 -0
- package/skills/proj-doc-builder/tools/__pycache__/project_docs_contract.cpython-314.pyc +0 -0
- package/skills/proj-doc-builder/tools/__pycache__/scan_dirs.cpython-314.pyc +0 -0
- package/skills/proj-doc-builder/tools/__pycache__/sync_project_docs.cpython-314.pyc +0 -0
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
# 链接计算与校验规则
|
|
2
|
-
|
|
3
|
-
## 单一规则来源
|
|
4
|
-
|
|
5
|
-
`<skill-dir>/tools/project_docs_contract.py` 是文档路径和 Markdown 链接解析的唯一规则来源。`compute_link.py`、`link_check.py` 与 Phase 4 必须复用该契约,不得各自实现正则和路径归一化。
|
|
6
|
-
|
|
7
|
-
本地文档路径必须满足:
|
|
8
|
-
|
|
9
|
-
- 使用相对 POSIX 路径和正斜杠 `/`;
|
|
10
|
-
- 文档扩展名为小写 `.md`;extensionless 文档链接由工具补 `.md`;
|
|
11
|
-
- URL percent escape 按严格 UTF-8 解码;
|
|
12
|
-
- query 与 fragment 不参与文件定位;
|
|
13
|
-
- inline link、full/collapsed/shortcut reference-style link 和 HTML `<a href>` 使用同一 resolver;
|
|
14
|
-
- image 不计作文档引用,reference definition 本身不重复计数;
|
|
15
|
-
- 解析后的目标必须仍位于 `project_docs/` 内;
|
|
16
|
-
- 绝对路径、盘符、UNC、NUL、反斜杠、越界 `..`、symlink/junction 逃逸均视为无效;
|
|
17
|
-
- 外部 URI、同文档 anchor 和已知源码文件扩展名跳过;
|
|
18
|
-
- `.quarantine/` 不参与全库链接检查。
|
|
19
|
-
|
|
20
|
-
## 工具调用
|
|
21
|
-
|
|
22
|
-
不要手工计算 `../` 层级。
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
# 单个链接;允许目标尚未写入
|
|
26
|
-
python "<skill-dir>/tools/compute_link.py" \
|
|
27
|
-
--project-docs project_docs \
|
|
28
|
-
--from project_docs/src/core.md \
|
|
29
|
-
--to project_docs/src/utils/common.md
|
|
30
|
-
|
|
31
|
-
# 要求两端文档已经存在
|
|
32
|
-
python "<skill-dir>/tools/compute_link.py" \
|
|
33
|
-
--project-docs project_docs \
|
|
34
|
-
--from src/core.md \
|
|
35
|
-
--to src/utils/common.md \
|
|
36
|
-
--must-exist
|
|
37
|
-
|
|
38
|
-
# 校验单个文档,stdout 仅输出 JSON
|
|
39
|
-
python "<skill-dir>/tools/compute_link.py" \
|
|
40
|
-
--project-docs project_docs \
|
|
41
|
-
--validate src/core.md \
|
|
42
|
-
--json
|
|
43
|
-
|
|
44
|
-
# 批量计算;输出采用同目录临时文件 + os.replace 原子写
|
|
45
|
-
python "<skill-dir>/tools/compute_link.py" \
|
|
46
|
-
--project-docs project_docs \
|
|
47
|
-
--batch links.json \
|
|
48
|
-
--output resolved.json
|
|
49
|
-
|
|
50
|
-
# 全库只读检查;不会生成或覆盖 manifest
|
|
51
|
-
python "<skill-dir>/tools/link_check.py" --project-docs project_docs --json
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
退出码:
|
|
55
|
-
|
|
56
|
-
- `0`:全部有效;
|
|
57
|
-
- `1`:发现无效或不存在的本地文档链接;
|
|
58
|
-
- `2`:输入、路径、编码或契约错误。
|
|
59
|
-
|
|
60
|
-
## 禁止的写法
|
|
61
|
-
|
|
62
|
-
| 禁止 | 原因 | 处理 |
|
|
63
|
-
|------|------|------|
|
|
64
|
-
| `[name](../../project_docs/x/y.md)` | 重复嵌入输出根且可能越界 | 用 `compute_link.py` 生成 |
|
|
65
|
-
| `[name](C:/project_docs/x.md)` | 盘符绝对路径不可移植 | 使用相对 POSIX 路径 |
|
|
66
|
-
| `[name](..\\x.md)` | 反斜杠规则在不同平台不一致 | 使用 `/` |
|
|
67
|
-
| `[name](../%FF.md)` | percent escape 不是严格 UTF-8 | 修正链接文本 |
|
|
68
|
-
| 手工按 basename 统计引用 | 同名文档会误计数 | 使用共享 resolver |
|
|
69
|
-
|
|
70
|
-
## 批量输入格式
|
|
71
|
-
|
|
72
|
-
```json
|
|
73
|
-
{
|
|
74
|
-
"pairs": [
|
|
75
|
-
{
|
|
76
|
-
"from": "src/core.md",
|
|
77
|
-
"to": "src/utils/common.md"
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
批量 JSON 必须是严格 UTF-8,重复 key、`NaN` 和 `Infinity` 会被拒绝。
|
|
1
|
+
# 链接计算与校验规则
|
|
2
|
+
|
|
3
|
+
## 单一规则来源
|
|
4
|
+
|
|
5
|
+
`<skill-dir>/tools/core/project_docs_contract.py` 是文档路径和 Markdown 链接解析的唯一规则来源。`compute_link.py`、`link_check.py` 与 Phase 4 必须复用该契约,不得各自实现正则和路径归一化。
|
|
6
|
+
|
|
7
|
+
本地文档路径必须满足:
|
|
8
|
+
|
|
9
|
+
- 使用相对 POSIX 路径和正斜杠 `/`;
|
|
10
|
+
- 文档扩展名为小写 `.md`;extensionless 文档链接由工具补 `.md`;
|
|
11
|
+
- URL percent escape 按严格 UTF-8 解码;
|
|
12
|
+
- query 与 fragment 不参与文件定位;
|
|
13
|
+
- inline link、full/collapsed/shortcut reference-style link 和 HTML `<a href>` 使用同一 resolver;
|
|
14
|
+
- image 不计作文档引用,reference definition 本身不重复计数;
|
|
15
|
+
- 解析后的目标必须仍位于 `project_docs/` 内;
|
|
16
|
+
- 绝对路径、盘符、UNC、NUL、反斜杠、越界 `..`、symlink/junction 逃逸均视为无效;
|
|
17
|
+
- 外部 URI、同文档 anchor 和已知源码文件扩展名跳过;
|
|
18
|
+
- `.quarantine/` 不参与全库链接检查。
|
|
19
|
+
|
|
20
|
+
## 工具调用
|
|
21
|
+
|
|
22
|
+
不要手工计算 `../` 层级。
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# 单个链接;允许目标尚未写入
|
|
26
|
+
python "<skill-dir>/tools/core/compute_link.py" \
|
|
27
|
+
--project-docs project_docs \
|
|
28
|
+
--from project_docs/src/core.md \
|
|
29
|
+
--to project_docs/src/utils/common.md
|
|
30
|
+
|
|
31
|
+
# 要求两端文档已经存在
|
|
32
|
+
python "<skill-dir>/tools/core/compute_link.py" \
|
|
33
|
+
--project-docs project_docs \
|
|
34
|
+
--from src/core.md \
|
|
35
|
+
--to src/utils/common.md \
|
|
36
|
+
--must-exist
|
|
37
|
+
|
|
38
|
+
# 校验单个文档,stdout 仅输出 JSON
|
|
39
|
+
python "<skill-dir>/tools/core/compute_link.py" \
|
|
40
|
+
--project-docs project_docs \
|
|
41
|
+
--validate src/core.md \
|
|
42
|
+
--json
|
|
43
|
+
|
|
44
|
+
# 批量计算;输出采用同目录临时文件 + os.replace 原子写
|
|
45
|
+
python "<skill-dir>/tools/core/compute_link.py" \
|
|
46
|
+
--project-docs project_docs \
|
|
47
|
+
--batch links.json \
|
|
48
|
+
--output resolved.json
|
|
49
|
+
|
|
50
|
+
# 全库只读检查;不会生成或覆盖 manifest
|
|
51
|
+
python "<skill-dir>/tools/scan/link_check.py" --project-docs project_docs --json
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
退出码:
|
|
55
|
+
|
|
56
|
+
- `0`:全部有效;
|
|
57
|
+
- `1`:发现无效或不存在的本地文档链接;
|
|
58
|
+
- `2`:输入、路径、编码或契约错误。
|
|
59
|
+
|
|
60
|
+
## 禁止的写法
|
|
61
|
+
|
|
62
|
+
| 禁止 | 原因 | 处理 |
|
|
63
|
+
|------|------|------|
|
|
64
|
+
| `[name](../../project_docs/x/y.md)` | 重复嵌入输出根且可能越界 | 用 `compute_link.py` 生成 |
|
|
65
|
+
| `[name](C:/project_docs/x.md)` | 盘符绝对路径不可移植 | 使用相对 POSIX 路径 |
|
|
66
|
+
| `[name](..\\x.md)` | 反斜杠规则在不同平台不一致 | 使用 `/` |
|
|
67
|
+
| `[name](../%FF.md)` | percent escape 不是严格 UTF-8 | 修正链接文本 |
|
|
68
|
+
| 手工按 basename 统计引用 | 同名文档会误计数 | 使用共享 resolver |
|
|
69
|
+
|
|
70
|
+
## 批量输入格式
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"pairs": [
|
|
75
|
+
{
|
|
76
|
+
"from": "src/core.md",
|
|
77
|
+
"to": "src/utils/common.md"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
批量 JSON 必须是严格 UTF-8,重复 key、`NaN` 和 `Infinity` 会被拒绝。
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# 文档模板 (Phase 2.6)
|
|
2
2
|
|
|
3
|
-
proj-doc-builder v4.
|
|
3
|
+
proj-doc-builder v4.5 使用以下模板。Agent 在 Phase 2 生成文档时应严格遵循。
|
|
4
|
+
|
|
5
|
+
> **v4.5 变更**:standard 模板由「概述 + 8 节」扩展为「深度概述 + 11 节」,新增
|
|
6
|
+
> **数据与状态**、**性能与资源特征**、**变更与迁移注意** 三节。doc_contract_version
|
|
7
|
+
> 由 4.1 升为 4.2;旧文档由 `--upgrade-plan` 报告,未变化的历史文档只审计不阻断。
|
|
4
8
|
|
|
5
9
|
---
|
|
6
10
|
|
|
@@ -19,24 +23,32 @@ proj-doc-builder v4.0 使用以下模板。Agent 在 Phase 2 生成文档时应
|
|
|
19
23
|
3. **文件计数一致**:概述中提到的文件数必须等于表格行数。
|
|
20
24
|
4. **按文件名字母序排列**。
|
|
21
25
|
5. **空目录降级**:如果源码目录为空(0 个直接文件且 0 个子目录),文档必须使用 placeholder 模板。
|
|
26
|
+
6. **规模可读**:每行"关键内容"至少给出一个可定位的符号/结构/配置 key,不得只写角色词。
|
|
22
27
|
|
|
23
28
|
---
|
|
24
29
|
|
|
25
30
|
## 概述铁律
|
|
26
31
|
|
|
27
32
|
> **概述是文档的信息密度核心——AI 和人类读者首先看的就是概述。**
|
|
33
|
+
> v4.5 起标准概述为 **8–10 句**,须覆盖六个角度;少于 8 句视为信息不足。
|
|
28
34
|
|
|
29
35
|
1. **禁止模板套话**:严禁使用以下泛化句式(自动检测黑名单):
|
|
30
36
|
- "本目录(X)是 V4 工程中 X 模块的组成单元,承载对应的实现或数据"
|
|
31
37
|
- "构成该单元的主体内容"
|
|
32
38
|
- "该单元与工程内相邻模块通过既有接口与文档契约交互,服务算法对通与测试回归目标"
|
|
33
39
|
- "下辖 N 个子目录,覆盖相关主题域的细分实现"
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
|
|
40
|
+
- "提供目录归属、公共基础设施与配置支撑"
|
|
41
|
+
- "输出对应的代码或数据产物"
|
|
42
|
+
2. **六角度必须真实**(8–10 句覆盖):
|
|
43
|
+
- **定位**:目录在工程架构中的确切位置与角色(不是"组成单元")
|
|
44
|
+
- **输入**:从哪些上游模块/数据源、以何种格式接收数据
|
|
45
|
+
- **核心处理**:执行的核心算法/流程,以及并发模型或时序约束
|
|
46
|
+
- **输出**:向下游/调用方交付的数据结构与业务契约
|
|
47
|
+
- **边界**:明确的非职责(本目录不做什么),避免读者误判归属
|
|
48
|
+
- **失败模式**:关键失败路径、降级或熔断策略
|
|
49
|
+
3. **信息密度要求**:概述至少包含 **4 个具体实体名称**(类名、函数名、标准编号、配置 key、文件名等)。
|
|
39
50
|
4. **父目录概述**:如果目录无直接文件、只有子目录,概述必须列出各子目录的文件计数与核心职责。
|
|
51
|
+
5. **不堆砌**:不得为凑句数重复同一事实;一句只承载一个新增信息。
|
|
40
52
|
|
|
41
53
|
---
|
|
42
54
|
|
|
@@ -47,17 +59,14 @@ proj-doc-builder v4.0 使用以下模板。Agent 在 Phase 2 生成文档时应
|
|
|
47
59
|
|
|
48
60
|
<!-- DOC-PATH: project_docs/<relpath>/<folder_name>.md -->
|
|
49
61
|
<!-- AUTO-GENERATED v3.0: folder-doc START -->
|
|
50
|
-
<!-- Last synced: <ISO8601> by proj-doc-builder v4.
|
|
62
|
+
<!-- Last synced: <ISO8601> by proj-doc-builder v4.5 -->
|
|
51
63
|
|
|
52
64
|
**导航**: <parent_breadcrumb> > **<folder_name>**
|
|
53
65
|
|
|
54
66
|
## 概述
|
|
55
67
|
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
2. 核心处理与时效:执行的核心算法、并发模型或处理周期/延迟约束;
|
|
59
|
-
3. 下游交付:向下游产物或调用方交付何种数据结构与业务契约。
|
|
60
|
-
严禁使用"负责承担...的关键业务逻辑与基础设施功能"、"提供规范化的接口抽象"等泛化空话套话。>
|
|
68
|
+
<8-10 句高信息密度实质描述,按「定位 → 输入 → 核心处理 → 输出 → 边界 → 失败模式」
|
|
69
|
+
六角度展开,至少出现 4 个具体实体名。严禁空话套话。>
|
|
61
70
|
|
|
62
71
|
## 文件清单
|
|
63
72
|
|
|
@@ -74,8 +83,8 @@ proj-doc-builder v4.0 使用以下模板。Agent 在 Phase 2 生成文档时应
|
|
|
74
83
|
|
|
75
84
|
| 符号 | 类型 | 定义位置 | 说明 |
|
|
76
85
|
|------|------|---------|------|
|
|
77
|
-
| `ClassName` | class | `<file>.py:L
|
|
78
|
-
| `function_name` | function | `<file>.py:L
|
|
86
|
+
| `ClassName` | class | `<file>.py:L行号` | <核心能力 + 对外核心方法完整签名,如 `def run(self, ctx: Context) -> Result`> |
|
|
87
|
+
| `function_name` | function | `<file>.py:L行号` | <完整签名 + 核心业务用途,如 `def calc(v: float) -> float`> |
|
|
79
88
|
|
|
80
89
|
<≤10 文件的叶子目录:列出全部符号。>10 文件:列出最重要的 10 个。父目录:列出各子模块暴露的公共接口。>
|
|
81
90
|
|
|
@@ -109,6 +118,30 @@ proj-doc-builder v4.0 使用以下模板。Agent 在 Phase 2 生成文档时应
|
|
|
109
118
|
- 核心处理模式(如快慢双轨解耦、原子事务、事件流总线)
|
|
110
119
|
- 确切的数据输入源与输出流向
|
|
111
120
|
|
|
121
|
+
## 数据与状态
|
|
122
|
+
|
|
123
|
+
<说明本目录读写的持久化数据、运行时状态、缓存与生命周期。至少覆盖:
|
|
124
|
+
1. 写入/读取的文件或数据库(相对路径 + 作用),如 `_scan_state.json`、`.projdoc.toml`;
|
|
125
|
+
2. 进程内状态(全局单例、缓存、锁)与跨进程状态(文件锁、日志、journal);
|
|
126
|
+
3. 状态的生命周期:何时创建、何时清理、失败后如何回滚或恢复。
|
|
127
|
+
如本目录不涉及持久化或状态,写:本节不适用:<一行具体理由>。>
|
|
128
|
+
|
|
129
|
+
## 性能与资源特征
|
|
130
|
+
|
|
131
|
+
<量化或半量化说明成本特征,避免"性能良好"之类空话。至少覆盖一项:
|
|
132
|
+
1. 时间复杂度或算法量级(如 O(n log n) 的全树扫描、单次遍历去重);
|
|
133
|
+
2. 内存/磁盘占用特征(如一次性载入整个 manifest、流式处理大文件);
|
|
134
|
+
3. IO 与并发约束(如目录 fsync 次数、文件锁粒度、并行 worker 上限)。
|
|
135
|
+
如确无性能敏感点,写:本节不适用:<一行具体理由>,并说明数据规模上限。>
|
|
136
|
+
|
|
137
|
+
## 变更与迁移注意
|
|
138
|
+
|
|
139
|
+
<记录升级/迁移时必须知道的事实,避免"无"字敷衍。至少覆盖一项:
|
|
140
|
+
1. 对外契约变化(配置 key、CLI 参数、manifest 字段、文档格式)及其向后兼容策略;
|
|
141
|
+
2. 数据迁移路径(旧格式 → 新格式的转换命令或脚本),如 `--migrate-manifest`;
|
|
142
|
+
3. 已知的破坏性改动与规避方式。
|
|
143
|
+
如本目录自首版以来无契约变化,写:本节不适用:<一行具体理由>。>
|
|
144
|
+
|
|
112
145
|
## 使用示例
|
|
113
146
|
|
|
114
147
|
```python
|
|
@@ -122,7 +155,7 @@ result = engine.execute(data)
|
|
|
122
155
|
|
|
123
156
|
## 状态
|
|
124
157
|
|
|
125
|
-
<当前状态:✅ 完整 / 🔶 开发中 / ⬜
|
|
158
|
+
<当前状态:✅ 完整 / 🔶 开发中 / ⬜ 占位 / 📦 历史存档 / ❓ 未知,以及简短说明>
|
|
126
159
|
|
|
127
160
|
<!-- AUTO-GENERATED v3.0: folder-doc END -->
|
|
128
161
|
```
|
|
@@ -132,6 +165,10 @@ result = engine.execute(data)
|
|
|
132
165
|
**叶子目录**(无子目录):省略"子目录"节。
|
|
133
166
|
**边界目录**(含自身 CLAUDE.md):概述末尾追加 `> **边界目录**:本目录有独立的 CLAUDE.md,此处仅列概要。`,不递归进入子目录。
|
|
134
167
|
**纯 C 头文件目录**(无 Python `__init__.py`):省略"关键符号"节,但在文件清单的"关键内容"列中列出核心宏定义、结构体名或函数签名。
|
|
168
|
+
**历史存档目录**(归档报告、冻结会话证据、旧版本快照等):状态段使用 `📦 历史存档 — <归档内容与来源说明>`,不得为通过校验而将历史归档标为 `✅ 完整` 或 `⬜ 占位 — 待实现`。
|
|
169
|
+
**纯文档/配置目录**(无源码、无可执行逻辑):仍需保留「数据与状态」「变更与迁移注意」两节;「性能与资源特征」可写 `本节不适用:<理由>`。
|
|
170
|
+
|
|
171
|
+
---
|
|
135
172
|
|
|
136
173
|
## 模板 2: 占位目录
|
|
137
174
|
|
|
@@ -140,7 +177,7 @@ result = engine.execute(data)
|
|
|
140
177
|
|
|
141
178
|
<!-- DOC-PATH: project_docs/<relpath>/<folder_name>.md -->
|
|
142
179
|
<!-- AUTO-GENERATED v3.0: folder-doc START -->
|
|
143
|
-
<!-- Last synced: <ISO8601> by proj-doc-builder v4.
|
|
180
|
+
<!-- Last synced: <ISO8601> by proj-doc-builder v4.5 -->
|
|
144
181
|
|
|
145
182
|
**导航**: <parent_breadcrumb> > **<folder_name>**
|
|
146
183
|
|
|
@@ -169,4 +206,7 @@ result = engine.execute(data)
|
|
|
169
206
|
|
|
170
207
|
### 占位变体
|
|
171
208
|
|
|
172
|
-
**空目录**(0 文件 0 子目录):文件清单写"(当前目录为空,无直接文件。)",状态写 `⬜ 占位 —
|
|
209
|
+
**空目录**(0 文件 0 子目录):文件清单写"(当前目录为空,无直接文件。)",状态写 `⬜ 占位 — 目录当前为空。`
|
|
210
|
+
|
|
211
|
+
> 占位目录不要求「数据与状态」「性能与资源特征」「变更与迁移注意」三节;一旦出现实质文件,
|
|
212
|
+
> 必须切换到 standard 模板并补齐三节。
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": 1,
|
|
3
|
+
"description": "Traceability registry: every guarantee stated in SKILL.md must (a) still appear verbatim in the named doc file and (b) be pinned by a named test function. CI fails if an anchor is edited without updating this file, or if the pinning test is renamed/removed. Add a new claim whenever SKILL.md gains a hard guarantee.",
|
|
4
|
+
"claims": [
|
|
5
|
+
{
|
|
6
|
+
"id": "dry-run-default",
|
|
7
|
+
"doc": "SKILL.md",
|
|
8
|
+
"anchor": "默认先 dry-run;只有所有闸门通过后才运行 coordinator `--apply`。",
|
|
9
|
+
"test_module": "test_sync_project_docs.py",
|
|
10
|
+
"test_function": "test_dry_run_passes_all_gates_without_writing"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "zero-change-apply-is-noop",
|
|
14
|
+
"doc": "SKILL.md",
|
|
15
|
+
"anchor": "零变化运行不得刷新 `last_synced`、manifest、CLAUDE 或 scan state。",
|
|
16
|
+
"test_module": "test_sync_project_docs.py",
|
|
17
|
+
"test_function": "test_apply_publishes_v2_state_and_second_run_is_noop"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "pending-journal-blocks-until-recover",
|
|
21
|
+
"doc": "SKILL.md",
|
|
22
|
+
"anchor": "pending Phase 4 journal 必须先通过显式 `--recover` 处理",
|
|
23
|
+
"test_module": "test_phase4_exit.py",
|
|
24
|
+
"test_function": "test_recover_is_blocked_by_every_coordinator_pending_form"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "phase4-report-only",
|
|
28
|
+
"doc": "SKILL.md",
|
|
29
|
+
"anchor": "Phase 4 默认只报告。不得自动删除文档",
|
|
30
|
+
"test_module": "test_phase4_exit.py",
|
|
31
|
+
"test_function": "test_recover_without_journal_is_successful_noop"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "no-symlink-follow",
|
|
35
|
+
"doc": "SKILL.md",
|
|
36
|
+
"anchor": "不跟随 symlink、junction 或 reparse point;路径身份不能证明时 fail closed。",
|
|
37
|
+
"test_module": "test_link_tools.py",
|
|
38
|
+
"test_function": "test_link_check_rejects_symlink_escape"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "strict-utf8",
|
|
42
|
+
"doc": "SKILL.md",
|
|
43
|
+
"anchor": "所有文本严格 UTF-8;Python 文件首行必须是 `# -*- coding: utf-8 -*-`。",
|
|
44
|
+
"test_module": "test_project_docs_contract.py",
|
|
45
|
+
"test_function": "test_build_manifest_rejects_non_utf8_document"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "manifest-path-rules",
|
|
49
|
+
"doc": "SKILL.md",
|
|
50
|
+
"anchor": "manifest path 仅允许相对 POSIX 小写 `.md` 路径",
|
|
51
|
+
"test_module": "test_project_docs_contract.py",
|
|
52
|
+
"test_function": "test_invalid_manifest_paths"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "init-creates-claude-skeleton",
|
|
56
|
+
"doc": "SKILL.md",
|
|
57
|
+
"anchor": "并生成根 `CLAUDE.md` 六大区块骨架(仅当文件不存在;已有文件原样保留)。",
|
|
58
|
+
"test_module": "test_v41_upgrades.py",
|
|
59
|
+
"test_function": "test_init_project_creates_the_six_marker_claude_md"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"id": "full-is-final-gate",
|
|
63
|
+
"doc": "SKILL.md",
|
|
64
|
+
"anchor": "`--full` 强制校验全部文档(`scope = \"all-documents\"`),并要求全量文件清单审计,是发布前的终审档位。",
|
|
65
|
+
"test_module": "test_v45_upgrades.py",
|
|
66
|
+
"test_function": "test_full_blocks_critical_failure_on_unchanged_document"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "loader-verifies-before-serving",
|
|
70
|
+
"doc": "SKILL.md",
|
|
71
|
+
"anchor": "加载器(只读):先校验 manifest 与文档完全一致,再输出工程速览",
|
|
72
|
+
"test_module": "test_load_docs.py",
|
|
73
|
+
"test_function": "test_brief_refuses_a_stale_manifest"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
"""Test import setup for standalone proj-doc-builder tools."""
|
|
3
|
-
|
|
4
|
-
from __future__ import annotations
|
|
2
|
+
"""Test import setup for the layered, standalone proj-doc-builder tools."""
|
|
5
3
|
|
|
4
|
+
import os
|
|
6
5
|
import sys
|
|
7
|
-
from pathlib import Path
|
|
6
|
+
from pathlib import Path as _Path
|
|
7
|
+
|
|
8
|
+
# Keep byte-code caches out of the source tree. Two layers are needed:
|
|
9
|
+
# * this interpreter must not compile tool modules while importing them, and
|
|
10
|
+
# * every child interpreter spawned by a test (crash-injection scripts, CLI
|
|
11
|
+
# subprocesses) inherits the switch through the environment.
|
|
12
|
+
# pytest itself may still cache this conftest.py; run `python -B -m pytest`
|
|
13
|
+
# when a completely cache-free tree matters.
|
|
14
|
+
sys.dont_write_bytecode = True
|
|
15
|
+
os.environ["PYTHONDONTWRITEBYTECODE"] = "1"
|
|
8
16
|
|
|
9
|
-
TOOLS_DIR =
|
|
17
|
+
TOOLS_DIR = _Path(__file__).resolve().parents[1] / "tools"
|
|
10
18
|
if str(TOOLS_DIR) not in sys.path:
|
|
11
19
|
sys.path.insert(0, str(TOOLS_DIR))
|
|
20
|
+
|
|
21
|
+
import _paths # noqa: E402
|
|
22
|
+
|
|
23
|
+
_paths.install(TOOLS_DIR)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Traceability gate: every guarantee in ``claims.json`` must still be present
|
|
3
|
+
verbatim in its named doc file *and* pinned by a named test function.
|
|
4
|
+
|
|
5
|
+
This is the mechanical closure for the review-loop failure mode where "I read
|
|
6
|
+
the code again and found nothing new" — the author's blind spots repeat each
|
|
7
|
+
round. The registry ties a documented sentence to an executable test, so
|
|
8
|
+
editing the sentence (without updating the registry) or renaming the test
|
|
9
|
+
(without updating the registry) fails CI. Add a claim whenever SKILL.md gains
|
|
10
|
+
a hard guarantee.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import ast
|
|
16
|
+
import json
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
import pytest
|
|
20
|
+
|
|
21
|
+
_SKILL_DIR = Path(__file__).resolve().parents[1]
|
|
22
|
+
_REGISTRY = _SKILL_DIR / "tests" / "claims.json"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _load_claims() -> list[dict]:
|
|
26
|
+
payload = json.loads(_REGISTRY.read_text(encoding="utf-8"))
|
|
27
|
+
claims = payload["claims"]
|
|
28
|
+
assert isinstance(claims, list) and claims, "claims.json has no claims"
|
|
29
|
+
return claims
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _test_functions(module_path: Path) -> set[str]:
|
|
33
|
+
tree = ast.parse(module_path.read_text(encoding="utf-8"), filename=str(module_path))
|
|
34
|
+
return {
|
|
35
|
+
node.name
|
|
36
|
+
for node in ast.walk(tree)
|
|
37
|
+
if isinstance(node, ast.FunctionDef) and node.name.startswith("test_")
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
CLAIMS = _load_claims()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_registry_claims_are_unique() -> None:
|
|
45
|
+
ids = [c["id"] for c in CLAIMS]
|
|
46
|
+
assert len(ids) == len(set(ids)), f"duplicate claim ids: {ids}"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_registry_has_at_least_ten_pinned_guarantees() -> None:
|
|
50
|
+
assert len(CLAIMS) >= 10, (
|
|
51
|
+
f"registry shrank to {len(CLAIMS)} claims; the review loop's closure "
|
|
52
|
+
"depends on every hard guarantee being pinned — do not drop claims"
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@pytest.mark.parametrize("claim", CLAIMS, ids=lambda c: c["id"])
|
|
57
|
+
def test_claim_anchor_is_present_in_doc(claim: dict) -> None:
|
|
58
|
+
doc_path = _SKILL_DIR / claim["doc"]
|
|
59
|
+
assert doc_path.is_file(), f"claim {claim['id']}: doc {claim['doc']} missing"
|
|
60
|
+
text = doc_path.read_text(encoding="utf-8")
|
|
61
|
+
assert claim["anchor"] in text, (
|
|
62
|
+
f"claim {claim['id']}: anchor not found verbatim in {claim['doc']}.\n"
|
|
63
|
+
f" expected: {claim['anchor']!r}\n"
|
|
64
|
+
" If you edited this sentence, update claims.json to match (the "
|
|
65
|
+
"registry is the source of truth for the guarantee's wording)."
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@pytest.mark.parametrize("claim", CLAIMS, ids=lambda c: c["id"])
|
|
70
|
+
def test_claim_is_pinned_by_a_live_test_function(claim: dict) -> None:
|
|
71
|
+
module_path = _SKILL_DIR / "tests" / claim["test_module"]
|
|
72
|
+
assert module_path.is_file(), (
|
|
73
|
+
f"claim {claim['id']}: test module {claim['test_module']} missing"
|
|
74
|
+
)
|
|
75
|
+
funcs = _test_functions(module_path)
|
|
76
|
+
assert claim["test_function"] in funcs, (
|
|
77
|
+
f"claim {claim['id']}: test function {claim['test_function']!r} not "
|
|
78
|
+
f"defined in {claim['test_module']}. If you renamed or deleted it, "
|
|
79
|
+
"either restore it or re-point the claim in claims.json to its "
|
|
80
|
+
"replacement (the guarantee must remain pinned by an executable test)."
|
|
81
|
+
)
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""End-to-end happy path: the documented ``init → scaffold-dump → gen → apply``
|
|
3
|
+
chain must bootstrap a non-empty project on a *fresh* tree, and a zero-change
|
|
4
|
+
re-apply must write nothing.
|
|
5
|
+
|
|
6
|
+
This test exists because the six-phase workflow in SKILL.md was the one path
|
|
7
|
+
no unit test exercised end-to-end. The review loop found that ``--init`` once
|
|
8
|
+
shipped without a CLAUDE.md skeleton and that ``--apply`` on an empty tree
|
|
9
|
+
published a ``total: 0`` manifest that then starved the scaffold of facts;
|
|
10
|
+
both defects survived 400+ focused unit tests because no test ran the
|
|
11
|
+
documented happy path from scratch. This test runs it through the real CLI
|
|
12
|
+
subprocesses, exactly as a user would.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import os
|
|
19
|
+
import subprocess
|
|
20
|
+
import sys
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
_TOOLS = Path(__file__).resolve().parents[1] / "tools"
|
|
24
|
+
_SYNC = _TOOLS / "pipeline" / "sync_project_docs.py"
|
|
25
|
+
_GEN = _TOOLS / "pipeline" / "gen_docs_from_scaffold.py"
|
|
26
|
+
_LOAD = _TOOLS / "reader" / "load_docs.py"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _run(script: Path, cwd: Path, *args: str, allow_failure: bool = False) -> dict:
|
|
30
|
+
env = {
|
|
31
|
+
**os.environ,
|
|
32
|
+
"PYTHONDONTWRITEBYTECODE": "1",
|
|
33
|
+
# The tools print Chinese diagnostics. A Windows runner's default
|
|
34
|
+
# locale is cp1252, so the child needs a UTF-8 stdio encoding and this
|
|
35
|
+
# parent must decode with one too — otherwise subprocess capture raises
|
|
36
|
+
# UnicodeDecodeError and `stdout` comes back as None.
|
|
37
|
+
"PYTHONUTF8": "1",
|
|
38
|
+
"PYTHONIOENCODING": "utf-8",
|
|
39
|
+
"PYTHONPATH": str(_TOOLS),
|
|
40
|
+
}
|
|
41
|
+
proc = subprocess.run(
|
|
42
|
+
[sys.executable, "-X", "utf8", str(script), *args],
|
|
43
|
+
cwd=str(cwd),
|
|
44
|
+
env=env,
|
|
45
|
+
capture_output=True,
|
|
46
|
+
text=True,
|
|
47
|
+
encoding="utf-8",
|
|
48
|
+
errors="replace",
|
|
49
|
+
timeout=120,
|
|
50
|
+
)
|
|
51
|
+
assert allow_failure or proc.returncode == 0, (
|
|
52
|
+
f"{script.name} {' '.join(args)} failed (rc={proc.returncode}):\n"
|
|
53
|
+
f"stdout:\n{proc.stdout[-1200:]}\nstderr:\n{proc.stderr[-1200:]}"
|
|
54
|
+
)
|
|
55
|
+
return {"stdout": proc.stdout, "stderr": proc.stderr, "returncode": proc.returncode}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _fresh_project(tmp_path: Path) -> Path:
|
|
59
|
+
src = tmp_path / "src"
|
|
60
|
+
src.mkdir()
|
|
61
|
+
(src / "alpha.py").write_text("def alpha():\n return 1\n", encoding="utf-8")
|
|
62
|
+
(src / "beta.py").write_text("def beta():\n return 2\n", encoding="utf-8")
|
|
63
|
+
pkg = tmp_path / "pkg"
|
|
64
|
+
pkg.mkdir()
|
|
65
|
+
(pkg / "__init__.py").write_text("", encoding="utf-8")
|
|
66
|
+
(pkg / "core.py").write_text("class Core:\n pass\n", encoding="utf-8")
|
|
67
|
+
return tmp_path
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_documented_happy_path_bootstraps_a_non_empty_project(tmp_path: Path) -> None:
|
|
71
|
+
root = _fresh_project(tmp_path)
|
|
72
|
+
|
|
73
|
+
_run(_SYNC, root, ".", "--init")
|
|
74
|
+
_run(_SYNC, root, ".", "--scaffold-dump", "scaffold.json", "--paths", ".", "src", "pkg")
|
|
75
|
+
gen = _run(_GEN, root, "--scaffold", "scaffold.json", "--json")
|
|
76
|
+
gen_payload = json.loads(gen["stdout"])
|
|
77
|
+
assert gen_payload["written_count"] >= 2, (
|
|
78
|
+
f"generator wrote {gen_payload['written_count']} docs; expected >=2 "
|
|
79
|
+
f"(src.md + index.md). written={gen_payload['written']}"
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
apply = _run(_SYNC, root, ".", "--apply", "--json")
|
|
83
|
+
apply_payload = json.loads(apply["stdout"])
|
|
84
|
+
assert apply_payload["ok"], f"apply failed: {apply_payload}"
|
|
85
|
+
manifest = json.loads((root / "project_docs" / "_manifest.json").read_text(encoding="utf-8"))
|
|
86
|
+
assert manifest["total"] >= 2, (
|
|
87
|
+
f"manifest total={manifest['total']}; the bootstrap must publish the "
|
|
88
|
+
"generated docs, not an empty manifest"
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
brief = _run(_LOAD, root, ".", "--mode", "brief", "--json")
|
|
92
|
+
brief_payload = json.loads(brief["stdout"])
|
|
93
|
+
assert brief_payload["ok"], f"brief failed: {brief_payload}"
|
|
94
|
+
assert brief_payload["counts"]["documents"] >= 2, (
|
|
95
|
+
f"brief reports {brief_payload['counts']['documents']} documents; "
|
|
96
|
+
"a freshly-bootstrapped project must be loadable with a non-zero tree"
|
|
97
|
+
)
|
|
98
|
+
assert brief_payload["manifest"]["doc_contract_version"], (
|
|
99
|
+
"brief must report a real contract version derived from per-file entries"
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def test_zero_change_apply_writes_nothing_after_bootstrap(tmp_path: Path) -> None:
|
|
104
|
+
root = _fresh_project(tmp_path)
|
|
105
|
+
_run(_SYNC, root, ".", "--init")
|
|
106
|
+
_run(_SYNC, root, ".", "--scaffold-dump", "scaffold.json", "--paths", ".", "src", "pkg")
|
|
107
|
+
_run(_GEN, root, "--scaffold", "scaffold.json")
|
|
108
|
+
_run(_SYNC, root, ".", "--apply")
|
|
109
|
+
|
|
110
|
+
manifest_before = (root / "project_docs" / "_manifest.json").read_bytes()
|
|
111
|
+
scan_before = (root / "project_docs" / "_scan_state.json").read_bytes()
|
|
112
|
+
claude_before = (root / "CLAUDE.md").read_bytes()
|
|
113
|
+
|
|
114
|
+
_run(_SYNC, root, ".", "--apply", "--json")
|
|
115
|
+
|
|
116
|
+
assert (root / "project_docs" / "_manifest.json").read_bytes() == manifest_before, (
|
|
117
|
+
"a zero-change apply must not rewrite the manifest"
|
|
118
|
+
)
|
|
119
|
+
assert (root / "project_docs" / "_scan_state.json").read_bytes() == scan_before, (
|
|
120
|
+
"a zero-change apply must not rewrite the scan state"
|
|
121
|
+
)
|
|
122
|
+
assert (root / "CLAUDE.md").read_bytes() == claude_before, (
|
|
123
|
+
"a zero-change apply must not rewrite CLAUDE.md"
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def test_full_dry_run_blocks_a_critical_failure_on_an_unchanged_doc(tmp_path: Path) -> None:
|
|
128
|
+
"""``--full`` is the documented pre-publish terminal gate; it must block
|
|
129
|
+
when an already-published (unchanged) document has a critical check
|
|
130
|
+
failure, not silently pass it advisory-only."""
|
|
131
|
+
root = _fresh_project(tmp_path)
|
|
132
|
+
_run(_SYNC, root, ".", "--init")
|
|
133
|
+
_run(_SYNC, root, ".", "--scaffold-dump", "scaffold.json", "--paths", ".", "src", "pkg")
|
|
134
|
+
_run(_GEN, root, "--scaffold", "scaffold.json")
|
|
135
|
+
_run(_SYNC, root, ".", "--apply")
|
|
136
|
+
|
|
137
|
+
src_doc = root / "project_docs" / "src.md"
|
|
138
|
+
text = src_doc.read_text(encoding="utf-8")
|
|
139
|
+
src_doc.write_text(
|
|
140
|
+
"\n".join(line for line in text.split("\n") if not line.startswith("**导航**")),
|
|
141
|
+
encoding="utf-8",
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
full = _run(_SYNC, root, ".", "--full", "--dry-run", "--json", allow_failure=True)
|
|
145
|
+
assert full["returncode"] != 0, (
|
|
146
|
+
"--full must exit non-zero when an unchanged doc fails a critical check"
|
|
147
|
+
)
|
|
148
|
+
payload = json.loads(full["stdout"])
|
|
149
|
+
validation = payload.get("validation") or {}
|
|
150
|
+
assert not payload["ok"], (
|
|
151
|
+
"--full must block when an unchanged doc fails a critical check"
|
|
152
|
+
)
|
|
153
|
+
blocking = validation.get("blocking_failure_count", 0)
|
|
154
|
+
assert blocking >= 1, (
|
|
155
|
+
f"--full reported blocking_failure_count={blocking}; expected >=1"
|
|
156
|
+
)
|