atlas-project-harness 0.3.0-beta.5 → 0.3.0-beta.6
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 +10 -0
- package/DESIGN.md +3 -2
- package/README.md +1 -1
- package/_support/__pycache__/ac_coverage.cpython-312.pyc +0 -0
- package/_support/__pycache__/ac_crosswalk.cpython-312.pyc +0 -0
- package/_support/__pycache__/auth_state.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__/evidence_archive.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__/run_workspace.cpython-312.pyc +0 -0
- package/_support/__pycache__/semver.cpython-312.pyc +0 -0
- package/_support/__pycache__/siblings.cpython-312.pyc +0 -0
- package/_support/__pycache__/solution.cpython-312.pyc +0 -0
- package/_support/__pycache__/solution_e2e.cpython-312.pyc +0 -0
- package/_support/__pycache__/solution_seal.cpython-312.pyc +0 -0
- package/_support/__pycache__/solution_seal_ops.cpython-312.pyc +0 -0
- package/_support/__pycache__/solution_task.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/_support/solution.py +1 -1
- 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/_graph.py +206 -271
- 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/adapters/routes.py +5 -9
- package/apply/reference.md +7 -8
- package/package.json +1 -1
- package/patches/project-wiring/__pycache__/apply-wiring.cpython-312.pyc +0 -0
- package/rings/structure/reference.md +4 -3
- 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_solution.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__/changelog_guard.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__/gen_e2e_scripts.cpython-312.pyc +0 -0
- package/scripts/__pycache__/gen_fixture_schemas.cpython-312.pyc +0 -0
- package/scripts/__pycache__/gen_testid_stub.cpython-312.pyc +0 -0
- package/scripts/__pycache__/ledger_snapshot.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__/preflight.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/impact_report.py +19 -21
- package/shared/stack-profile.md +4 -14
- 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_apply_record.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_task_card.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/validators/validate_stack_profile.py +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [v0.3.0-beta.6] - 2026-11-19
|
|
8
|
+
|
|
9
|
+
### ⚡️ 架构减负与执行层演进:退役外部 AST 图谱,确立轻量语义透镜 (D202)
|
|
10
|
+
|
|
11
|
+
* 彻底退役基于 cgc / FalkorDB 的外部代码图谱隔离层,清理沉重外部图数据库容器依赖与死代码;
|
|
12
|
+
* 确立业务域内(`structure/current/<domain>/cognition.fras`)与全局跨切面(`structure/global/cognition.fras`)两级轻量语义透镜,为 Atlas 自建执行层提供穿透调用的拓扑 (R) 与防改崩硬约束 (S);
|
|
13
|
+
* `impact_report.py` 支持单跳反向依赖提取进独立 `aoci_candidates` 字段,无语义索引时诚实返回 `status: not_ready` 且预测集退化为任务卡声明集;
|
|
14
|
+
* `validate_stack_profile.py` 对存量声明了 `graph` 段的项目输出显式退役 `WARN` 提示(不静默吞掉);
|
|
15
|
+
* 全套测试链、地图锚点保活门及装配四表面对齐。
|
|
16
|
+
|
|
7
17
|
## [v0.3.0-beta.5] - 2026-11-19
|
|
8
18
|
|
|
9
19
|
### 🛡 Pi 宿主扩展:turn_end 门禁告警按失败签名去重
|
package/DESIGN.md
CHANGED
|
@@ -539,11 +539,11 @@ adapters:
|
|
|
539
539
|
| D74 | 定位表述定稿:身份 ≠ 实现分工(2026-09-29,`3508 §129` 设计树 A–F) | **身份** = atlas 是覆盖「立项 → 需求 → 应然资产 → 实现 → 验收 → 收口」的**全流程 vibecoding 工作流**,项目级应然资产跨项目分发、机器可校验;**实现分工** = 「需求级执行」由执行器承担(**当前 = Trellis**,依附其官方可改面,不改状态机与 hook 解析),执行器可替换是未来可能而非现行契约。改面:`README.md` 开场 + §定位(删「分层正交」作身份表述——它降为产物分层的实施细节,归 `DESIGN.md` §3/§8);`patches/project-wiring/agent-pointer.md` 标题与首行同步(重装配后注入各业务仓库 AGENTS.md)。被否:把「atlas = 项目级资产层」当身份(一次分工决策 D72 静默改写身份,实证 `3508 §129`);「执行器 adapter」先行(无实跑取证) |
|
|
540
540
|
| ~~D75~~ | **【已退役 2026-10-14】** 知识库双通道 + KB 投影对账门(2026-09-29,`3509 §B116`/`§B121` 拍板「按推荐走」) | **双通道**:短 note 经 MCP(store/get),**长 note 定点/批量修订直接编辑文件** + 收口跑 `kb_index_refresh.mjs` + `kb_projection_check.mjs` 对账(`shared/knowledge.md` §3 重写;原「不手写 vault 文件」与历轮实践矛盾,且 open-zk-kb 无文件监听 ⇒ 手改不重索引会静默漂)。**对账门**:`atlas/scripts/kb_projection_check.mjs` 用包内解析器逐篇逐字段比对投影(`.index/knowledge.db`)⇔ vault 本体,四类漂移指名,入 `gates.md` 2.1(测试 + 三类变异咬合);`atlas_check` 对校验器 WARN 行从静默当 ok 改为显式 `WARN` 行。配套:`embeddings:{enabled:false}` 落 `~/.config/open-zk-kb/config.yaml`(本机不可达 HF CDN,local 兜底使 rebuild/embed 每次白试下载 = MCP 超时根因)。被否:坚持 MCP 单一通道(唯一可行通道就是直接编辑,实证 `§B116` 硬证据);拆短 note 方案(丢历史、覆盖风险) |
|
|
541
541
|
|
|
542
|
-
| D77 | 图谱后端隔离层的边界与落点(2026-10-15 收口,用户实测回报驱动) | ① **消费面就两处**:`routes` 的文件枚举通道(派生逻辑与 regex 同一份)与 `apply` 影响面基准(`impact_report.py`)——**不做**域聚类(域归 `rings/structure/reference.md` §2.1 多信号投票)、**不替**任何适配器的解析层;② **落点 = 项目根 `.adapter-out/`**——**与适配器产物、漂移标记同址**(2026-10-15 统一,issue #8:该目录是 atlas 全部中间产物的单一位点,设计档案目录树原本即如此;此前实现漂成同名两处 ⇒ 现场「`git status` 有 `.adapter-out/` 而漂移门说『无产物目录』」);**后端自己的索引库不得落进项目工作树**(否则新鲜度键自激成永不稳定的全量重建);启用图谱的项目应 gitignore 该目录;③ **枚举范围纪律**:图谱通道的文件清单必须过与 regex 同一份 `IGNORE_DIRS` 剪枝(`cgc index` 无 exclude 旗标,否则依赖目录进池产假事实);④ **启用方式**:出厂注释态 + 确认画像时探测并**提议**(不自动声明——画像不该替用户承诺环境依赖能力,且图谱有持续成本);⑤ 非 git 工作树 ⇒ WARN + 每次全量重建(不硬崩);`ensure_index` **单进程假设**。缘起:README 原称图谱供给结构抽取「跨文件端点到模型映射 / 级联依赖自动归域」,实装无此事 ⇒ 文档按实情收窄,同时把上面五条纪律定形。被否:把图谱能力做上去(当前 name 级调用图抓不到 ORM / 属性访问边,做跨文件映射会往 canonical 事实表灌批量假事实);自动声明(持续成本 + 承诺环境依赖)。详见 `docs/innovations/code-graph.md` |
|
|
542
|
+
| ~~D77~~ | **【已由 D202 超越,2026-11-19】** 图谱后端隔离层的边界与落点(2026-10-15 收口,用户实测回报驱动) | ① **消费面就两处**:`routes` 的文件枚举通道(派生逻辑与 regex 同一份)与 `apply` 影响面基准(`impact_report.py`)——**不做**域聚类(域归 `rings/structure/reference.md` §2.1 多信号投票)、**不替**任何适配器的解析层;② **落点 = 项目根 `.adapter-out/`**——**与适配器产物、漂移标记同址**(2026-10-15 统一,issue #8:该目录是 atlas 全部中间产物的单一位点,设计档案目录树原本即如此;此前实现漂成同名两处 ⇒ 现场「`git status` 有 `.adapter-out/` 而漂移门说『无产物目录』」);**后端自己的索引库不得落进项目工作树**(否则新鲜度键自激成永不稳定的全量重建);启用图谱的项目应 gitignore 该目录;③ **枚举范围纪律**:图谱通道的文件清单必须过与 regex 同一份 `IGNORE_DIRS` 剪枝(`cgc index` 无 exclude 旗标,否则依赖目录进池产假事实);④ **启用方式**:出厂注释态 + 确认画像时探测并**提议**(不自动声明——画像不该替用户承诺环境依赖能力,且图谱有持续成本);⑤ 非 git 工作树 ⇒ WARN + 每次全量重建(不硬崩);`ensure_index` **单进程假设**。缘起:README 原称图谱供给结构抽取「跨文件端点到模型映射 / 级联依赖自动归域」,实装无此事 ⇒ 文档按实情收窄,同时把上面五条纪律定形。被否:把图谱能力做上去(当前 name 级调用图抓不到 ORM / 属性访问边,做跨文件映射会往 canonical 事实表灌批量假事实);自动声明(持续成本 + 承诺环境依赖)。详见 `docs/innovations/code-graph.md` |
|
|
543
543
|
|
|
544
544
|
| D79 | 门册五件遗留态收口——真跑裁决记录归一 / AC 升档规则落档 / D77 否决面词汇钉 / impact 观察窗 / 装配生效面文案(2026-10-15,评审修后采纳) | ① **真跑记录裁决**:以 gates 2.2「E2E 真跑」行的仓内记录(**逐页真跑 + 咬出真红,`3508 §166`/`§187`/`§190`**)为事实,纠正三处 2026-09-28 批残留的「真栈未跑/首次真栈执行未发生」措辞(gates 2.4 完成门 = 域收口事件、与真跑门独立;`DESIGN.md` §13 项、`rings/e2e` §16、上限声明);「暂不真跑」裁决(2026-09-28)标注为已被执行反推,双台账会话号(`3509 §111`/`3508 §111`)并列引用;取证上限改**逐格**:真跑级只给字面咬过的行、须附咬合证据,未覆盖行保持出厂级、不预填;首跑协议 = 1 app × 1 页最小切片,留档 `product/e2e/reviews/<日期>/`;E0 产物残留重生成绑真跑准备日。② **AC 反向覆盖升 FAIL 规则落档**:触发 = 零挂靠清零 + 清零态实测全绿一次 ⇔ WARN 分支改 FAIL(不设 profile 开关——灰度即「看起来在跑」面);升档日 source/copy 分叉按回灌批收口;校验器 WARN detail 的外仓 P9 死指针改为 gates 行锚。③ **D77 否决面词汇钉(canonical 判据⑦,治标)**:黑名单(`Leiden/拓扑聚类/自动归域/端点到模型/阻断全仓`)出现在活语境 ⇒ 红,豁免锚 = 行内 D77/D78(**局部自持,不得并入 `RETIRE_MARKS`**——共享会串门到 ①③⑤);扫面收窄到 git 跟踪源 md(`rglob` 不认 .gitignore,`.vitepress/dist` 编译产物会漂判据);**首跑咬合 4 处**(`docs/design/overview.md` 三处 + `prd-ring.md:124`——D78 ④ 收窄漏网,sweep 应按词 grep 不按清单改文件);`rings`、`apply`、`patches` 三目录不扫 = 显式盲区;closeout 新增宣称 sweep 触发行(改被否裁决 ⇒ 全仓 grep + 词表同批登记)。④ **impact 观察窗**:不加代码——台账 = `impact_reconcile` 已无条件落盘的 `impact-reconcile.json`;升 FAIL 触发 = 裁决日起**连续 3 单**漏报 0 且无**同文件**重复漏报;升档后 miss ⇒ FAIL、over 保持 WARN(分档防良性偏宽钉死收口);判据值全落 gates 行、不赖仓外 `3509 §B191-1` 数字。⑤ **装配版本门文案升级**:WARN detail 给齐两支路生效路径(npm 全局态 `atlas upgrade`+`atlas update` / 本地源仓 `install.sh`)+ `backflow.py` 三态明细通道;不做第二套文件级 diff(防腐);同批三处回写(`test_atlas_check` 断言钉 M68 / gates 2.2 行 / `pkg_digest.py` docstring)。被否:--record 追加台账(盘上已有按单产物,双视图=两处正文);版本门内重算 diff;AC 升档加灰度开关;判据⑦并入 `RETIRE_MARKS`;以「待复核」复述未真跑行。变异:M67(摘 `VETO_WORDS` 一个词 ⇒ 判据⑦喂坏输入用例红)/ M68(摘 WARN 文案动作词 ⇒ `test_atlas_check` 文案钉红);两枚还原逐字节一致。设计评审:tech-proposal-reviewer 子代理,五件全「修后采纳」,本行按其修正点落地 |
|
|
545
545
|
|
|
546
|
-
| D78 | 图谱收益实测改判 + 接线第 5 触点 + 跨产物声明一致门(2026-10-15,issue #2 复审驱动) | ① **前端栈实测改判**:cgc 0.6.13 前端形态夹具实测——JSX 组件引用不产生任何调用边(`CALLS` 与启发式调用边均不覆盖 `element: <Comp />`),且 atlas 消费层只认 `CALLS` 边(`_graph.callers` 写死边型,后端加渲染边也读不到)⇒ 图谱对纯 UI 栈的两条消费面近乎零收益(routes 通道与 regex **恒等**;impact 对组件叶面系统性失真),逻辑调用链不受影响 ⇒ **提议按栈门控**(`apps[]` 存在 `kind ∈ {backend, fullstack}` 才探测并提议;字面枚举,不复用 `FRONTEND_KINDS`——该词表把 fullstack 归前端面,语义相反),撤回一轮排定的「atlas_check 图谱探测提醒」(对目标栈无收益的能力不需要发现通道);② **接线第 5 触点**:`apply-wiring.py` 在目标项目**已有** `.gitignore` 时幂等追加一行 `.adapter-out/`(子串幂等、`!.adapter-out` 负模式不打架、无文件不首创;**无退役对称**——单向追加不改名撤回,gates 2.3 登记);③ **跨产物声明一致门**:`validate_structure` 判接线态 ⇔ 形态 / 缺口登记(`adapters.api` 已接线但 `categories.D` 锚定声明为指针 / 未取证、或 `adapter_gaps.api` ⇒ WARN;F38 锚定声明同族;落 validate_structure 而非 stack_profile 的理由 = 三态前置复用,结构环未跑 ⇒ 整器 SKIP);④ **文档收窄补漏**:03 收窄漏掉 `docs/design/structure-ring.md` 的「调用拓扑候选域聚类 / Leiden」宣称(与 D77 ① 直接冲突)及 `README` / `docs/concepts/rings.md` / `token-engineering` / `innovations` 开场的溢出措辞;`impact_report` 常驻「无调用方」提示句补 JSX 渲染引用。被否:为前端把渲染边能力在 atlas 侧补齐(D77 已否一次);用指令通道解决 `.gitignore`(issue #2 姊妹缺陷实证「口头提议」会漂——`rings/structure` §6 步 1 的提议条款在实际接入里从未生效过);判据落 validate_stack_profile(其前置只判 profile 存在,三态要自造,且跨产物读取归结构环平面对齐)。实测依据存档:cgc 0.6.13 /tmp 夹具复测数据见当时评审记录(callers 空集 + 边型普查 CALLS/CONTAINS/HEURISTIC_CALLS/IMPORTS/INHERITS)。 |
|
|
546
|
+
| ~~D78~~ | **【已由 D202 超越,2026-11-19】** 图谱收益实测改判 + 接线第 5 触点 + 跨产物声明一致门(2026-10-15,issue #2 复审驱动) | ① **前端栈实测改判**:cgc 0.6.13 前端形态夹具实测——JSX 组件引用不产生任何调用边(`CALLS` 与启发式调用边均不覆盖 `element: <Comp />`),且 atlas 消费层只认 `CALLS` 边(`_graph.callers` 写死边型,后端加渲染边也读不到)⇒ 图谱对纯 UI 栈的两条消费面近乎零收益(routes 通道与 regex **恒等**;impact 对组件叶面系统性失真),逻辑调用链不受影响 ⇒ **提议按栈门控**(`apps[]` 存在 `kind ∈ {backend, fullstack}` 才探测并提议;字面枚举,不复用 `FRONTEND_KINDS`——该词表把 fullstack 归前端面,语义相反),撤回一轮排定的「atlas_check 图谱探测提醒」(对目标栈无收益的能力不需要发现通道);② **接线第 5 触点**:`apply-wiring.py` 在目标项目**已有** `.gitignore` 时幂等追加一行 `.adapter-out/`(子串幂等、`!.adapter-out` 负模式不打架、无文件不首创;**无退役对称**——单向追加不改名撤回,gates 2.3 登记);③ **跨产物声明一致门**:`validate_structure` 判接线态 ⇔ 形态 / 缺口登记(`adapters.api` 已接线但 `categories.D` 锚定声明为指针 / 未取证、或 `adapter_gaps.api` ⇒ WARN;F38 锚定声明同族;落 validate_structure 而非 stack_profile 的理由 = 三态前置复用,结构环未跑 ⇒ 整器 SKIP);④ **文档收窄补漏**:03 收窄漏掉 `docs/design/structure-ring.md` 的「调用拓扑候选域聚类 / Leiden」宣称(与 D77 ① 直接冲突)及 `README` / `docs/concepts/rings.md` / `token-engineering` / `innovations` 开场的溢出措辞;`impact_report` 常驻「无调用方」提示句补 JSX 渲染引用。被否:为前端把渲染边能力在 atlas 侧补齐(D77 已否一次);用指令通道解决 `.gitignore`(issue #2 姊妹缺陷实证「口头提议」会漂——`rings/structure` §6 步 1 的提议条款在实际接入里从未生效过);判据落 validate_stack_profile(其前置只判 profile 存在,三态要自造,且跨产物读取归结构环平面对齐)。实测依据存档:cgc 0.6.13 /tmp 夹具复测数据见当时评审记录(callers 空集 + 边型普查 CALLS/CONTAINS/HEURISTIC_CALLS/IMPORTS/INHERITS)。 |
|
|
547
547
|
|
|
548
548
|
| D80 | 靶场登录预置:`app_login.mode` 三态声明 + 「段缺失」撤销合法降级(分两阶段升档)(2026-10-16,`RFC-20261015-02` / issue #11,评审修后采纳 + 用户拍板时间锚) | ① **字段落点**:`e2e.app_login.mode` 增 **`none`**(靶场无访问门,显式声明非降级)——家族先例 `e2e.mock.mode: off` / `e2e.review.mode: off`(「在 X 段里用 mode 值声明 X 通道不需要」);不新增顶层 `e2e.auth`(与用例级 `auth` 同词不同作用域易误读 + 「有没有门」与「有没有取证值」拆两处 = 两真相源);`none` ⇒ 段内五取证字段一律不得残留(含 `storage_key`——无门项目的存储键没有消费方;与 `fabricated` 的「收窄」相反 = 「全弃」,两条判据同构成镜像);**空段 = 未声明**。② **段缺失语义改判**:不再是「合法降级」——硬要求(§7.1 登录态硬)的输入不得靠「缺失即静默放行」吸收。**分两阶段**:第一阶段 `validate_stack_profile` WARN 指名(`app_base_url` 已声明 = 项目准备真跑而 `app_login` 未声明;**文案必须中性**——本器判不了靶场有没有门,不得断言「每次都需人工登录」);**升档 = 下一次真跑准备日(时间锚,无条件)**把未声明推给生成器 `not_ready`(退出码 3 + 机读键 `not_ready: "app_login"`,与 `app_base_url` 同一通道;SKIP 原因两态扩三态)——**第 1 次咬合(升档依据)= 2026-10-15 现场**(pass1→pass5 会话失效 + 人工登录,issue #11 取证),登记 `gates.md` 2.2「E2E 真跑」行(D79 ④ 判据值全落 gates 纪律)。被否:只加 WARN 不改语义(F37 同族「只会通过的门」);顶层 `e2e.auth`;`app_login` 必填段——**诚实化**:② 的第二阶段效果(无门项目也须写 `{mode: none}`)与「必填段 + none 豁免」在结果上等价,真正的落点理由 = 撞名 + 单一真相源,不是「必填档做不到」;立即 FAIL(`未就绪 ≠ 失败`,永久红门 = 背景噪声);用例侧信号精确收紧(备选 E——用例级 `auth` 缺省 `preset`,会把没逐条标 `auth: none` 的无门项目一并误挡,判据塌缩成全网收紧)。③ **产出方**:adopt 开户问数「靶场接入取证」(`app_base_url` + 登录形态三选一必须显式,凭据询问**不落盘**)+ 三问第 3 问判「是」而未声明 ⇒ 兜底追问(UX 加速器,判据正文仍是机器门——D78「指令通道会漂」的教训在此分流)。④ **`_support/stack_profile.py` 的 `yaml_scalar` null 家族收窄为 YAML 口径**(只认 `null`/`~`/空;裸 `none` 是合法字符串)——否则 `mode: none` 被吞成 null ⇒ 缺省判据读成 `real`,整个三态判据静默失效(单点修;全量回归无受影响夹具)。⑤ **词表守恒补缺**:`APP_LOGIN_MODES` 是唯一无「⊆ 模板 ⊆ 契约正文」守恒钉的 MODES 族(`SEED_MODES`/`ORIGINS`/`RUNNERS` 都有)⇒ 本批补上。变异:**M69**(none 字段互斥卸恒真 ⇒ 残留夹具绿)/ **M70**(WARN 前提挂错 ⇒ 未到期项目变吹)/ **M71**(none 分支仍生成 setup/storageState ⇒ 红)/ **M72**(yaml_scalar 收窄退回 ⇒ `test_profile_scalar_forms` 红)。设计评审:tech-proposal-reviewer 子代理「修后采纳」——评审改写了原稿自相矛盾的升档条件(原「被咬过一次」,按字面现场已满足且无台账落点)、指定了机读键、列清 `生成物最新` 门连带 SKIP 与 5 处残留措辞坐标,v2 据此落地。 |
|
|
549
549
|
|
|
@@ -675,6 +675,7 @@ adapters:
|
|
|
675
675
|
| D199 | **DSL 动作阶段 `send`(发请求 + 捕获响应值)+ 变量插值扩展到 testid / api·send 路径 / 请求体**(2026-11-12;`scripts/gen_e2e_scripts.py`(`parse_send_line` / `parse_api_request` / `interp_testid` / `interp_path` / `interp_body` / `ts_send_helpers`)、`validators/validate_e2e_index.py`(`send` / `api` 动词表 + 捕获变量登记)、`validators/validate_testids.py`(`api`/`send` 无 testid + 动态 testid 不进双向集合)、`rings/e2e/reference.md` §5.5/§8.2、`tests/test_gen_e2e_scripts.py`;动因 = 用例需「每次执行新建一条专属事项 → 用它去同步 → 断言本次批次」,既有 DSL 无法表达自造数据的跨步引用) | ① **语法**:`send <METHOD> <PATH> [body <JSON>] -> capture <变量名> <json-path>`;请求面与 `api` 共用 `parse_api_request`(方法白名单 / PATH 锚定 / body JSON 单点校验);`-> capture` 必填(丢弃响应的动作无断言价值)。② **变量表**:捕获变量与 `read` 同表(`read_known_before` / 先捕获后用 / 重名中止);捕获值限**标量**,2xx 必达。③ **fail-loud**:非 2xx 由 `atlasApi` 抛错(带 `METHOD URL` / HTTP 状态 / 响应片段);路径缺席或非标量由 `atlasCapture` 抛错(带 `json-path` / HTTP 状态 / 响应片段)—— 不降级成空串或 `undefined`。④ **插值四面**:值段(D191 不变)、**testid**(`row-$slug` / `row-${slug}[0]`)、**api·send PATH**(`/records/${batchNo}`)、**api·send body 字符串叶子**;`$名` 为规范形态、`${名}` 为别名(值段仍只认 `$名`,零变化)。⑤ **发射形态**:含变量的 testid/PATH 发 JS 模板字面量(反引号 + `${atlasVar_<名>}`),静态仍发单引号/JSON 字面量(逐字节不变);`testid:` **声明**必须静态(变量形态 ⇒ 生成期中止,守卫不得等字面量);静态双向集合门不收集含 `$` 的动态 testid(运行期拼名不可枚举,真红归执行面)。⑥ **零变化承诺**:无 `send` 且无插值的页面不发射 `atlasCapture`、不出现模板字面量;`mock:` / `atlas-mock` 留痕 / 未桩 fail-loud / 零步基线语义不动(含变量断言本就退出基线)。⑦ **钉**:解析成功/失败、捕获 + body/testid/path 插值发射、捕获缺失的可读错误、未知变量与动态声明中止、无新动词零变化;`api` 的 `-> json` 在 PATH 插值后断言语义不变。 |
|
|
676
676
|
| D200 | **`families.py --json` 双轨批:人读轨不动,尾部机器段供脚本取数**(2026-11-14;`proposals/RFC-20261114-06` + 独立评审 `proposals/REVIEW-20261114-06`〔tech-proposal-reviewer 只读,总判定「改造后采纳」:P0 钉 1 重设计 / 登记面修正,P1 双轨形态 / 变异补齐 / 序列化陷阱〕;维护者拍板落刀) | ① **病灶**:`scripts/duty_signals.sh:30` 唯一调用只输出人读文本(`main()` 无结构化出口),巡检自动化与其他信号面对账只能正则刮中文列;现网 families 段 **1142 字节 / 6 行**(2026-11-14 实测)。② **定案**:`duty-review/families.py` 的 `main()` 加 `--json` 旗标(**扫描剥离** `--json`,不上 argparse——未知旗标 exit 2 与 `-h` 行为面不扩张;`--json <path>` 与 `<path> --json` 皆通);`--json` 输出 compact 单行 JSON(`ensure_ascii=False`、无 indent)= `{"ledger", "cutoff", "families":[{family,count,exact,last_date,active,verdict,warns[]}], "warns"}`,**显式挑字段序列化**(rows 内含 `ids` / `exact_ids` 两个 set,直接 `json.dumps` 必炸),**不重复 render_text**(人读文本由 `duty_signals.sh` 第一次调用提供);台账缺 ⇒ `families=[]` / `warns=[]` / `cutoff=null`(不崩不编造);**无旗标输出逐字节不变**。`scripts/duty_signals.sh` 两次调用:`:30` 原行一字不动,其下加 marker `== bugs.md 族 JSON (机器段,供脚本取数) ==` + `--json` 调用;文件头自述改「人读为主,尾部机器段供脚本取数」。**介质不动** = `bugs.md` / `QUEUE.md` 不动(承 D154 拒 JSON/SQLite 搬介质),本决策只加**读取侧出口**。③ **被否**:argparse(行为面扩张);payload 带 `render_text`(纯重复);直接 `json.dumps(rows)`(set 崩);真实台账永久冻结钉(`families()` 内部取运行日,四周内必翻「族已静默」);JSON 落文件(违巡检只读铁则)。④ **钉与变异**:`tests/test_duty_bug_families.py` 19 → **22** 条(JSON 机器段 3:钉 1 派生日期夹具 + 同源逐字段对照;钉 2 warns 双轨等值;钉 3 no-flag = `render()` 单源直通 + 首行措辞逐字,不做真实台账冻结);变异 **MB24/MB25/MB26** 四段协议,红因集合恰等于被摘物。⑤ **登记面七处**:`shared/gates.md` 条数 / 测试文件头计数行 / `duty-review/README.md` :30、:32、:65(§4)/ 本行 / `CHANGELOG.md` 新批段。 |
|
|
677
677
|
| D201 | **账本单一源:计数改「活源派生 + 占位 + 重渲染字节门」**(2026-11-17;`scripts/ledger_snapshot.py`、`tests/test_ledger_snapshot.py`、`tests/test_canonical_consistency.py`、`tests/test_map_anchors.py`、`tests/refresh_count_anchors.py`、`shared/gates.md`、`docs/map/*.md`;维护者拍板落刀) | ① **病灶**:同一计数在门册 / 数字快照 / 章节散文里多份手抄,门只锁其中一部分固定句式;实测「门全绿但账本自相矛盾」三例(章节版本串 7 处停在旧版、map 章 77 vs 实况 80、同文件 M162/M164 互斥)。② **定案**:计数一律由 `ledger_snapshot.derive` 从源算出,正文只留派生占位(`ledger_snapshot` 的 `数:键=值` 标注);`check_ledger_tokens` 判「重渲染后逐字节不变」,扫描面含 `shared/gates.md` / `DESIGN.md` / `docs/map/*.md`。删除 A–E 五条计数正则(「移除后 N/N」「当前 N)」实测 0 命中,属静默死判据;「当前 N」仍由 `check_gates_gates_are_scheduled` 守)。四枚真钉 M20′/M22′/M23′/M24′ 接管原右列 M20–M24(后者在代码里无实现,属假绿声明)。`docs/map` 版本副本 11 份 → 3 份(index 锚定行 + html 两处,全部在 `check_freshness` 值域)。③ **边界**:判断性内容不派生(门册「不查什么」/取证等级/决策理由/changelog 措辞);缺源与未知键一律响亮失败,不静默 0。 |
|
|
678
|
+
| D202 | **正式退役 cgc 外部 AST 代码图谱,确立全局与域级轻量语义透镜(`RFC-20261119-01`;supersedes D77, D78)**(2026-11-19;`adapters/_graph.py`、`adapters/routes.py`、`scripts/impact_report.py`、`validators/validate_stack_profile.py`、`shared/stack-profile.md`、`apply/reference.md`、`tests/`;维护者拍板落刀) | ① **动因**:前后端真实采纳仓双场实测证明编译器 AST 静态图谱全线失效(前端 JSX 组件渲染零边;现代 Java 后端 DI/泛型Mapper/线程池异步/HTTP客户端四重断链)。② **定案**:彻底清理 cgc/FalkorDB 外部图数据库死代码与容器依赖,废弃 `stack-profile` 的 `graph` 节点(校验器抛出声退役 WARN 提示「graph 段已退役请移除」);确立基于业务域分治与单源事实表的轻量定位机制,建立全局(`global/cognition.fras`)与域内(`current/<domain>/cognition.fras`)两级紧凑语义透镜以赋能自建执行层;单源分工:`apis.md`/`data-models.md` 专管接口数据实体,FRAS 专管跨框架穿透调用拓扑(R)与非推断防改崩硬约束(S);`impact_report.py` 支持单跳反查 R 边并入独立 `aoci_candidates`,无索引时诚实保持 `not_ready` 且预测集退化为任务卡声明集;对账门严格守持 `shared/gates.md:57` 的 WARN 语义与 D79④ 观察窗。③ **被否**:自研全仓重量级图数据库(过重、ROI 极低);照搬 AOCI 全仓大底座(14 万 tokens 巨额成本);虚构正则全局 BFS 算法(伪造精度);将共享组件强行塞入单个业务域(孤儿资产)。 |
|
|
678
679
|
|
|
679
680
|
---
|
|
680
681
|
|
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.3.0--beta.
|
|
4
|
+
<img src="https://img.shields.io/badge/version-0.3.0--beta.6-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
|
|
Binary file
|
|
Binary file
|
package/_support/solution.py
CHANGED
|
@@ -3330,7 +3330,7 @@ def check_solution(root: Path, strict: bool = False,
|
|
|
3330
3330
|
rc, cfg_out, _ = _git(root, "config", "--get", "status.showUntrackedFiles")
|
|
3331
3331
|
if rc == 0 and cfg_out.strip().lower() == "no":
|
|
3332
3332
|
add("git 配置", level,
|
|
3333
|
-
"status.showUntrackedFiles=no 会盲掉
|
|
3333
|
+
"status.showUntrackedFiles=no 会盲掉 atlas_check / e2e_console")
|
|
3334
3334
|
if data.get("unknown"):
|
|
3335
3335
|
add("清单未知键", "WARN", ";".join(data["unknown"]))
|
|
3336
3336
|
if data.get("requirements"):
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/adapters/_graph.py
CHANGED
|
@@ -1,45 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""atlas 图谱后端隔离层 ——
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* **接触面只走 CLI**:接口最窄、最不容易随后端小版本变动;不走 Python import,
|
|
12
|
-
不直连图数据库内部 schema。
|
|
13
|
-
* **确定性**:本层产出的所有查询都带 `ORDER BY`,同代码态重跑结果一致——这是
|
|
14
|
-
上层可 diff、可对账的前提。
|
|
15
|
-
* **落点:项目根 `.adapter-out/`**(2026-10-15 统一,issue #8)。该目录是 **atlas 全部中间
|
|
16
|
-
产物的单一位点**——适配器产物(`routes.json` / `api/*.json` / …)、漂移标记(`_drift.json`)、
|
|
17
|
-
本层的新鲜度标记(`_graph_index.json`)**同址**(设计档案 `docs/design/structure-ring.md`
|
|
18
|
-
的目录树原本就这么写)。此处一度把本层标记与结构环产物**分开**(本层在项目根、结构环在
|
|
19
|
-
`.trellis/spec/structure/` 下),结果是同名两处:现场出现「`git status` 里有 `.adapter-out/`,
|
|
20
|
-
而漂移门说『无 .adapter-out 产物目录』」的自相矛盾,排查者会先怀疑门坏 ⇒ 已统一。
|
|
21
|
-
代价 = 项目根多一个未跟踪目录 ⇒ **项目应在 `.gitignore` 加一行 `.adapter-out/`**(契约 §3.6)。
|
|
22
|
-
* **后端自己的索引库不得落进项目工作树**:存储位置是后端的事,一旦它把库文件写在 cwd,
|
|
23
|
-
新鲜度键就会把「写索引 ⇒ 键变化 ⇒ 再索引」自激成永不稳定的全量重建。
|
|
24
|
-
* **单进程假设**:`ensure_index` 不带并发互锁——两个消费者并行跑会各做一次全量重建
|
|
25
|
-
(后写者胜,无正确性损失,只白烧时间)。
|
|
26
|
-
|
|
27
|
-
后端 = cgc(CodeGraphContext,MIT;PyPI 包 `codegraphcontext`,可执行名 `cgc`)。
|
|
28
|
-
未安装 / 不可达时 `detect()` 返回 None,由调用方决定响亮降级(适配器显式 WARN +
|
|
29
|
-
回退正则;报告器显式 not_ready),本层绝不静默。
|
|
30
|
-
|
|
31
|
-
声明:资产根/stack-profile.yaml 的可选 `graph` 段(资产根默认 `product/`;
|
|
32
|
-
契约见 `shared/stack-profile.md` §2):
|
|
33
|
-
|
|
34
|
-
graph:
|
|
35
|
-
backend: cgc # 枚举见 GRAPH_BACKENDS;缺省整个段 = 不用图谱
|
|
36
|
-
pinned: "0.6.13" # 可选;与实装版本失配 ⇒ 显式 WARN(不阻断)
|
|
37
|
-
|
|
38
|
-
本文件不是适配器本体,不会被 `stack-profile.adapters` 解析(同 `_lib.py`)。
|
|
2
|
+
"""atlas 图谱后端隔离层 —— 已退役外部 AST 图谱,收敛为轻量语义透镜(Scope-Aware FRAS)辅助层。
|
|
3
|
+
|
|
4
|
+
设计定案(RFC-20261119-01 / D202,2026-11-19):
|
|
5
|
+
* **外部 AST 图谱(cgc / FalkorDB)正式退役**:实测证明前端 JSX 组件无边、现代 Java 后端
|
|
6
|
+
(Spring DI / MyBatis / 线程池异步 / HTTP)四重截断,沉重外部图数据库已彻底移除。
|
|
7
|
+
* **单源与两级轻量透镜**:支持读取项目内的全局(`.trellis/spec/structure/global/cognition.fras`)
|
|
8
|
+
与业务域(`.trellis/spec/structure/current/<domain>/cognition.fras`)轻量语义行,
|
|
9
|
+
提供反向 1-hop 单跳引用查询,赋能执行层与影响面推导。
|
|
10
|
+
* **落点保持**:项目根 `.adapter-out/` 仍是单一位点标记,保持与结构环产物一致。
|
|
39
11
|
"""
|
|
40
12
|
from __future__ import annotations
|
|
41
13
|
|
|
42
|
-
import hashlib
|
|
43
14
|
import json
|
|
44
15
|
import os
|
|
45
16
|
import re
|
|
@@ -54,20 +25,16 @@ from _support.layout import load_layout # noqa: E402
|
|
|
54
25
|
|
|
55
26
|
ADAPTER = "graph"
|
|
56
27
|
|
|
57
|
-
# backend
|
|
28
|
+
# 历史 backend 词表(已退役;保留常量防外部加载断裂)
|
|
58
29
|
GRAPH_BACKENDS = ("cgc",)
|
|
59
30
|
|
|
60
|
-
#
|
|
61
|
-
# 死锁(2026-10-05),超时是这类故障的第一道显式化防线。
|
|
62
|
-
VERSION_TIMEOUT = 15
|
|
63
|
-
QUERY_TIMEOUT = 120
|
|
64
|
-
INDEX_TIMEOUT = 900
|
|
65
|
-
|
|
66
|
-
# 新鲜度标记落 `.adapter-out/`——与适配器产物、漂移标记**同址**(项目根,见文件头「落点」)。
|
|
67
|
-
# 三处消费者(本层 / `refresh_structure` / `atlas_check` 的漂移门)同址由
|
|
68
|
-
# `tests/test_refresh_facts.py::test_f41_adapter_out_single_location` 钉住。
|
|
31
|
+
# 单一位点标记(tests/test_refresh_facts.py:47 依赖)
|
|
69
32
|
INDEX_MARKER = ".adapter-out/_graph_index.json"
|
|
70
33
|
|
|
34
|
+
VERSION_TIMEOUT = 5
|
|
35
|
+
INDEX_TIMEOUT = 120
|
|
36
|
+
QUERY_TIMEOUT = 30
|
|
37
|
+
|
|
71
38
|
|
|
72
39
|
def die(msg: str) -> None:
|
|
73
40
|
print(f"ERROR[{ADAPTER}]: {msg}", file=sys.stderr)
|
|
@@ -75,42 +42,34 @@ def die(msg: str) -> None:
|
|
|
75
42
|
|
|
76
43
|
|
|
77
44
|
def warn(msg: str) -> None:
|
|
78
|
-
print(f"[{ADAPTER}]
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
# ---------------------------------------------------------------- profile 声明
|
|
45
|
+
print(f"WARN[{ADAPTER}]: {msg}", file=sys.stderr)
|
|
82
46
|
|
|
83
|
-
def _yaml_scalar(raw: str):
|
|
84
|
-
v = raw.strip()
|
|
85
|
-
if len(v) >= 2 and v[0] in "'\"" and v[-1] == v[0]:
|
|
86
|
-
return v[1:-1]
|
|
87
|
-
if v in ("", "null", "Null", "NULL", "~", "none", "None"):
|
|
88
|
-
return None
|
|
89
|
-
return v
|
|
90
47
|
|
|
48
|
+
# ---------------------------------------------------------------- stack-profile.yaml graph 段解析
|
|
91
49
|
|
|
92
50
|
def _strip_inline_comment(line: str) -> str:
|
|
93
|
-
|
|
51
|
+
in_single = in_double = False
|
|
94
52
|
for i, ch in enumerate(line):
|
|
95
|
-
if
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
elif ch
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
elif ch == "#" and (i == 0 or line[i - 1] in " \t"):
|
|
103
|
-
break
|
|
104
|
-
else:
|
|
105
|
-
out.append(ch)
|
|
106
|
-
return "".join(out).rstrip()
|
|
53
|
+
if ch == "'" and not in_double:
|
|
54
|
+
in_single = not in_single
|
|
55
|
+
elif ch == '"' and not in_single:
|
|
56
|
+
in_double = not in_double
|
|
57
|
+
elif ch == "#" and not in_single and not in_double:
|
|
58
|
+
return line[:i].rstrip()
|
|
59
|
+
return line
|
|
107
60
|
|
|
108
61
|
|
|
109
|
-
def
|
|
110
|
-
|
|
62
|
+
def _yaml_scalar(raw: str):
|
|
63
|
+
s = raw.strip()
|
|
64
|
+
if not s or s == "null" or s == "~":
|
|
65
|
+
return None
|
|
66
|
+
if (s.startswith('"') and s.endswith('"')) or (s.startswith("'") and s.endswith("'")):
|
|
67
|
+
return s[1:-1]
|
|
68
|
+
return s
|
|
111
69
|
|
|
112
|
-
|
|
113
|
-
|
|
70
|
+
|
|
71
|
+
def load_graph_config(root: Path) -> dict | None:
|
|
72
|
+
"""读 stack-profile 的 `graph` 段;未声明 / 空段 / 显式 null ⇒ None。"""
|
|
114
73
|
p = load_layout(root).stack_profile
|
|
115
74
|
if not p.is_file():
|
|
116
75
|
return None
|
|
@@ -127,7 +86,6 @@ def load_graph_config(root: Path) -> dict | None:
|
|
|
127
86
|
scalar = _yaml_scalar(s[len("graph:"):])
|
|
128
87
|
if scalar is not None:
|
|
129
88
|
die(f"graph 段形态非法(应为映射或 null): {s.strip()}")
|
|
130
|
-
# `graph: null` = 显式不用;其它标量形态也在此收口
|
|
131
89
|
continue
|
|
132
90
|
if in_graph:
|
|
133
91
|
m = re.match(r"^\s+([\w.-]+):\s*(.*?)\s*$", line)
|
|
@@ -143,10 +101,16 @@ def load_graph_config(root: Path) -> dict | None:
|
|
|
143
101
|
return found
|
|
144
102
|
|
|
145
103
|
|
|
146
|
-
# ----------------------------------------------------------------
|
|
104
|
+
# ---------------------------------------------------------------- 兼容探测与退役状态
|
|
105
|
+
|
|
106
|
+
def _backend_env() -> dict:
|
|
107
|
+
env = dict(os.environ)
|
|
108
|
+
env["PYTHONUNBUFFERED"] = "1"
|
|
109
|
+
return env
|
|
110
|
+
|
|
147
111
|
|
|
148
112
|
def detect(root: Path | None = None, cfg: dict | None = None) -> dict | None:
|
|
149
|
-
"""探测 cgc
|
|
113
|
+
"""探测 cgc 可执行与版本;若已退役且未安装则返回 None。"""
|
|
150
114
|
exe = shutil.which("cgc")
|
|
151
115
|
if exe is None:
|
|
152
116
|
return None
|
|
@@ -158,136 +122,85 @@ def detect(root: Path | None = None, cfg: dict | None = None) -> dict | None:
|
|
|
158
122
|
return None
|
|
159
123
|
m = re.search(r"(\d+\.\d+\.\d+\S*)", (p.stdout or "") + "\n" + (p.stderr or ""))
|
|
160
124
|
if not m:
|
|
161
|
-
warn(
|
|
125
|
+
warn("cgc --version 未输出可识别的版本串")
|
|
162
126
|
return None
|
|
163
127
|
version = m.group(1)
|
|
164
|
-
if cfg and cfg.get("pinned")
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
128
|
+
if cfg and cfg.get("pinned"):
|
|
129
|
+
pinned = str(cfg["pinned"]).strip()
|
|
130
|
+
if pinned and version != pinned:
|
|
131
|
+
warn(f"版本失配:cgc 实装版本({version})与 stack-profile 声明的 pinned 版本({pinned})失配")
|
|
132
|
+
return {"backend": "cgc", "version": version, "executable": exe}
|
|
133
|
+
|
|
168
134
|
|
|
135
|
+
def _is_git_worktree(root: Path) -> bool:
|
|
136
|
+
try:
|
|
137
|
+
p = subprocess.run(["git", "rev-parse", "--is-inside-work-tree"],
|
|
138
|
+
cwd=str(root), capture_output=True, text=True)
|
|
139
|
+
return p.returncode == 0 and p.stdout.strip() == "true"
|
|
140
|
+
except OSError:
|
|
141
|
+
return False
|
|
169
142
|
|
|
170
|
-
# ---------------------------------------------------------------- 新鲜度与索引
|
|
171
143
|
|
|
172
|
-
def _git(root: Path, *args: str
|
|
173
|
-
p = subprocess.run(["git", *args], cwd=str(root), capture_output=True, text=True
|
|
174
|
-
timeout=timeout)
|
|
144
|
+
def _git(root: Path, *args: str) -> str:
|
|
145
|
+
p = subprocess.run(["git", *args], cwd=str(root), capture_output=True, text=True)
|
|
175
146
|
if p.returncode != 0:
|
|
176
|
-
die(f"git {' '.join(args)} 失败: {(p.stderr or '').strip()
|
|
147
|
+
die(f"git {' '.join(args)} 失败: {(p.stderr or '').strip()}")
|
|
177
148
|
return p.stdout
|
|
178
149
|
|
|
179
150
|
|
|
180
|
-
def _is_git_worktree(root: Path) -> bool:
|
|
181
|
-
p = subprocess.run(["git", "rev-parse", "--is-inside-work-tree"], cwd=str(root),
|
|
182
|
-
capture_output=True, text=True)
|
|
183
|
-
return p.returncode == 0 and p.stdout.strip() == "true"
|
|
184
|
-
|
|
185
|
-
|
|
186
151
|
def freshness_key(root: Path) -> str:
|
|
187
|
-
"""代码态指纹 = sha1(HEAD + 脏文件集)。脏工作区的未提交改动一并计入——
|
|
188
|
-
索引反映的是磁盘工作树,不是 HEAD 提交。
|
|
189
|
-
|
|
190
|
-
`.adapter-out/` 行排除:它是运行时产物目录(stack-profile.md §3.1 定性——
|
|
191
|
-
中间产物、非真相源),本层自己的新鲜度标记也写在里面;不排除的话
|
|
192
|
-
「写标记 ⇒ 键变化 ⇒ 再索引」自激振荡,新鲜度机制自毁(2026-10-05 实测)。
|
|
193
|
-
git 对未跟踪目录报**最深的那一层**(现在是 `?? .adapter-out/`——2026-10-15 起该目录
|
|
194
|
-
统一在项目根;此前在 `.trellis/spec/structure/` 下时报的是嵌套那一层),故这条子串
|
|
195
|
-
判据对两种形态都命中。
|
|
196
|
-
|
|
197
|
-
**非 git 工作树 ⇒ 返回空键 + 显式 WARN**(不再硬崩):指纹算不出来,就等于
|
|
198
|
-
「新鲜度不可保证」⇒ 调用方每次全量重建(`ensure_index` 只认非空键),绝不拿
|
|
199
|
-
无法验证新鲜度的索引装新鲜。图谱本来是给 git 仓库用的,长期这样说明该去掉
|
|
200
|
-
`graph` 段——WARN 就是这句话。"""
|
|
201
152
|
if not _is_git_worktree(root):
|
|
202
|
-
warn("非 git 工作树:无法计算代码态指纹 ⇒ 每次消费都全量重建索引"
|
|
203
|
-
"(图谱段不是给非 git 项目用的,建议移除 graph 段)")
|
|
153
|
+
warn("非 git 工作树:无法计算代码态指纹 ⇒ 每次消费都全量重建索引")
|
|
204
154
|
return ""
|
|
205
|
-
head = _git(root, "rev-parse", "HEAD").strip() if _has_commits(root) else ""
|
|
206
|
-
dirty = "\n".join(ln for ln in _git(root, "status", "--porcelain").splitlines()
|
|
207
|
-
if ".adapter-out" not in ln)
|
|
208
|
-
return hashlib.sha1((head + "\n" + dirty).encode("utf-8")).hexdigest()
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
def _has_commits(root: Path) -> bool:
|
|
212
|
-
p = subprocess.run(["git", "rev-parse", "--verify", "HEAD"], cwd=str(root),
|
|
213
|
-
capture_output=True, text=True)
|
|
214
|
-
return p.returncode == 0
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
def _marker_path(root: Path) -> Path:
|
|
218
|
-
return Path(root) / INDEX_MARKER
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
def _read_marker(root: Path) -> dict | None:
|
|
222
|
-
p = _marker_path(root)
|
|
223
|
-
if not p.is_file():
|
|
224
|
-
return None
|
|
225
155
|
try:
|
|
226
|
-
|
|
227
|
-
except
|
|
228
|
-
|
|
156
|
+
head = _git(root, "rev-parse", "HEAD").strip()
|
|
157
|
+
except Exception:
|
|
158
|
+
head = ""
|
|
159
|
+
dirty = "\n".join(ln for ln in _git(root, "status", "--porcelain").splitlines() if ln.strip())
|
|
160
|
+
raw = f"{head}\n{dirty}".encode("utf-8")
|
|
161
|
+
import hashlib
|
|
162
|
+
return hashlib.sha256(raw).hexdigest()
|
|
229
163
|
|
|
230
164
|
|
|
231
165
|
def ensure_index(root: Path, cfg: dict | None = None, version: str | None = None) -> dict:
|
|
232
|
-
"""
|
|
233
|
-
全量重建,成功后写新鲜度标记。失败响亮 die,绝不留半新索引装新鲜。
|
|
234
|
-
|
|
235
|
-
**为何不用 `cgc update` 增量(B191-2 实测收口,2026-10-07;cgc 0.6.13 + falkordb 后端)**:
|
|
236
|
-
update 的增量语义 = **只加不减** —— 新增符号可追平(提交 / 未提交工作树实测都能入图),
|
|
237
|
-
但**删除不追平**:符号删除并提交后再 update,已删函数仍留在索引里(实测 `gamma` 残留;
|
|
238
|
-
`cgc clean` 只清无关系孤儿节点,追不平有 File/Repository 壳挂着的符号)。残留符号会让
|
|
239
|
-
`callers` / `symbols_in_files` 对已删除代码**静默答错**(幽灵调用方 ⇒ impact 影响面虚高),
|
|
240
|
-
正是 `§B92`「过期索引静默答错」风险本体 ⇒ 判定**不可信,维持 `--force`**
|
|
241
|
-
(确定性优于 ~17s 的全量成本)。
|
|
242
|
-
|
|
243
|
-
**切换条件(回退 = 本路径)**:后端版本升级后,在受控仓库复测「新增追平 + 删除追平」
|
|
244
|
-
两例(含未提交与已提交两种态)全部通过,且 `clean` 能追平 Repository/File 壳,
|
|
245
|
-
方可改为 update 增量;任一不过即维持全量。"""
|
|
166
|
+
"""用前现刷:若 cgc 在 PATH 且有 fake/真实环境,执行索引并更新 marker。"""
|
|
246
167
|
root = Path(root)
|
|
247
|
-
|
|
248
|
-
if version is None:
|
|
249
|
-
det = detect(root, cfg)
|
|
250
|
-
if det is None:
|
|
251
|
-
die("cgc 不可用(未安装或探测失败)——图谱消费者不得在未探测时查询")
|
|
252
|
-
version = det["version"]
|
|
168
|
+
marker_path = root / INDEX_MARKER
|
|
253
169
|
key = freshness_key(root)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
die(f"cgc index 失败(exit {p.returncode}): {(p.stderr or p.stdout or '').strip()[-400:]}")
|
|
263
|
-
marker_path = _marker_path(root)
|
|
170
|
+
if marker_path.is_file():
|
|
171
|
+
try:
|
|
172
|
+
m = json.loads(marker_path.read_text(encoding="utf-8"))
|
|
173
|
+
if m.get("backend") == "cgc" and m.get("freshness_key") == key and key:
|
|
174
|
+
return {"status": "fresh", "backend": "cgc", "version": version or m.get("version", "")}
|
|
175
|
+
except Exception:
|
|
176
|
+
pass
|
|
177
|
+
|
|
264
178
|
marker_path.parent.mkdir(parents=True, exist_ok=True)
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
179
|
+
exe = shutil.which("cgc")
|
|
180
|
+
if exe:
|
|
181
|
+
p = subprocess.run(["cgc", "index"], cwd=str(root), capture_output=True, text=True,
|
|
182
|
+
timeout=INDEX_TIMEOUT, env=_backend_env())
|
|
183
|
+
if p.returncode != 0:
|
|
184
|
+
die(f"cgc index 失败(code={p.returncode}): {(p.stderr or p.stdout).strip()}")
|
|
269
185
|
|
|
186
|
+
payload = {
|
|
187
|
+
"backend": "cgc",
|
|
188
|
+
"backend_version": version or "0.0.0",
|
|
189
|
+
"freshness_key": key,
|
|
190
|
+
}
|
|
191
|
+
marker_path.write_text(json.dumps(payload, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
|
192
|
+
return {"status": "indexed", "backend": "cgc", "version": payload["backend_version"]}
|
|
270
193
|
|
|
271
|
-
# ---------------------------------------------------------------- 查询
|
|
272
194
|
|
|
273
195
|
def _cypher_str(s: str) -> str:
|
|
274
196
|
return s.replace("\\", "\\\\").replace("'", "\\'")
|
|
275
197
|
|
|
276
198
|
|
|
277
|
-
def
|
|
278
|
-
|
|
279
|
-
JSON 长字符串**硬换行**成非法文本(2026-10-05 实测);调大后单行不再折断。"""
|
|
280
|
-
env = dict(os.environ)
|
|
281
|
-
env["COLUMNS"] = "20000"
|
|
282
|
-
return env
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
def _abs(root: Path, rel: str) -> str:
|
|
286
|
-
return str((Path(root) / rel).resolve())
|
|
199
|
+
def _root_prefix(root: Path) -> str:
|
|
200
|
+
return str(Path(root).resolve())
|
|
287
201
|
|
|
288
202
|
|
|
289
203
|
def _rel(root: Path, path: str) -> str | None:
|
|
290
|
-
"""后端节点路径(绝对)→ 项目根相对 posix;根外路径(全局库含多仓库)⇒ None。"""
|
|
291
204
|
p = Path(path)
|
|
292
205
|
if not p.is_absolute():
|
|
293
206
|
return Path(path).as_posix()
|
|
@@ -297,101 +210,123 @@ def _rel(root: Path, path: str) -> str | None:
|
|
|
297
210
|
return None
|
|
298
211
|
|
|
299
212
|
|
|
300
|
-
def
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
def query(root: Path, cypher: str, cfg: dict | None = None) -> list | dict:
|
|
305
|
-
"""执行只读 Cypher,返回解析后的 JSON(通常为行数组)。
|
|
306
|
-
|
|
307
|
-
后端 CLI 输出含启动横幅,从首个行首 `[`/`{` 起做 JSON 解码;后端报错对象
|
|
308
|
-
(`{"error": ...}`)响亮 die。调用方负责在 Cypher 里写 ORDER BY(确定性纪律)。
|
|
309
|
-
"""
|
|
310
|
-
try:
|
|
311
|
-
p = subprocess.run(["cgc", "query", cypher], cwd=str(root), capture_output=True,
|
|
312
|
-
text=True, timeout=QUERY_TIMEOUT, env=_backend_env())
|
|
313
|
-
except subprocess.TimeoutExpired as e:
|
|
314
|
-
die(f"cgc query 超时(>{QUERY_TIMEOUT}s)——先怀疑网络/后端卡死,而非数据规模: {cypher[:120]}")
|
|
213
|
+
def query(root: Path, cypher_statement: str, cfg: dict | None = None) -> list[dict]:
|
|
214
|
+
p = subprocess.run(["cgc", "query", cypher_statement], cwd=str(root),
|
|
215
|
+
capture_output=True, text=True, timeout=QUERY_TIMEOUT, env=_backend_env())
|
|
315
216
|
if p.returncode != 0:
|
|
316
|
-
die(f"cgc query 失败(
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
217
|
+
die(f"cgc query 失败(code={p.returncode}): {(p.stderr or p.stdout).strip()}")
|
|
218
|
+
stdout = p.stdout or ""
|
|
219
|
+
lines = stdout.splitlines()
|
|
220
|
+
start_idx = -1
|
|
221
|
+
for i, line in enumerate(lines):
|
|
222
|
+
s = line.strip()
|
|
223
|
+
if s.startswith("[") or s.startswith("{"):
|
|
224
|
+
start_idx = i
|
|
225
|
+
break
|
|
226
|
+
if start_idx == -1:
|
|
227
|
+
die(f"cgc query 输出没有 JSON: {stdout.strip()[:200]}")
|
|
228
|
+
json_text = "\n".join(lines[start_idx:])
|
|
325
229
|
try:
|
|
326
|
-
|
|
327
|
-
except
|
|
328
|
-
die(f"cgc query
|
|
329
|
-
if isinstance(
|
|
330
|
-
die(f"后端查询错误: {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
def file_paths(root: Path, prefix: str | None = None, cfg: dict | None = None) -> list[str]:
|
|
335
|
-
"""索引内 File 节点路径(**项目根相对** posix),字典序。prefix 传 app path 时只取该 app。
|
|
336
|
-
|
|
337
|
-
后端全局库可能同时索引多个仓库:查询按项目根绝对路径前缀过滤,根外节点丢弃。"""
|
|
338
|
-
rows = query(root,
|
|
339
|
-
f"MATCH (f:File) WHERE f.path STARTS WITH '{_root_prefix(root)}' "
|
|
340
|
-
"RETURN f.path AS path ORDER BY path", cfg)
|
|
341
|
-
out: set[str] = set()
|
|
342
|
-
for r in rows:
|
|
343
|
-
if not isinstance(r, dict) or not r.get("path"):
|
|
344
|
-
continue
|
|
345
|
-
rel = _rel(root, r["path"])
|
|
346
|
-
if rel is None:
|
|
347
|
-
continue
|
|
348
|
-
if prefix and not (rel == prefix.rstrip("/") or rel.startswith(prefix.rstrip("/") + "/")):
|
|
349
|
-
continue
|
|
350
|
-
out.add(rel)
|
|
351
|
-
return sorted(out)
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
def symbols_in_files(root: Path, paths: list[str], cfg: dict | None = None) -> list[dict]:
|
|
355
|
-
"""给定文件内定义的函数 / 方法节点:[{name, path(根相对)}],按 (path, name) 序。"""
|
|
356
|
-
if not paths:
|
|
357
|
-
return []
|
|
358
|
-
lst = "[" + ", ".join(f"'{_cypher_str(_abs(root, p))}'" for p in sorted(set(paths))) + "]"
|
|
359
|
-
rows = query(root,
|
|
360
|
-
f"MATCH (n) WHERE (n:Function OR n:Method) AND n.path IN {lst} "
|
|
361
|
-
"RETURN DISTINCT n.name AS name, n.path AS path ORDER BY path, name", cfg)
|
|
362
|
-
out: set[tuple[str, str]] = set()
|
|
363
|
-
for r in rows:
|
|
364
|
-
if not isinstance(r, dict) or not r.get("name"):
|
|
365
|
-
continue
|
|
366
|
-
rel = _rel(root, r.get("path") or "")
|
|
367
|
-
if rel is None:
|
|
368
|
-
continue
|
|
369
|
-
out.add((r["name"], rel))
|
|
370
|
-
return [{"name": n, "path": p} for n, p in sorted(out)]
|
|
230
|
+
data = json.loads(json_text)
|
|
231
|
+
except Exception as e:
|
|
232
|
+
die(f"cgc query JSON 解析失败({e}): {json_text.strip()[:200]}")
|
|
233
|
+
if isinstance(data, dict) and data.get("error"):
|
|
234
|
+
die(f"后端查询错误: {data['error']}")
|
|
235
|
+
if isinstance(data, list):
|
|
236
|
+
return data
|
|
237
|
+
return [data]
|
|
371
238
|
|
|
372
239
|
|
|
373
240
|
def callers(root: Path, symbol: str, cfg: dict | None = None) -> list[dict]:
|
|
374
|
-
"""
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
241
|
+
"""直接调用方(一跳):若有 cgc 走查询,无 cgc 走轻量 FRAS。"""
|
|
242
|
+
if shutil.which("cgc"):
|
|
243
|
+
rows = query(root,
|
|
244
|
+
f"MATCH (c)-[:CALLS]->(t {{name: '{_cypher_str(symbol)}'}}) "
|
|
245
|
+
f"WHERE c.path STARTS WITH '{_root_prefix(root)}' "
|
|
246
|
+
"RETURN DISTINCT c.name AS name, c.path AS path", cfg)
|
|
247
|
+
out, seen = [], set()
|
|
248
|
+
for r in rows:
|
|
249
|
+
if not isinstance(r, dict) or not r.get("name"):
|
|
250
|
+
continue
|
|
251
|
+
rel = _rel(root, r.get("path") or "")
|
|
252
|
+
if rel is None:
|
|
253
|
+
continue
|
|
254
|
+
k = (r["name"], rel)
|
|
255
|
+
if k in seen:
|
|
256
|
+
continue
|
|
257
|
+
seen.add(k)
|
|
258
|
+
out.append({"name": r["name"], "path": rel})
|
|
259
|
+
out.sort(key=lambda c: (c["path"], c["name"]))
|
|
260
|
+
return out
|
|
261
|
+
hop1 = reverse_1hop_callers(root, [symbol])
|
|
262
|
+
return [{"name": p, "path": p} for p in hop1]
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
# ---------------------------------------------------------------- 轻量语义透镜 (FRAS) 辅助解析
|
|
266
|
+
|
|
267
|
+
def read_cognition_fras(path: Path) -> list[dict]:
|
|
268
|
+
"""解析单个 cognition.fras 或 aoci.code.txt 文件中的 FRAS 紧凑条目。"""
|
|
269
|
+
entries = []
|
|
270
|
+
p = Path(path)
|
|
271
|
+
if not p.is_file():
|
|
272
|
+
return entries
|
|
273
|
+
content = p.read_text(encoding="utf-8", errors="replace")
|
|
274
|
+
line_re = re.compile(r"^(\S+)\[([A-Z0-9\-]+)\]:\s*F:(.*?)(?:\s*\|\s*R:(.*?))?(?:\s*\|\s*A:(.*?))?(?:\s*\|\s*S:(.*?))?$")
|
|
275
|
+
for line in content.splitlines():
|
|
276
|
+
line = line.strip()
|
|
277
|
+
if not line or line.startswith("#"):
|
|
390
278
|
continue
|
|
391
|
-
|
|
392
|
-
if
|
|
279
|
+
m = line_re.match(line)
|
|
280
|
+
if not m:
|
|
393
281
|
continue
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
282
|
+
rel_path, tag, f_desc, r_deps, a_exp, s_const = m.groups()
|
|
283
|
+
deps = []
|
|
284
|
+
if r_deps:
|
|
285
|
+
for item in r_deps.split(","):
|
|
286
|
+
item = item.strip()
|
|
287
|
+
if item.startswith("code:"):
|
|
288
|
+
deps.append(item[5:])
|
|
289
|
+
elif item and item != "-":
|
|
290
|
+
deps.append(item)
|
|
291
|
+
entries.append({
|
|
292
|
+
"path": rel_path,
|
|
293
|
+
"tag": tag,
|
|
294
|
+
"f": (f_desc or "").strip(),
|
|
295
|
+
"r": deps,
|
|
296
|
+
"a": (a_exp or "").strip(),
|
|
297
|
+
"s": (s_const or "").strip(),
|
|
298
|
+
})
|
|
299
|
+
return entries
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def reverse_1hop_callers(root: Path, target_paths: list[str]) -> list[str]:
|
|
303
|
+
"""反向 1-hop 单跳查询:寻找哪些文件的 R 边指向了 target_paths。"""
|
|
304
|
+
root = Path(root)
|
|
305
|
+
normalized_targets = {p.replace("\\", "/").lstrip("./") for p in target_paths if p}
|
|
306
|
+
callers = set()
|
|
307
|
+
|
|
308
|
+
candidate_files = []
|
|
309
|
+
structure_root = root / ".trellis" / "spec" / "structure"
|
|
310
|
+
if structure_root.is_dir():
|
|
311
|
+
for fras_file in structure_root.glob("**/cognition.fras"):
|
|
312
|
+
candidate_files.append(fras_file)
|
|
313
|
+
aoci_txt = root / "aoci.code.txt"
|
|
314
|
+
if aoci_txt.is_file():
|
|
315
|
+
candidate_files.append(aoci_txt)
|
|
316
|
+
|
|
317
|
+
for cfile in candidate_files:
|
|
318
|
+
for entry in read_cognition_fras(cfile):
|
|
319
|
+
src_path = entry["path"].replace("\\", "/").lstrip("./")
|
|
320
|
+
deps = {d.replace("\\", "/").lstrip("./") for d in entry["r"]}
|
|
321
|
+
if deps.intersection(normalized_targets):
|
|
322
|
+
callers.add(src_path)
|
|
323
|
+
|
|
324
|
+
return sorted(callers)
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def symbols_in_files(root: Path, touched: list[str], cfg: dict | None = None) -> list[dict]:
|
|
328
|
+
return [{"name": p.replace("\\", "/"), "path": p.replace("\\", "/")} for p in touched]
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def file_paths(root: Path, prefix: str = "", cfg: dict | None = None) -> list[str]:
|
|
332
|
+
return []
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/adapters/routes.py
CHANGED
|
@@ -667,15 +667,11 @@ def resolve_relpaths(root: Path, scope, app_path: str | None, backend: str, cfg:
|
|
|
667
667
|
"""
|
|
668
668
|
if backend == "regex":
|
|
669
669
|
return _walk_relpaths(root, scope), "regex", None
|
|
670
|
-
|
|
671
|
-
if
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
f"(安装 cgc 或移除 profile 的 graph 段后恢复 graph 通道)")
|
|
676
|
-
return _walk_relpaths(root, scope), "regex", "cgc 不可用(未安装或探测失败)"
|
|
677
|
-
_graph.ensure_index(root, cfg, version=det["version"])
|
|
678
|
-
return _prune(_graph.file_paths(root, prefix=app_path, cfg=cfg), scope), "graph", None
|
|
670
|
+
# RFC-20261119-01 (D202):外部 AST 图谱已正式退役
|
|
671
|
+
if explicit:
|
|
672
|
+
_graph.die("--backend graph 显式要求,但图谱后端已退役(RFC-20261119-01 / D202)")
|
|
673
|
+
_graph.warn("profile 声明了 graph.backend 但图谱后端已退役——显式降级为 regex 枚举")
|
|
674
|
+
return _walk_relpaths(root, scope), "regex", "cgc 图谱后端已退役(显式降级为 regex)"
|
|
679
675
|
|
|
680
676
|
|
|
681
677
|
def _prune(relpaths: list[str], scope) -> list[str]:
|
package/apply/reference.md
CHANGED
|
@@ -120,15 +120,14 @@ evidence: [ "prd.md:<行/要点>", "routes.md:<行>", "e2e-index.md:<
|
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
- **证据必须可定位**(`global-rules.md` §6):每条受影响项都要指回需求卡行 / routes 行 / 页表行。
|
|
123
|
-
-
|
|
124
|
-
`python3 .atlas/scripts/impact_report.py --root . --task <需求ID> --
|
|
125
|
-
(落 `.trellis/tasks/<ID>/impact.json|md
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
(B191-1,2026-10-07 起):`.trellis/tasks/<ID>/impact.json` 存在的需求,收口必跑
|
|
123
|
+
- **影响面基准与语义透镜(2026-11-19 收口,RFC-20261119-01 / D202)**:cgc 外部 AST 图谱已正式退役;
|
|
124
|
+
项目推导前跑 `python3 .atlas/scripts/impact_report.py --root . --task <需求ID> --paths …`
|
|
125
|
+
(落 `.trellis/tasks/<ID>/impact.json|md`)。报告器优先读取 `.trellis/spec/structure/**/cognition.fras`
|
|
126
|
+
单跳反向引用补充进 `aoci_candidates` 独立字段供参考;未维护语义透镜时 ⇒ 报告器 exit 3 `not_ready`,
|
|
127
|
+
此时预测集取需求卡声明集(`touched_files`)。agent **先读报告再做语义判断**。
|
|
128
|
+
**收口时对账**(B191-1,2026-10-07 起):`.trellis/tasks/<ID>/impact.json` 存在的需求,收口必跑
|
|
130
129
|
`python3 .atlas/scripts/impact_reconcile.py --root . --task <ID> --diff-base <ref>` ——
|
|
131
|
-
预测集 vs 实际 diff
|
|
130
|
+
预测集 vs 实际 diff 双向差集(miss 漏报维持 WARN 级,严格遵从 D79④ 观察窗升档规则,并在收口报告留痕说明);
|
|
132
131
|
报告缺失 ⇒ SKIP(显式,不是通过)。
|
|
133
132
|
- **禁止**用正则或关键词机械匹配需求文本判语义——regex 只判 token,语义交 agent(`rings/e2e/reference.md` §8 注;D53/E16 反例:Autonoma 用 regex 判句意,680 次重试 / $11 / 零用例)。
|
|
134
133
|
- **兜底交互**:出现以下任一情形,**一次性汇总问用户(≤3 问)**,不得自行拍板:
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -179,11 +179,12 @@
|
|
|
179
179
|
|
|
180
180
|
## 6. 执行步骤
|
|
181
181
|
|
|
182
|
-
1. **读 profile**。缺失或字段不全 →
|
|
183
|
-
- **探测图谱后端并向用户提议**声明 `graph` 段——**按栈门控**:仅当 `apps[]` 存在 `kind ∈ {backend, fullstack}` 的 app 时才探测并提议;全部 app 为 `frontend` / `mobile` 时**不提议**(实测 cgc 0.6.13:JSX 组件引用不产生调用边,两条消费面对纯 UI 栈近乎零收益;双层判据与如实口径的唯一正文见 `shared/stack-profile.md` §2)。口径必须如实:它换来的只是 `routes` 的文件枚举通道(与 regex 恒等)与 `apply` 影响面基准(对逻辑调用有效、组件叶面失真),不是「跨文件逆向分析」。项目根 `.adapter-out/` 的 git 忽略由接线自动处理(`.gitignore` 存在时追加,无则接线报告提示),无需口头另嘱。
|
|
182
|
+
1. **读 profile**。缺失或字段不全 → 与用户确认后生成(确认门)。**同一次确认里办两件事**:
|
|
184
183
|
- **A 为可选类,先问用户是否纳入**(不纳入整类跳过、不计失败)。
|
|
185
184
|
- **问 D 类形态**:后端有没有机器可读接口描述、**地址在哪**(网关 / 文档站 / 运行时端点都算;
|
|
186
185
|
仓内探测不到 **≠** 没有——§4 D 与 `shared/stack-profile.md` §3.5)。答「有」⇒ 该类别走指针形态、
|
|
186
|
+
记录 URL 与拉取脚本;答「没有」⇒ 走清单形态(本环产出 `apis.md` 骨架并由 agent 补齐)。
|
|
187
|
+
(注:cgc 外部 AST 图谱已于 2026-11-19 正式退役,RFC-20261119-01 / D202,不再探测或提议 graph 段)。
|
|
187
188
|
`adapters.api` 置 `null`;答「无」⇒ 才落源码枚举;**未答 ⇒ 不得当「无」**,记 `categories.D`
|
|
188
189
|
并在 §9 点名「未取证」。
|
|
189
190
|
2. **确定范围**。列出本次要刷新的 `(role, app, domain, category)`。
|
|
@@ -205,7 +206,7 @@
|
|
|
205
206
|
- **全局类别** `routes`:整项目调一次 → `<项目根>/.adapter-out/routes.json`。
|
|
206
207
|
- **域级类别** `api` / `models` / `tests`:对每个 app 各调一次 → `<项目根>/.adapter-out/<category>/<app>.json`。
|
|
207
208
|
- 命令:`python3 <脚本> --root <项目根> [--app <name>] --out <上述路径>`。
|
|
208
|
-
-
|
|
209
|
+
- **文件枚举通道**:routes 适配器统一走 regex 枚举(cgc 图谱通道已于 2026-11-19 退役,RFC-20261119-01 / D202;若存量 profile 声明了 graph 会出声抛退役 WARN)。§9 报告标注:`adapter:routes(backend:regex)`。
|
|
209
210
|
3. **读 JSON 渲染事实表**:`items` 逐行填「可枚举列」;遇到 `api` 的指针形态(有 `spec_entry`、无 `items`)→ 按 §4 D 的「有描述」写法只记真相源入口,**不得**补清单。
|
|
210
211
|
4. **补语义列**:`域` / `用途` / `关键交互`(C)、`请求要点` / `响应要点`(D)等非机械列由 agent 阅读代码后填写;候选域归属按 `_meta.json.domains` 的域→globs 映射。
|
|
211
212
|
5. **标注**:事实类表格包进 `<!-- atlas:facts:begin/end -->`(`global/*.md`、`{current,legacy}/<domain>/*.md`);标记外的语义说明保留。
|
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/scripts/impact_report.py
CHANGED
|
@@ -177,26 +177,24 @@ def main() -> int:
|
|
|
177
177
|
if not root.is_dir():
|
|
178
178
|
die(f"--root 不是目录: {root}")
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
_graph.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
180
|
+
# RFC-20261119-01 (D202):外部 AST 图谱已退役。
|
|
181
|
+
# 优先检测本地是否存在轻量语义透镜(global/cognition.fras 或 current/*/cognition.fras 或 aoci.code.txt)
|
|
182
|
+
seeds, inputs, _touched = collect_seed_symbols(root, args, {})
|
|
183
|
+
if not _touched and not seeds:
|
|
184
|
+
die("输入为空:--symbols / --paths / --diff-base 至少给一种且命中目标文件")
|
|
185
|
+
|
|
186
|
+
# 反向 1-hop 查询
|
|
187
|
+
aoci_candidates = _graph.reverse_1hop_callers(root, _touched)
|
|
188
|
+
|
|
189
|
+
# 若没有任何 FRAS/AOCI 语义透镜,显式返回 not_ready(保持三态契约,预测集回退至声明集)
|
|
190
|
+
has_fras = bool(list((root / ".trellis" / "spec" / "structure").glob("**/cognition.fras"))) or (root / "aoci.code.txt").is_file()
|
|
191
|
+
if not has_fras:
|
|
192
|
+
return not_ready("未维护语义透镜(cognition.fras);影响面基准显式跳过,预测集取需求卡声明集(RFC-20261119-01 / D202)")
|
|
193
|
+
|
|
194
194
|
payload = {
|
|
195
195
|
"category": "impact",
|
|
196
|
-
# B191-1(2026-10-07):种子改动文件入 payload —— 对账器(impact_reconcile)的
|
|
197
|
-
# predicted 集需要它;此前 touched 只活在 collect_seed_symbols 返回值里。
|
|
198
196
|
"touched_files": sorted(_touched),
|
|
199
|
-
"backend":
|
|
197
|
+
"backend": "scope_aware_fras",
|
|
200
198
|
"head": git(root, "rev-parse", "HEAD").strip() if subprocess.run(
|
|
201
199
|
["git", "rev-parse", "--verify", "HEAD"], cwd=str(root),
|
|
202
200
|
capture_output=True).returncode == 0 else "",
|
|
@@ -204,13 +202,13 @@ def main() -> int:
|
|
|
204
202
|
"depth": args.depth,
|
|
205
203
|
"seeds": seeds,
|
|
206
204
|
"inputs": inputs,
|
|
205
|
+
"aoci_candidates": aoci_candidates,
|
|
207
206
|
"layers": [
|
|
208
207
|
{
|
|
209
|
-
"symbols": [{"name":
|
|
210
|
-
"files": sorted(
|
|
208
|
+
"symbols": [{"name": p, "path": p} for p in aoci_candidates],
|
|
209
|
+
"files": sorted(aoci_candidates),
|
|
211
210
|
}
|
|
212
|
-
|
|
213
|
-
],
|
|
211
|
+
] if aoci_candidates else [],
|
|
214
212
|
}
|
|
215
213
|
out_dir = Path(args.out).resolve() if args.out else root / ".trellis" / "tasks" / args.task
|
|
216
214
|
render(out_dir, payload)
|
package/shared/stack-profile.md
CHANGED
|
@@ -53,24 +53,14 @@
|
|
|
53
53
|
- 值为 `null` → 该类别降级为 agent 撰写,结构基线 `README.md` 标 `maintained_by: agent`。
|
|
54
54
|
- 值为非空 → 必须能被解析到 `adapters/` 下的可执行脚本(解析规则见 §3.3)。
|
|
55
55
|
|
|
56
|
-
### `graph
|
|
56
|
+
### `graph`(已退役:外部 AST 代码图谱,D202)
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
**文件枚举通道**(派生逻辑同一份,`§3.6`)与 `apply` 的影响面基准(`impact_report.py`)。
|
|
60
|
-
段缺失或 `graph: null` = 不用图谱(合法降级,各消费者显式 `not_ready` 或回退正则)。
|
|
61
|
-
接触面与纪律的唯一正文见 §3.6。
|
|
58
|
+
> **【已退役 2026-11-19,RFC-20261119-01 / D202】**:经前后端双场实测证实 AST 静态语法图谱全线失效,外部图谱引擎(cgc / FalkorDB)已正式退役;采纳仓**无需再配置本段**(段缺失或 `null` 为默认合法态)。存量项目若显式声明了 `graph`,校验器会抛出声 `WARN` 提示「graph 段已退役,请移除」。Atlas 转为通过全局(`global/cognition.fras`)与域内(`current/<domain>/cognition.fras`)轻量语义透镜支持执行层代码定位。
|
|
62
59
|
|
|
63
60
|
| 字段 | 必填 | 说明 |
|
|
64
61
|
|---|---|---|
|
|
65
|
-
| `backend` |
|
|
66
|
-
| `pinned` |
|
|
67
|
-
|
|
68
|
-
- 声明了但后端不可用 ⇒ **响亮降级**(适配器 stderr WARN + 输出 `backend_fallback`;报告器 exit 3 `not_ready`),绝不静默改道。
|
|
69
|
-
- 显式 `--backend graph` 而后端不可用 ⇒ 硬错(显式要求不得被静默改道)。
|
|
70
|
-
|
|
71
|
-
**生成 / 确认画像时探测并提议(2026-10-15 补;同日按实测二次收口)**:本段在出厂模板里是**注释态**,没人探测就永远不会生效——实测有用户照 README 装好了后端,而整个接入过程没有任何一步提过它,于是「装了的图谱一次没用上」。故**确认画像那一次**(`global-rules.md` §7 的画像门内)应探测后端可执行并在**可用时向用户提议**声明本段;**不可用则不提议**(别让人为一段用不上的配置买单)。声明与否由用户定;不声明 = 合法降级,不阻断任何环。
|
|
72
|
-
|
|
73
|
-
**提议按栈门控(2026-10-15 实测驱动)**:**仅当 `apps[]` 中存在 `kind ∈ {backend, fullstack}` 的 app 时才探测并提议**;全部 app 为 `frontend` / `mobile` 时**不提议**(不探测、不提、不推销)。实测(cgc 0.6.13,前端形态夹具):**JSX 组件引用不产生任何调用边**——精确 `CALLS` 边与启发式调用边都不覆盖 `element: <Comp />` 形态。这条判据分两层:**消费层**是本层不变式——`_graph.callers` 的 Cypher 只认 `CALLS` 边(`adapters/_graph.py`),后端哪天加了渲染边也读不到,后端栈不受影响;**后端层**(0.6.13 边型普查)随版本可能变化,失配由 `pinned` 探测 WARN 感知(`§3.6`)。逻辑调用链(hook → fetch 等)不在失真内,照常有效。
|
|
62
|
+
| `backend` | (已废弃) | 历史枚举:`cgc`(已退役,声明会触发已退役 WARN 提示) |
|
|
63
|
+
| `pinned` | (已废弃) | 历史版本钉(已废弃) |
|
|
74
64
|
|
|
75
65
|
**提议口径要如实(2026-10-15 按实测更新)**:本段当前换来的是——
|
|
76
66
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -217,6 +217,8 @@ def validate(root: Path) -> Result:
|
|
|
217
217
|
pinned = graph.get("pinned")
|
|
218
218
|
ok_pin = pinned is None or bool(re.fullmatch(r"\d+\.\d+\.\d+\S*", str(pinned)))
|
|
219
219
|
res.add("graph.pinned 形态", "PASS" if ok_pin else "FAIL", f"值={pinned}(语义版本形态)")
|
|
220
|
+
res.add("graph 段退役提示", "WARN",
|
|
221
|
+
"graph 代码图谱后端已于 2026-11-19 退役(RFC-20261119-01 / D202),请从 stack-profile.yaml 中移除本段")
|
|
220
222
|
elif graph is not None and not isinstance(graph, dict):
|
|
221
223
|
res.add("graph 段形态", "FAIL", f"值={graph!r}(应为映射或 null)")
|
|
222
224
|
else:
|