fix: narrow binding validation to not change diagnostic contract for non-platform sources

This commit is contained in:
lda
2026-06-13 18:33:04 +07:00 Verified
parent a24f36a80e
commit b6e90c2738
2 changed files with 16 additions and 20 deletions
+14 -17
View File
@@ -29,24 +29,21 @@ def validate_deployment_dependencies(
else: else:
bound_source_id = bindings.get(required.logical_source) bound_source_id = bindings.get(required.logical_source)
if bound_source_id is None: if bound_source_id is None:
if not sources_by_id: diagnostics.append(
bound_source_id = required.logical_source _diagnostic(
else: code="binding_missing",
diagnostics.append( logical_ref=logical_ref,
_diagnostic( required=required,
code="binding_missing", message=(
logical_ref=logical_ref, f"No binding exists for logical source "
required=required, f"{required.logical_source!r}."
message=( ),
f"No binding exists for logical source " repair_hint=(
f"{required.logical_source!r}." "Bind the logical source to a compatible concrete source."
), ),
repair_hint=(
"Bind the logical source to a compatible concrete source."
),
)
) )
continue )
continue
source = sources_by_id.get(bound_source_id) source = sources_by_id.get(bound_source_id)
if source is None: if source is None:
+2 -3
View File
@@ -234,7 +234,7 @@ def test_platform_source_requirement_does_not_need_binding() -> None:
assert diagnostics == [] assert diagnostics == []
def test_missing_platform_source_still_reports_source_missing() -> None: def test_missing_platform_source_still_reports_binding_missing() -> None:
artifact = artifact_with( artifact = artifact_with(
required_capability(logical_source="wf.std", capability_name="replace") required_capability(logical_source="wf.std", capability_name="replace")
) )
@@ -251,5 +251,4 @@ def test_missing_platform_source_still_reports_source_missing() -> None:
sources=[], sources=[],
) )
assert [diagnostic.code for diagnostic in diagnostics] == ["source_missing"] assert [diagnostic.code for diagnostic in diagnostics] == ["binding_missing"]
assert diagnostics[0].bound_source == "wf.std"