feat(impact): recursive candidate impact analysis over the union graph #14

Merged
cflmy merged 2 commits from release/eco-impact into main 2026-11-27 02:15:08 +08:00
Owner

范围(ECO-02 / marqdo#7 剩余核心项)

实现 scripts/impact.py 递归影响分析,并接入候选集成证据:

  • 比较已接受根提交与候选的递归展开身份 (global_id, parent, remote, SHA, state);domain gitlink 变化展开到子组件身份,不只标记父节点。
  • 受影响集合按合同顺序:变更/删除叶子 → requires 新旧图并集的反向传递闭包(删除边不能隐藏消费者)→ 父级领域 → checks_with 固定点(协同验收不作为构建先决)。
  • 领域无法展开(缺对象/检出)时标 UNVERIFIED 并全量扩大范围,不静默跳过;--fail-on-unverified 可硬失败。
  • scripts/integration.sh 对 PR 目标分支(CI_COMMIT_TARGET_BRANCH)或 origin/main 运行分析,并把 changed/affected/checks_with/fallback 写入候选证据 JSON。
  • 5 个契约测试使用真实临时 Git 仓:叶子变更→requires→checks_with、删除组件、依赖变化、domain gitlink 展开、不可展开时全量回退。

验证(本地候选 b43f104)

  • python3 -m unittest tests.integration.test_impact:5/5 PASS。
  • 真实仓库 python3 scripts/impact.py --accepted origin/main --candidate HEAD:changed/affected 为空、无 UNVERIFIED、fallback=None(仅脚本/测试变更,符合预期)。
  • 根生态 CI(layout + candidate 全消费者)为合并门禁;本 PR 会在 integration.sh 中实际运行分析并写入证据。

Refs cflmy/marqdo#7

## 范围(ECO-02 / marqdo#7 剩余核心项) 实现 `scripts/impact.py` 递归影响分析,并接入候选集成证据: - 比较已接受根提交与候选的**递归展开**身份 `(global_id, parent, remote, SHA, state)`;domain gitlink 变化展开到子组件身份,不只标记父节点。 - 受影响集合按合同顺序:变更/删除叶子 → `requires` 新旧图并集的**反向传递闭包**(删除边不能隐藏消费者)→ 父级领域 → `checks_with` 固定点(协同验收不作为构建先决)。 - 领域无法展开(缺对象/检出)时标 UNVERIFIED 并**全量扩大**范围,不静默跳过;`--fail-on-unverified` 可硬失败。 - `scripts/integration.sh` 对 PR 目标分支(`CI_COMMIT_TARGET_BRANCH`)或 `origin/main` 运行分析,并把 changed/affected/checks_with/fallback 写入候选证据 JSON。 - 5 个契约测试使用真实临时 Git 仓:叶子变更→requires→checks_with、删除组件、依赖变化、domain gitlink 展开、不可展开时全量回退。 ## 验证(本地候选 `b43f104`) - `python3 -m unittest tests.integration.test_impact`:5/5 PASS。 - 真实仓库 `python3 scripts/impact.py --accepted origin/main --candidate HEAD`:changed/affected 为空、无 UNVERIFIED、fallback=None(仅脚本/测试变更,符合预期)。 - 根生态 CI(layout + candidate 全消费者)为合并门禁;本 PR 会在 `integration.sh` 中实际运行分析并写入证据。 Refs cflmy/marqdo#7
cflmy added 2 commits 2026-11-27 02:05:34 +08:00
Implement the ECO-02 impact contract: compare the recursively expanded
(global_id, parent, remote, SHA, state) identities of an accepted root commit
and a candidate, expand domain gitlink changes to child identities, close over
the reverse requires graph built from the union of both revisions, add parent
domains, then reach a fixed point over checks_with. An unexpandable domain is
reported UNVERIFIED and widens the affected set to the full candidate instead of
skipping (--fail-on-unverified makes it fatal).

integration.sh runs it against the accepted root ref (PR target branch or
origin/main) and records changed/affected/checks_with/fallback in the candidate
evidence JSON. Five contract tests build real temporary Git repositories,
including a domain gitlink change and the conservative fallback.

Refs cflmy/marqdo#7
The candidate evidence heredoc referenced the report without reading it after the
rebase; define the report from <work>/impact.json (or None when no accepted ref
was available) before building the record.
cflmy force-pushed release/eco-impact from b43f104984 to 328cc5c61b 2026-11-27 02:05:34 +08:00 Compare
cflmy merged commit 328cc5c61b into main 2026-11-27 02:15:08 +08:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cflmy/marqdo#14