fix: narrow binding validation to not change diagnostic contract for non-platform sources
This commit is contained in:
@@ -29,24 +29,21 @@ def validate_deployment_dependencies(
|
||||
else:
|
||||
bound_source_id = bindings.get(required.logical_source)
|
||||
if bound_source_id is None:
|
||||
if not sources_by_id:
|
||||
bound_source_id = required.logical_source
|
||||
else:
|
||||
diagnostics.append(
|
||||
_diagnostic(
|
||||
code="binding_missing",
|
||||
logical_ref=logical_ref,
|
||||
required=required,
|
||||
message=(
|
||||
f"No binding exists for logical source "
|
||||
f"{required.logical_source!r}."
|
||||
),
|
||||
repair_hint=(
|
||||
"Bind the logical source to a compatible concrete source."
|
||||
),
|
||||
)
|
||||
diagnostics.append(
|
||||
_diagnostic(
|
||||
code="binding_missing",
|
||||
logical_ref=logical_ref,
|
||||
required=required,
|
||||
message=(
|
||||
f"No binding exists for logical source "
|
||||
f"{required.logical_source!r}."
|
||||
),
|
||||
repair_hint=(
|
||||
"Bind the logical source to a compatible concrete source."
|
||||
),
|
||||
)
|
||||
continue
|
||||
)
|
||||
continue
|
||||
|
||||
source = sources_by_id.get(bound_source_id)
|
||||
if source is None:
|
||||
|
||||
@@ -234,7 +234,7 @@ def test_platform_source_requirement_does_not_need_binding() -> None:
|
||||
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(
|
||||
required_capability(logical_source="wf.std", capability_name="replace")
|
||||
)
|
||||
@@ -251,5 +251,4 @@ def test_missing_platform_source_still_reports_source_missing() -> None:
|
||||
sources=[],
|
||||
)
|
||||
|
||||
assert [diagnostic.code for diagnostic in diagnostics] == ["source_missing"]
|
||||
assert diagnostics[0].bound_source == "wf.std"
|
||||
assert [diagnostic.code for diagnostic in diagnostics] == ["binding_missing"]
|
||||
|
||||
Reference in New Issue
Block a user