Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion concore_cli/commands/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _build_entries(bucket_name, messages, source_nodes):
if node_id:
entry["node_id"] = node_id
elif message.startswith("Node ") and message.endswith(" has no label"):
entry["node_id"] = message[5:-9]
entry["node_id"] = message[5 : -len(" has no label")]
elif message.startswith("Edge references non-existent source node:"):
entry["node_id"] = message.split(":", 1)[1].strip()
elif message.startswith("Edge references non-existent target node:"):
Expand Down
26 changes: 26 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,32 @@ def test_validate_json_output_for_missing_source_file(self):
self.assertEqual(payload["errors"][0]["error_type"], "missing_source_file")
self.assertEqual(payload["errors"][0]["node_id"], "n1")

def test_validate_json_output_for_node_without_label(self):
with self.runner.isolated_filesystem(temp_dir=self.temp_dir):
Path("src").mkdir()
Path("workflow.graphml").write_text(
"""<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:y="http://www.yworks.com/xml/graphml">
<graph id="G" edgedefault="directed">
<node id="n1"></node>
</graph>
</graphml>
"""
)

result = self.runner.invoke(
cli, ["validate", "workflow.graphml", "--format", "json"]
)

payload = json.loads(result.output)
warning = next(
w
for w in payload["warnings"]
if w["error_type"] == "missing_node_label"
)
self.assertEqual(warning["node_id"], "n1")
self.assertEqual(payload["summary"]["nodes_affected"], ["n1"])

def test_status_command(self):
result = self.runner.invoke(cli, ["status"])
self.assertEqual(result.exit_code, 0)
Expand Down
Loading