atlas-project-harness 0.2.0-beta.27 → 0.2.0-beta.28
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/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/_support/__pycache__/ac_coverage.cpython-312.pyc +0 -0
- package/_support/__pycache__/case_block.cpython-312.pyc +0 -0
- package/_support/__pycache__/case_id.cpython-312.pyc +0 -0
- package/_support/__pycache__/layout.cpython-312.pyc +0 -0
- package/_support/__pycache__/manual_block.cpython-312.pyc +0 -0
- package/_support/__pycache__/pw_runner.cpython-312.pyc +0 -0
- package/_support/__pycache__/review_policy.cpython-312.pyc +0 -0
- package/_support/__pycache__/review_scope_core.cpython-312.pyc +0 -0
- package/_support/__pycache__/siblings.cpython-312.pyc +0 -0
- package/_support/__pycache__/stack_profile.cpython-312.pyc +0 -0
- package/_support/__pycache__/url_merge.cpython-312.pyc +0 -0
- package/adapters/__pycache__/_graph.cpython-312.pyc +0 -0
- package/adapters/__pycache__/_jpa.cpython-312.pyc +0 -0
- package/adapters/__pycache__/_lib.cpython-312.pyc +0 -0
- package/adapters/ac/__pycache__/__init__.cpython-312.pyc +0 -0
- package/adapters/ac/__pycache__/command.cpython-312.pyc +0 -0
- package/adapters/ac/__pycache__/js.cpython-312.pyc +0 -0
- package/adapters/ac/__pycache__/junit.cpython-312.pyc +0 -0
- package/adapters/ac/__pycache__/pytest.cpython-312.pyc +0 -0
- package/apply/reference.md +1 -0
- package/package.json +1 -1
- package/patches/project-wiring/__pycache__/apply-wiring.cpython-312.pyc +0 -0
- package/patches/workflow-e2e-trigger/README.md +31 -0
- package/patches/workflow-e2e-trigger/apply-patches.py +263 -0
- package/patches/workflow-e2e-trigger/breadcrumb-in-progress-inline.insert.md +1 -0
- package/patches/workflow-e2e-trigger/breadcrumb-in-progress.insert.md +1 -0
- package/patches/workflow-e2e-trigger/e2e-console-at-3-5.insert.md +1 -0
- package/patches/workflow-e2e-trigger/e2e-trigger-before-final-pass.insert.md +1 -0
- package/patches/workflow-e2e-trigger/spec.json +43 -0
- package/rings/e2e/reference.md +21 -0
- package/scripts/__pycache__/ablation.cpython-312.pyc +0 -0
- package/scripts/__pycache__/atlas_check.cpython-312.pyc +0 -0
- package/scripts/__pycache__/atlas_report.cpython-312.pyc +0 -0
- package/scripts/__pycache__/atlas_review.cpython-312.pyc +0 -0
- package/scripts/__pycache__/atlas_verify.cpython-312.pyc +0 -0
- package/scripts/__pycache__/backflow.cpython-312.pyc +0 -0
- package/scripts/__pycache__/closeout_derive.cpython-312.pyc +0 -0
- package/scripts/__pycache__/e2e_console.cpython-312.pyc +0 -0
- package/scripts/__pycache__/e2e_trigger.cpython-312.pyc +0 -0
- package/scripts/__pycache__/gen_e2e_scripts.cpython-312.pyc +0 -0
- package/scripts/__pycache__/gen_testid_stub.cpython-312.pyc +0 -0
- package/scripts/__pycache__/make_review_inputs.cpython-312.pyc +0 -0
- package/scripts/__pycache__/mutation_proof.cpython-312.pyc +0 -0
- package/scripts/__pycache__/pkg_digest.cpython-312.pyc +0 -0
- package/scripts/__pycache__/refresh_structure.cpython-312.pyc +0 -0
- package/scripts/__pycache__/release.cpython-312.pyc +0 -0
- package/scripts/__pycache__/validate_review_report.cpython-312.pyc +0 -0
- package/scripts/__pycache__/write_claim.cpython-312.pyc +0 -0
- package/scripts/atlas_check.py +81 -7
- package/scripts/e2e_trigger.py +107 -0
- package/shared/gates.md +1 -1
- package/tests/__pycache__/test_ablation.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_ac_adapters.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_adapter_api.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_adapter_models.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_adapter_routes.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_apply_patches.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_apply_wiring.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_atlas_check.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_atlas_check_e2e_skip.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_atlas_eval.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_atlas_report.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_atlas_review.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_atlas_verify.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_atlas_verify_playground.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_backfill_contract.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_backflow.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_canonical_consistency.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_cli_commands.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_cli_review_convert.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_closeout_derive.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_duty_bug_families.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_e2e_console.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_e2e_trigger.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_frontend_reuse_patch.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_gate_registry.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_gen_e2e_scripts.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_graph_backend.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_impact_reconcile.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_impact_report.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_install_selfcheck.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_layout.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_map_anchors.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_nested_repo_gitlink_guard.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_no_framework_names.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_project_wiring.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_refresh_facts.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_review_closure.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_review_report.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_review_scope.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_routes_graph_backend.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_run_python_launcher.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_shared_kernel.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_stack_profile_graph.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_structure_validator.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_suite_hygiene.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_tools.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_validate_ac_alignment.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_validate_adr.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_validate_design_exemptions.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_validate_walkthrough.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_validators.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/__pycache__/test_write_claim.cpython-312-pytest-9.1.1.pyc +0 -0
- package/tests/test_atlas_check_e2e_skip.py +108 -0
- package/tests/test_e2e_trigger.py +72 -0
- package/validators/__pycache__/validate_ac_alignment.cpython-312.pyc +0 -0
- package/validators/__pycache__/validate_adr.cpython-312.pyc +0 -0
- package/validators/__pycache__/validate_design_exemptions.cpython-312.pyc +0 -0
- package/validators/__pycache__/validate_e2e_index.cpython-312.pyc +0 -0
- package/validators/__pycache__/validate_e2e_mocks.cpython-312.pyc +0 -0
- package/validators/__pycache__/validate_prd.cpython-312.pyc +0 -0
- package/validators/__pycache__/validate_stack_profile.cpython-312.pyc +0 -0
- package/validators/__pycache__/validate_structure.cpython-312.pyc +0 -0
- package/validators/__pycache__/validate_testids.cpython-312.pyc +0 -0
- package/validators/__pycache__/validate_walkthrough.cpython-312.pyc +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [v0.2.0-beta.28] - 2026-11-03
|
|
8
|
+
|
|
9
|
+
### 🧭 E2E 就绪触发段(RFC-20261103-07)
|
|
10
|
+
|
|
11
|
+
* **新增**:`patches/workflow-e2e-trigger/` 补丁族 + `scripts/e2e_trigger.py`——在 Phase 2 最后一轮质量检查之前挂入 E2E 触发段:只做就绪归因并委托既有执行器(`atlas_verify`),不生成脚本、不启动控制台;`atlas_check` 的 E2E 行新增机读 `skip_reason`(五态),人读 detail 与 SKIP 判定不变。
|
|
12
|
+
* **契约/文档**:`apply/reference.md`、`rings/e2e/reference.md`、`shared/gates.md`、`docs/map` 同步。
|
|
13
|
+
* **测试**:`tests/test_e2e_trigger.py`、`tests/test_atlas_check_e2e_skip.py`。
|
|
14
|
+
|
|
15
|
+
### 🧭 Windows CI 首跑修复 + 文档校准
|
|
16
|
+
|
|
17
|
+
* **CI**:`windows` 的 CLI exit-code smoke 改为捕获 rc(GitHub bash 的 `-eo pipefail` 会先中断步骤);job 级加 `PYTHONUTF8=1`(Windows 的 Python 默认 cp1252 解码 node 的 UTF-8 中文输出会崩);`windows-native` 改为断言全新脚手架的 `check --fast` **fail-closed exit 1**,并用 resolver 确定性断言替换不可靠的 PATH 影子探针。
|
|
18
|
+
* **文档**:RFC-20261103-04 §4.3 真机清单修正(控制字符 / `check --fast` 期望 / CI 描述漂移);`docs/map` 计数与快照同步。
|
|
19
|
+
|
|
7
20
|
## [v0.2.0-beta.27] - 2026-11-03
|
|
8
21
|
### 🧭 atlas eval 跑分器(RFC-20261103-06)
|
|
9
22
|
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Atlas — 践行 Project Harness 的全流程 AI 编程工作流
|
|
2
2
|
|
|
3
3
|
<p align="left">
|
|
4
|
-
<img src="https://img.shields.io/badge/version-0.2.0--beta.
|
|
4
|
+
<img src="https://img.shields.io/badge/version-0.2.0--beta.28-blue.svg" alt="Version" />
|
|
5
5
|
<img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="License" />
|
|
6
6
|
<img src="https://img.shields.io/badge/tests-passing-success.svg" alt="Tests" />
|
|
7
7
|
<a href="https://sunwenzhe-git.github.io/atlas/"><img src="https://img.shields.io/badge/docs-VitePress-green.svg" alt="Docs" /></a>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/apply/reference.md
CHANGED
|
@@ -243,6 +243,7 @@ apply 只对**本次受影响集合**落笔,**不整文件覆盖**任何项目
|
|
|
243
243
|
- 步骤 `#### 1.6 项目级资产更新(atlas apply)` `[required · once]`(沿用 `X.Y` 编号,`get_step` 可解析;**不重命名** `## Phase 1: Plan` 边界标题);
|
|
244
244
|
- `[workflow-state:planning]` 与 `[workflow-state:planning-inline]` 面包屑块各加一条 **enforcement 行**,使其**每轮自动提醒**(`DESIGN.md` §8.2)。
|
|
245
245
|
- 两者由 `patches/workflow-plan-apply/` 的锚点**版本化**补丁落下(§9)。
|
|
246
|
+
- **E2E 触发段(2026-11-03,`RFC-20261103-07`)**:Phase 2 实现完成后,由 `patches/workflow-e2e-trigger/` 落下的步骤在**最后一轮**质量检查之前执行 `scripts/e2e_trigger.py`(归因 + 委托既有执行器;**不生成脚本、不替代真跑门**,详见 `rings/e2e/reference.md` §10.2);收尾只给控制台命令,人工 review 不代劳。
|
|
246
247
|
- **不新增 Trellis 状态**(B3):只用 `planning` / `in_progress` / `completed` 三态;不改状态机、不改 hook 解析逻辑、不使用 `set-status`。
|
|
247
248
|
- **失败 / 部分完成回报**:
|
|
248
249
|
- 任一参与环失败、或影响面无法确定且用户未答 → **停在 planning**,输出结构化报告(§8 格式),**不得进入实现**;
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# workflow-e2e-trigger — E2E 触发段挂载补丁
|
|
2
|
+
|
|
3
|
+
把「实现完成 → 用例执行 → 人 review」的触发点挂进 Trellis 的 `.trellis/workflow.md`
|
|
4
|
+
(`RFC-20261103-07`)。**只挂触发点,不新增门。**
|
|
5
|
+
|
|
6
|
+
## 落地内容
|
|
7
|
+
|
|
8
|
+
| 补丁 id | 落点 | 作用 |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| `e2e-trigger-before-final-pass` | `**Final pass (before Phase 3.4 commit)**` 之前 | 最后一轮质量检查之前执行 `e2e_trigger.py --run`(归因 + 委托既有执行器) |
|
|
11
|
+
| `e2e-console-at-3-5` | `#### 3.5 Wrap-up reminder` 之后 | 收尾给出控制台命令(人工 review),不自动启动 |
|
|
12
|
+
| `e2e-breadcrumb-in-progress` | `[/workflow-state:in_progress]` 之前 | 执行期每轮提醒触发段 |
|
|
13
|
+
| `e2e-breadcrumb-in-progress-inline` | `[/workflow-state:in_progress-inline]` 之前 | inline 变体同样提醒 |
|
|
14
|
+
|
|
15
|
+
## 边界
|
|
16
|
+
|
|
17
|
+
- 触发器**不**调用 `gen_e2e_scripts.py --apply`:生成前必须有 E2E 环独立审查报告(`rings/e2e/reference.md` §12)。
|
|
18
|
+
- 未就绪(靶场未声明 / 脚本未生成 / 不可达 / 未接入)只打印待办并 `exit 0`,**不阻塞**收尾。
|
|
19
|
+
- 真跑仍由 `atlas_check` / `atlas_verify` 判定;控制台仍由人启动。
|
|
20
|
+
|
|
21
|
+
## 应用与幂等
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python3 patches/workflow-e2e-trigger/apply-patches.py --target <项目根> --apply
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
块形态与判据同 `patches/workflow-plan-apply/`:带正文指纹的开始/结束标记;正文一致 ⇒ `skipped`,
|
|
28
|
+
不一致 ⇒ 整块替换;旧式块 ⇒ 升级。Trellis 升级后重跑安装即对齐。
|
|
29
|
+
|
|
30
|
+
**锚点漂移**:`**Final pass (before Phase 3.4 commit)**` 与 `#### 3.5 Wrap-up reminder` 来自 Trellis 模板;
|
|
31
|
+
miss 时安装器只 `WARN`,此时两个面包屑补丁仍提供常驻提醒,需人工核对后更新 `spec.json` 的锚点。
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""atlas E2E 触发段 —— Trellis workflow.md 挂载补丁的锚点式**版本化**应用器。
|
|
3
|
+
|
|
4
|
+
用法:
|
|
5
|
+
python3 apply-patches.py --target <项目根> [--spec <spec.json>] [--apply] [--json]
|
|
6
|
+
|
|
7
|
+
设计要点
|
|
8
|
+
* 只做**外科式插入 / 整块替换**,不整体覆盖 `<项目根>/.trellis/workflow.md`——
|
|
9
|
+
因此与其它对 workflow.md 的改动互不覆盖。
|
|
10
|
+
* **版本化块**(2026-09-27,`3509 §B93`):
|
|
11
|
+
<!-- atlas:apply:<id>@<sha256前8位> -->
|
|
12
|
+
<片段正文>
|
|
13
|
+
<!-- /atlas:apply:<id> -->
|
|
14
|
+
判据于是不再是「标记在不在」,而是「**块里的正文是否仍等于当前片段**」:
|
|
15
|
+
- 指纹相同 ⇒ `skipped`
|
|
16
|
+
- 指纹不同(片段更新过)⇒ **整块替换**为当前片段(`replaced`)
|
|
17
|
+
- 旧式块(只有 `<!-- atlas:apply:<id> -->`、无指纹无结束标记)⇒ `upgraded`(仅补格式)
|
|
18
|
+
或 `replaced`(正文与当前片段不符)
|
|
19
|
+
* **旧式块的安全迁移**:`insert_before*` 的块紧邻锚点 ⇒ 边界 = 重算的锚点位置(精确);
|
|
20
|
+
`insert_after*` 且正文不符 ⇒ **拒绝并报 error**(不做「删到下一个小节」这种会误伤内容的猜测)。
|
|
21
|
+
* 锚点缺失 / 歧义 / 替换未改变字节 → 报 error 且**不修改该文件**。
|
|
22
|
+
* 缺省 dry-run(安全默认);真正写入需显式 `--apply`。
|
|
23
|
+
* 模式:
|
|
24
|
+
- insert_before / insert_after —— 锚点为**单行唯一子串**
|
|
25
|
+
- insert_before_regex / insert_after_regex —— 锚点为**唯一正则**(re.MULTILINE)
|
|
26
|
+
插入内容来自补丁的 `snippet`(相对本目录的文件)。
|
|
27
|
+
* 护栏:`.json` 目标写入前必须能 `json.loads`;`.py` 目标必须能 `compile`。
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from __future__ import annotations
|
|
31
|
+
|
|
32
|
+
import argparse
|
|
33
|
+
import hashlib
|
|
34
|
+
import json
|
|
35
|
+
import re
|
|
36
|
+
import sys
|
|
37
|
+
from pathlib import Path
|
|
38
|
+
|
|
39
|
+
PKG_ROOT = Path(__file__).resolve().parent
|
|
40
|
+
DEFAULT_SPEC = PKG_ROOT / "spec.json"
|
|
41
|
+
|
|
42
|
+
LINE_MODES = ("insert_before", "insert_after")
|
|
43
|
+
REGEX_MODES = ("insert_before_regex", "insert_after_regex")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def marker_re(pid: str) -> re.Pattern[str]:
|
|
47
|
+
"""带可选正文指纹的块标记。"""
|
|
48
|
+
return re.compile(rf"<!--\s*atlas:apply:{re.escape(pid)}(?:@(?P<fp>[0-9a-f]{{8}}))?\s*-->")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def end_marker(pid: str) -> str:
|
|
52
|
+
return f"<!-- /atlas:apply:{pid} -->"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def fingerprint(snippet: str) -> str:
|
|
56
|
+
return hashlib.sha256(snippet.rstrip("\n").encode("utf-8")).hexdigest()[:8]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def build_block(pid: str, snippet: str) -> str:
|
|
60
|
+
"""标记(带指纹)+ 片段正文 + 结束标记。结束标记由本应用器统一追加,
|
|
61
|
+
片段文件保持纯正文。"""
|
|
62
|
+
return (
|
|
63
|
+
f"<!-- atlas:apply:{pid}@{fingerprint(snippet)} -->\n"
|
|
64
|
+
+ snippet.rstrip("\n")
|
|
65
|
+
+ "\n"
|
|
66
|
+
+ end_marker(pid)
|
|
67
|
+
+ "\n"
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def locate(text: str, mode: str, patch: dict) -> tuple[int | None, str | None]:
|
|
72
|
+
"""返回插入位置;锚点缺失或歧义时返回 (None, 原因)。"""
|
|
73
|
+
if mode in LINE_MODES:
|
|
74
|
+
needle = patch["anchor"]
|
|
75
|
+
lines = text.splitlines(keepends=True)
|
|
76
|
+
hits = [i for i, ln in enumerate(lines) if needle in ln]
|
|
77
|
+
if not hits:
|
|
78
|
+
return None, "anchor not found"
|
|
79
|
+
if len(hits) > 1:
|
|
80
|
+
return None, f"anchor ambiguous ({len(hits)} matches)"
|
|
81
|
+
i = hits[0]
|
|
82
|
+
if mode == "insert_before":
|
|
83
|
+
pos = sum(len(ln) for ln in lines[:i])
|
|
84
|
+
else:
|
|
85
|
+
pos = sum(len(ln) for ln in lines[: i + 1])
|
|
86
|
+
return pos, None
|
|
87
|
+
|
|
88
|
+
pattern = patch["pattern"]
|
|
89
|
+
matches = list(re.compile(pattern, re.MULTILINE).finditer(text))
|
|
90
|
+
if not matches:
|
|
91
|
+
return None, "pattern not found"
|
|
92
|
+
if len(matches) > 1:
|
|
93
|
+
return None, f"pattern ambiguous ({len(matches)} matches)"
|
|
94
|
+
m = matches[0]
|
|
95
|
+
return (m.start() if mode == "insert_before_regex" else m.end()), None
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def block_end(
|
|
99
|
+
text: str, m: re.Match[str], pid: str, patch: dict, snippet: str
|
|
100
|
+
) -> tuple[int | None, str | None]:
|
|
101
|
+
"""给定已存在的块标记,返回 (块结束位置, 说明)。
|
|
102
|
+
|
|
103
|
+
「块」= 从标记起到本补丁正文结束(含结束标记与紧随的一个换行)。
|
|
104
|
+
"""
|
|
105
|
+
e = text.find(end_marker(pid), m.end())
|
|
106
|
+
if e >= 0:
|
|
107
|
+
j = e + len(end_marker(pid))
|
|
108
|
+
return (j + 1 if text[j : j + 1] == "\n" else j), "end-marker"
|
|
109
|
+
|
|
110
|
+
body = snippet.rstrip("\n")
|
|
111
|
+
off = m.end()
|
|
112
|
+
if text[off : off + 1] == "\n":
|
|
113
|
+
off += 1
|
|
114
|
+
if text.startswith(body, off):
|
|
115
|
+
j = off + len(body)
|
|
116
|
+
return (j + 1 if text[j : j + 1] == "\n" else j), "snippet"
|
|
117
|
+
|
|
118
|
+
if patch["mode"].startswith("insert_before"):
|
|
119
|
+
pos, err = locate(text, patch["mode"], patch)
|
|
120
|
+
if err or pos is None:
|
|
121
|
+
return None, f"legacy block: {err}"
|
|
122
|
+
return pos, "anchor"
|
|
123
|
+
|
|
124
|
+
return None, "legacy block without end marker on insert_after(需人工处理)"
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def guard(path: Path, new_text: str) -> str | None:
|
|
128
|
+
if path.suffix == ".json":
|
|
129
|
+
try:
|
|
130
|
+
json.loads(new_text)
|
|
131
|
+
except json.JSONDecodeError as exc:
|
|
132
|
+
return f"JSON 护栏拦截:{exc}"
|
|
133
|
+
if path.suffix == ".py":
|
|
134
|
+
try:
|
|
135
|
+
compile(new_text, str(path), "exec")
|
|
136
|
+
except SyntaxError as exc:
|
|
137
|
+
return f"语法护栏拦截:{exc}"
|
|
138
|
+
return None
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def main() -> int:
|
|
142
|
+
ap = argparse.ArgumentParser()
|
|
143
|
+
ap.add_argument("--target", default=str(Path.cwd()), help="项目根目录(缺省 = 当前目录)")
|
|
144
|
+
ap.add_argument("--spec", default=str(DEFAULT_SPEC))
|
|
145
|
+
ap.add_argument("--apply", action="store_true", help="真正写入;缺省为 dry-run(安全默认)")
|
|
146
|
+
ap.add_argument("--dry-run", action="store_true", help="显式 dry-run(与缺省等价)")
|
|
147
|
+
ap.add_argument("--json", action="store_true")
|
|
148
|
+
args = ap.parse_args()
|
|
149
|
+
|
|
150
|
+
write = bool(args.apply) and not bool(args.dry_run)
|
|
151
|
+
target = Path(args.target).resolve()
|
|
152
|
+
spec = json.loads(Path(args.spec).read_text(encoding="utf-8"))
|
|
153
|
+
prefix = spec.get("target_prefix", "")
|
|
154
|
+
|
|
155
|
+
results: list[dict] = []
|
|
156
|
+
errors = 0
|
|
157
|
+
|
|
158
|
+
for patch in spec["patches"]:
|
|
159
|
+
pid = patch["id"]
|
|
160
|
+
mode = patch["mode"]
|
|
161
|
+
rel = prefix + patch["file"]
|
|
162
|
+
path = target / rel
|
|
163
|
+
entry = {"id": pid, "issue": patch.get("issue", ""), "file": rel}
|
|
164
|
+
|
|
165
|
+
if not path.exists():
|
|
166
|
+
entry.update(status="error", detail="target file not found")
|
|
167
|
+
errors += 1
|
|
168
|
+
results.append(entry)
|
|
169
|
+
continue
|
|
170
|
+
|
|
171
|
+
if mode not in LINE_MODES and mode not in REGEX_MODES:
|
|
172
|
+
entry.update(status="error", detail=f"unknown mode {mode}")
|
|
173
|
+
errors += 1
|
|
174
|
+
results.append(entry)
|
|
175
|
+
continue
|
|
176
|
+
|
|
177
|
+
snippet_path = PKG_ROOT / patch["snippet"]
|
|
178
|
+
if not snippet_path.is_file():
|
|
179
|
+
entry.update(status="error", detail=f"snippet not found: {patch['snippet']}")
|
|
180
|
+
errors += 1
|
|
181
|
+
results.append(entry)
|
|
182
|
+
continue
|
|
183
|
+
snippet = snippet_path.read_text(encoding="utf-8")
|
|
184
|
+
fp = fingerprint(snippet)
|
|
185
|
+
block = build_block(pid, snippet)
|
|
186
|
+
|
|
187
|
+
text = path.read_text(encoding="utf-8")
|
|
188
|
+
m = marker_re(pid).search(text)
|
|
189
|
+
|
|
190
|
+
if m:
|
|
191
|
+
old_fp = m.group("fp")
|
|
192
|
+
end, how = block_end(text, m, pid, patch, snippet)
|
|
193
|
+
if end is None:
|
|
194
|
+
entry.update(status="error", detail=how or "block end not found")
|
|
195
|
+
errors += 1
|
|
196
|
+
results.append(entry)
|
|
197
|
+
continue
|
|
198
|
+
if old_fp == fp and how == "end-marker":
|
|
199
|
+
entry.update(status="skipped", detail="already applied(正文版本一致)")
|
|
200
|
+
results.append(entry)
|
|
201
|
+
continue
|
|
202
|
+
if old_fp == fp:
|
|
203
|
+
status, detail = "upgraded", "正文一致,仅补指纹与结束标记"
|
|
204
|
+
elif old_fp:
|
|
205
|
+
status, detail = "replaced", f"正文版本 {old_fp} → {fp}"
|
|
206
|
+
else:
|
|
207
|
+
status = "upgraded" if how in ("snippet", "end-marker") else "replaced"
|
|
208
|
+
detail = "旧式块:补指纹与结束标记" if how in ("snippet", "end-marker") else "旧式块:正文不符,整块替换"
|
|
209
|
+
new_text = text[: m.start()] + block + text[end:]
|
|
210
|
+
if new_text == text:
|
|
211
|
+
entry.update(status="error", detail="replacement produced no change(替换未改变字节)")
|
|
212
|
+
errors += 1
|
|
213
|
+
results.append(entry)
|
|
214
|
+
continue
|
|
215
|
+
else:
|
|
216
|
+
pos, err = locate(text, mode, patch)
|
|
217
|
+
if err:
|
|
218
|
+
entry.update(status="error", detail=err)
|
|
219
|
+
errors += 1
|
|
220
|
+
results.append(entry)
|
|
221
|
+
continue
|
|
222
|
+
new_text = text[:pos] + block + text[pos:]
|
|
223
|
+
if len(new_text) <= len(text):
|
|
224
|
+
entry.update(status="error", detail="insertion produced no growth(锚点定位异常)")
|
|
225
|
+
errors += 1
|
|
226
|
+
results.append(entry)
|
|
227
|
+
continue
|
|
228
|
+
status, detail = "applied", f"+{len(new_text) - len(text)} 字节"
|
|
229
|
+
|
|
230
|
+
bad = guard(path, new_text)
|
|
231
|
+
if bad:
|
|
232
|
+
entry.update(status="error", detail=bad)
|
|
233
|
+
errors += 1
|
|
234
|
+
results.append(entry)
|
|
235
|
+
continue
|
|
236
|
+
|
|
237
|
+
entry.update(status=status, detail=detail)
|
|
238
|
+
if write:
|
|
239
|
+
path.write_text(new_text, encoding="utf-8")
|
|
240
|
+
results.append(entry)
|
|
241
|
+
|
|
242
|
+
counts = {k: sum(1 for r in results if r["status"] == k)
|
|
243
|
+
for k in ("applied", "replaced", "upgraded", "skipped")}
|
|
244
|
+
|
|
245
|
+
if args.json:
|
|
246
|
+
print(json.dumps({"target": str(target), "dry_run": not write, **counts,
|
|
247
|
+
"errors": errors, "results": results}, ensure_ascii=False, indent=2))
|
|
248
|
+
else:
|
|
249
|
+
icons = {"applied": "✓", "replaced": "↻", "upgraded": "↑", "skipped": "=", "error": "✗"}
|
|
250
|
+
print(f"▶ 目标项目 : {target}")
|
|
251
|
+
print(f"▶ 模式 : {'apply' if write else 'dry-run'}")
|
|
252
|
+
for r in results:
|
|
253
|
+
print(f" {icons.get(r['status'], '?')} [{r['issue']}] {r['id']} — {r['detail']}")
|
|
254
|
+
print("合计:applied={applied} replaced={replaced} upgraded={upgraded} "
|
|
255
|
+
"skipped={skipped} errors={errors}".format(**counts, errors=errors))
|
|
256
|
+
if not write:
|
|
257
|
+
print("(dry-run:未写入任何文件;如需写入请加 --apply)")
|
|
258
|
+
|
|
259
|
+
return 1 if errors else 0
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
if __name__ == "__main__":
|
|
263
|
+
sys.exit(main())
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
E2E 触发:Phase 2 实现与静态检查通过后,在**最后一轮**质量检查之前执行 `python3 .atlas/scripts/e2e_trigger.py --root . --run`(未就绪只归因、不阻塞;不绕过 E2E 环独立审查门)。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
E2E 触发:Phase 2 实现与静态检查通过后,在**最后一轮**质量检查之前执行 `python3 .atlas/scripts/e2e_trigger.py --root . --run`(未就绪只归因、不阻塞;不绕过 E2E 环独立审查门)。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
**E2E 人工 review(收尾提醒)**:把控制台命令交给用户——`python3 .atlas/scripts/e2e_console.py --root .`。逐条执行与勾选由人完成;机器侧 `green` 不等于域收口(域收口另需用户按域级 PRD 功能清单走查确认,`rings/e2e/reference.md` §5.4)。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
**E2E 触发段(实现完成即执行,平台无关注)**:Phase 2 实现完成、静态检查通过后,在**最后一轮**质量检查(`**Final pass (before Phase 3.4 commit)**`)**之前**执行 `python3 .atlas/scripts/e2e_trigger.py --root . --run`。它只做就绪归因并委托既有执行器(`atlas_verify.py`):未就绪时打印缺哪一项并退出 0(**不阻塞**提交);已就绪时按 `--run` 真跑。**不得**由它调用生成器的 `--apply`(生成前必须有 E2E 环独立审查报告,`rings/e2e/reference.md` §12),也**不**替你启动控制台。只在确认这是最后一轮质量检查时触发;迭代中途不跑。
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0",
|
|
3
|
+
"description": "把 E2E 触发段挂进 Trellis workflow.md(通用包):Phase 2 **最后一轮**质量检查之前执行 `e2e_trigger.py`(只归因 + 委托既有执行器;不生成脚本、不绕过 E2E 环独立审查门),3.5 收尾处给出控制台命令(人工 review),[workflow-state:in_progress] 两个面包屑变体各加一行提醒。块形态与判据同 workflow-plan-apply(锚点式版本化:指纹相同⇒skipped,不同⇒整块替换,旧式块⇒升级/替换)。",
|
|
4
|
+
"target_prefix": "",
|
|
5
|
+
"patches": [
|
|
6
|
+
{
|
|
7
|
+
"id": "e2e-trigger-before-final-pass",
|
|
8
|
+
"issue": "RFC-20261103-07",
|
|
9
|
+
"file": ".trellis/workflow.md",
|
|
10
|
+
"mode": "insert_before",
|
|
11
|
+
"anchor": "**Final pass (before Phase 3.4 commit)**",
|
|
12
|
+
"snippet": "e2e-trigger-before-final-pass.insert.md",
|
|
13
|
+
"note": "Phase 2 末、最后一轮质量检查之前执行 E2E 触发段。锚点为模板英文行、全文件唯一;miss 时安装器只 WARN,故补丁另有 [workflow-state:in_progress] 面包屑作为常驻提醒。"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "e2e-console-at-3-5",
|
|
17
|
+
"issue": "RFC-20261103-07",
|
|
18
|
+
"file": ".trellis/workflow.md",
|
|
19
|
+
"mode": "insert_after",
|
|
20
|
+
"anchor": "#### 3.5 Wrap-up reminder",
|
|
21
|
+
"snippet": "e2e-console-at-3-5.insert.md",
|
|
22
|
+
"note": "收尾处给出控制台命令(人工 review),不自动启动。锚点全文件唯一。"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "e2e-breadcrumb-in-progress",
|
|
26
|
+
"issue": "RFC-20261103-07",
|
|
27
|
+
"file": ".trellis/workflow.md",
|
|
28
|
+
"mode": "insert_before",
|
|
29
|
+
"anchor": "[/workflow-state:in_progress]",
|
|
30
|
+
"snippet": "breadcrumb-in-progress.insert.md",
|
|
31
|
+
"note": "执行期每轮提醒 E2E 触发段(子代理平台口径)。锚点全文件唯一,且不是 [/workflow-state:in_progress-inline] 的子串。"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "e2e-breadcrumb-in-progress-inline",
|
|
35
|
+
"issue": "RFC-20261103-07",
|
|
36
|
+
"file": ".trellis/workflow.md",
|
|
37
|
+
"mode": "insert_before",
|
|
38
|
+
"anchor": "[/workflow-state:in_progress-inline]",
|
|
39
|
+
"snippet": "breadcrumb-in-progress-inline.insert.md",
|
|
40
|
+
"note": "Codex inline 变体同样加提醒(主会话自加载口径)。"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
package/rings/e2e/reference.md
CHANGED
|
@@ -695,6 +695,27 @@ testid:
|
|
|
695
695
|
|
|
696
696
|
---
|
|
697
697
|
|
|
698
|
+
## 10.2 E2E 触发段与就绪归因(2026-11-03,`RFC-20261103-07`)
|
|
699
|
+
|
|
700
|
+
**触发段**:`scripts/e2e_trigger.py`,由 `patches/workflow-e2e-trigger/` 挂进 Trellis 工作流的 **Phase 2 最后一轮质量检查之前**;收尾(3.5)只给控制台命令。
|
|
701
|
+
|
|
702
|
+
- 它**只归因 + 委托**:就绪时调用既有执行器(`atlas_verify.py`;`--page` 时退到 `atlas_check --page`),**不**调用生成器 `--apply`(生成前必须有 §12 独立审查报告),**不**启动控制台;未就绪只打印待办并 `exit 0`,不阻塞收尾。
|
|
703
|
+
- 触发点只在**最后一轮** 2.2(2.2 是 `[required · repeatable]`,迭代中途不跑)。
|
|
704
|
+
|
|
705
|
+
**就绪归因**:`atlas_check --json` 的 E2E 行新增机读字段 `skip_reason`(人读 `detail` 与 `SKIP` 判定不变)。枚举与判据:
|
|
706
|
+
|
|
707
|
+
| `skip_reason` | 判据 | 归属 |
|
|
708
|
+
|---|---|---|
|
|
709
|
+
| `gate_off` | 无分片且无脚本目录 | 设计结论(本环未接入) |
|
|
710
|
+
| `not_declared` | `e2e.app_base_url` 为空 | 缺决策 |
|
|
711
|
+
| `not_generated` | 已有分片,页面脚本不存在 | 缺工作 |
|
|
712
|
+
| `app_login_undeclared` | 靶场已声明、`app_login` 段未声明(人工会话可兜底,不单独构成跳过) | 缺决策 |
|
|
713
|
+
| `env_not_ready` | `app_base_url` 不可达 | 环境 |
|
|
714
|
+
|
|
715
|
+
优先级按「先看是否接入,再看缺什么」:`gate_off → not_declared → not_generated → app_login_undeclared → env_not_ready`;不得按早退分支顺序推断(同一分支在不同资产状态下可对应不同归因)。
|
|
716
|
+
|
|
717
|
+
---
|
|
718
|
+
|
|
698
719
|
## 11. 报告格式
|
|
699
720
|
|
|
700
721
|
1. **范围**:本次涉及页面与 AC 数。
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|