feat: 3.2.17中途变更处理(git驱动) + 3.2.9a Worker git强制 + 3.2.5 Phase7 squash merge + Arc git初始化检测

- 新增 ChangeClassifier(爆炸半径分类:IMPLEMENTATION/INTERFACE/GLOBAL_CONSTRAINT)
- 新增 ImpactPropagator(BFS影响传播:IMPACTED/BOUNDARY/SAFE差异化标记)
- task_graph.py:invalidate_by_adr()差异化失效 + CascadeReport扩展字段(向后兼容)
- eng_mode.py:三阶段差异化流程(分类→传播→失效→git操作→验证任务→重规划)
- eng_mode.py:_git_squash_merge_and_tag() + Phase 7 集成
- do_mode.py:_ensure_all_committed() Worker git操作强制
- adr_watcher.py:内容快照 + get_content_for_classification()
- events.py:ADR_CLASSIFIED/IMPACT_PROPAGATED/BOUNDARY_VERIFICATION_GENERATED
- partial_replanner.py:replan_with_constraints() + generate_verification_tasks()
- project_bootstrap.py:ensure_git_initialized() Arc规划前检测
- test_p1_21_phase2.py:21个新测试,95个全量测试0失败

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
AirPlan
2026-06-15 14:45:41 +08:00
parent a60d1a0c04
commit 9702f1b186
11 changed files with 1351 additions and 82 deletions

View File

@@ -73,6 +73,62 @@ class PartialReplanner:
return delta
def replan_with_constraints(self, graph: TaskGraph,
invalidated_ids: list[str],
frozen_interfaces: list[Interface],
new_adr_path: Path | None = None) -> PlanDelta:
"""带冻结接口约束的局部重规划3.2.17 Phase 3
frozen_interfaces 来自 SAFE 已完成任务,重规划不能破坏这些接口。
"""
delta = PlanDelta()
affected_context = self._collect_affected_context(graph, invalidated_ids)
stable_interfaces = self._extract_stable_interfaces(graph, set(invalidated_ids))
all_frozen = list(stable_interfaces)
for fi in frozen_interfaces:
if not any(s.task_id == fi.task_id for s in all_frozen):
all_frozen.append(fi)
replan_request = {
"type": "partial-replan",
"invalidatedTaskIds": invalidated_ids,
"affectedContext": [ctx.__dict__ for ctx in affected_context],
"stableInterfaces": [iface.__dict__ for iface in all_frozen],
"newAdrPath": str(new_adr_path) if new_adr_path else None,
}
delta.replan_request = replan_request
return delta
def generate_verification_tasks(self, graph: TaskGraph,
boundary_task_ids: list[str]) -> PlanDelta:
"""为 BOUNDARY 已完成任务生成验证任务3.2.17 Phase 3.4)。
验证任务检查 BOUNDARY 任务的兼容性,确认是否与新 ADR 一致。
"""
from air_runtime.task_graph import TaskNode, Edge
delta = PlanDelta()
for idx, tid in enumerate(boundary_task_ids):
node = graph.nodes.get(tid)
if not node or node.status != "DONE":
continue
verify_id = f"{tid}-VFY"
verify_node = TaskNode(
id=verify_id,
status="TODO",
task=f"[边界验证] 验证 {tid} ({node.task}) 与新 ADR 的兼容性",
files_dirs=node.files_dirs,
done_when="兼容性确认通过",
write_set=list(node.write_set),
test_required=True,
)
delta.added_tasks.append(verify_node)
delta.edge_changes.added.append(Edge(
source=tid, target=verify_id, kind="verification",
))
return delta
def _collect_affected_context(self, graph: TaskGraph,
invalidated_ids: list[str]) -> list[ReplanContext]:
"""收集受影响任务的上下文。"""