Complete name-first MCP write-plan composition

This commit is contained in:
2026-07-26 17:05:05 +03:00
parent 92a331f149
commit 1ca47dce13
9 changed files with 345 additions and 18 deletions
+18 -3
View File
@@ -117,7 +117,11 @@ def first_write_plan_target_from_saved_state(result: dict[str, Any]) -> dict[str
if not isinstance(stream, dict):
continue
target = stream.get("write_plan_target")
if isinstance(target, dict) and target.get("module_ref") and target.get("expected_sha1"):
if not isinstance(target, dict):
continue
has_internal_handle = bool(target.get("module_ref") and target.get("expected_sha1"))
has_public_selector = bool(target.get("ref") and target.get("module"))
if has_internal_handle or has_public_selector:
return target
return None
@@ -791,10 +795,21 @@ def build_live_report(
issues.append({"code": "live_composed_write_plan_apply_method_mismatch", "actual": route.get("apply_method")})
if hint.get("ready_for_apply_method") is not True:
issues.append({"code": "live_composed_write_plan_hint_not_ready", "hint": hint})
if hint_payload.get("module_ref") != write_plan_target.get("module_ref"):
if write_plan_target.get("module_ref") and hint_payload.get("module_ref") != write_plan_target.get("module_ref"):
issues.append({"code": "live_composed_write_plan_module_ref_mismatch", "expected": write_plan_target.get("module_ref"), "actual": hint_payload.get("module_ref")})
if hint_payload.get("expected_sha1") != write_plan_target.get("expected_sha1"):
if write_plan_target.get("expected_sha1") and hint_payload.get("expected_sha1") != write_plan_target.get("expected_sha1"):
issues.append({"code": "live_composed_write_plan_expected_sha1_mismatch"})
if write_plan_target.get("ref"):
name_resolution = route.get("name_resolution") if isinstance(route.get("name_resolution"), dict) else {}
resolution_selector = name_resolution.get("selector") if isinstance(name_resolution.get("selector"), dict) else {}
if resolution_selector.get("ref") != write_plan_target.get("ref"):
issues.append(
{
"code": "live_composed_write_plan_name_resolution_mismatch",
"expected": write_plan_target.get("ref"),
"actual": resolution_selector.get("ref"),
}
)
else:
steps.append({"name": "metadata.write.plan", "status": "skipped_no_saved_state_target", "from_write_plan_target": False})
else: