Preserve extension names in module preflight
This commit is contained in:
@@ -401,7 +401,15 @@ def validate_write_preflight(
|
||||
failures.append({"code": "write_preflight_not_ok", "label": label, "path": str(path), "status": report.get("status")})
|
||||
if report.get("failures"):
|
||||
failures.append({"code": "write_preflight_failures_present", "label": label, "path": str(path), "failures": report.get("failures")})
|
||||
for check in ("method_exposed", "effective_path_preflight", "concrete_saved_state_preflight", "name_first_extension_form_preflight", "conflicting_extension_selector_preflight"):
|
||||
for check in (
|
||||
"method_exposed",
|
||||
"effective_path_preflight",
|
||||
"concrete_saved_state_preflight",
|
||||
"name_first_extension_form_preflight",
|
||||
"conflicting_extension_selector_preflight",
|
||||
"name_first_extension_module_preflight",
|
||||
"conflicting_extension_module_selector_preflight",
|
||||
):
|
||||
if check not in checks:
|
||||
failures.append({"code": "write_preflight_check_missing", "label": label, "check": check, "path": str(path)})
|
||||
expect_check(checks, failures, label, path, "method_exposed", {"status": "ok"}, failure_code="write_preflight_check_field_unexpected")
|
||||
@@ -495,6 +503,80 @@ def validate_write_preflight(
|
||||
},
|
||||
failure_code="write_preflight_check_field_unexpected",
|
||||
)
|
||||
name_first_module = checks.get("name_first_extension_module_preflight") if isinstance(checks.get("name_first_extension_module_preflight"), dict) else {}
|
||||
require_name_first_module = bool(
|
||||
(report.get("requirements") or {}).get("name_first_extension_module")
|
||||
if isinstance(report.get("requirements"), dict)
|
||||
else False
|
||||
)
|
||||
if name_first_module.get("status") == "skipped_no_public_extension_module_target":
|
||||
if require_name_first_module:
|
||||
failures.append({
|
||||
"code": "write_preflight_name_first_extension_module_required",
|
||||
"label": label,
|
||||
"path": str(path),
|
||||
})
|
||||
else:
|
||||
expect_check(
|
||||
checks,
|
||||
failures,
|
||||
label,
|
||||
path,
|
||||
"name_first_extension_module_preflight",
|
||||
{
|
||||
"schema": "onec_metadata_write_preflight.v1",
|
||||
"plan_status": "planned",
|
||||
"plan_allowed": True,
|
||||
"name_first": True,
|
||||
},
|
||||
failure_code="write_preflight_check_field_unexpected",
|
||||
)
|
||||
repository_layer = str(name_first_module.get("repository_layer_id") or "")
|
||||
support_layer = str(name_first_module.get("support_layer_id") or "")
|
||||
if not EXTENSION_GUID_LAYER_RE.fullmatch(repository_layer):
|
||||
failures.append({
|
||||
"code": "write_preflight_extension_module_layer_unresolved",
|
||||
"label": label,
|
||||
"path": str(path),
|
||||
"repository_layer_id": repository_layer or None,
|
||||
})
|
||||
if repository_layer != support_layer:
|
||||
failures.append({
|
||||
"code": "write_preflight_extension_module_layer_mismatch",
|
||||
"label": label,
|
||||
"path": str(path),
|
||||
"repository_layer_id": repository_layer or None,
|
||||
"support_layer_id": support_layer or None,
|
||||
})
|
||||
conflicting_extension_module = (
|
||||
checks.get("conflicting_extension_module_selector_preflight")
|
||||
if isinstance(checks.get("conflicting_extension_module_selector_preflight"), dict)
|
||||
else {}
|
||||
)
|
||||
if conflicting_extension_module.get("status") == "skipped_no_public_extension_module_target":
|
||||
if require_name_first_module:
|
||||
failures.append({
|
||||
"code": "write_preflight_extension_module_conflict_check_required",
|
||||
"label": label,
|
||||
"path": str(path),
|
||||
})
|
||||
else:
|
||||
expect_check(
|
||||
checks,
|
||||
failures,
|
||||
label,
|
||||
path,
|
||||
"conflicting_extension_module_selector_preflight",
|
||||
{
|
||||
"schema": "onec_metadata_write_preflight.v1",
|
||||
"status": "blocked",
|
||||
"allowed": False,
|
||||
"resolution_status": "conflict",
|
||||
"error": "extension_selector_conflict",
|
||||
"layer_id": "extension:unresolved",
|
||||
},
|
||||
failure_code="write_preflight_check_field_unexpected",
|
||||
)
|
||||
if require_mcp_initialize:
|
||||
if "mcp.initialize" not in checks:
|
||||
failures.append({"code": "write_preflight_check_missing", "label": label, "check": "mcp.initialize", "path": str(path)})
|
||||
@@ -1666,6 +1748,25 @@ def write_self_test_reports(report_dir: Path, *, base_id: str, composed: bool, s
|
||||
"error": "extension_selector_conflict",
|
||||
"layer_id": "extension:unresolved",
|
||||
},
|
||||
"name_first_extension_module_preflight": {
|
||||
"schema": "onec_metadata_write_preflight.v1",
|
||||
"status": "ready",
|
||||
"allowed": True,
|
||||
"plan_status": "planned",
|
||||
"plan_allowed": True,
|
||||
"repository_layer_id": "extension:11111111-1111-1111-1111-111111111111",
|
||||
"support_layer_id": "extension:11111111-1111-1111-1111-111111111111",
|
||||
"name_first": True,
|
||||
"extension": "test2",
|
||||
},
|
||||
"conflicting_extension_module_selector_preflight": {
|
||||
"schema": "onec_metadata_write_preflight.v1",
|
||||
"status": "blocked",
|
||||
"allowed": False,
|
||||
"resolution_status": "conflict",
|
||||
"error": "extension_selector_conflict",
|
||||
"layer_id": "extension:unresolved",
|
||||
},
|
||||
},
|
||||
"failures": [],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user