diff --git a/concore_cli/commands/validate.py b/concore_cli/commands/validate.py
index c8972d7..703c430 100644
--- a/concore_cli/commands/validate.py
+++ b/concore_cli/commands/validate.py
@@ -48,8 +48,6 @@ def _classify_message(message, bucket_name):
return {"error_type": "invalid_node_label_format"}
if message.startswith("Node '") and message.endswith("has invalid format"):
return {"error_type": "invalid_node_label_format"}
- if message.startswith("Node '") and message.endswith("has no filename"):
- return {"error_type": "missing_node_filename"}
if message.startswith("Node '") and message.endswith("has unusual file extension"):
return {"error_type": "unusual_file_extension"}
if message.startswith("Missing source file:"):
@@ -253,20 +251,23 @@ def finalize():
warnings.append(f"Node '{label}' has invalid format")
else:
nodeId_part, filename = parts
- source_nodes[filename] = node_id
- if not filename:
- errors.append(f"Node '{label}' has no filename")
- elif not any(
- filename.endswith(ext)
- for ext in [".py", ".cpp", ".m", ".v", ".java"]
- ):
- warnings.append(
- f"Node '{label}' has unusual file extension"
- )
- elif source_root.exists():
- file_path = source_root / filename
- if not file_path.exists():
- errors.append(f"Missing source file: {filename}")
+ # A node with no filename ('IN:' / 'OUT:') is a
+ # port-only input/output source: nothing to check.
+ if filename:
+ source_nodes[filename] = node_id
+ if not any(
+ filename.endswith(ext)
+ for ext in [".py", ".cpp", ".m", ".v", ".java"]
+ ):
+ warnings.append(
+ f"Node '{label}' has unusual file extension"
+ )
+ elif source_root.exists():
+ file_path = source_root / filename
+ if not file_path.exists():
+ errors.append(
+ f"Missing source file: {filename}"
+ )
else:
warnings.append(f"Node {node_id} has no label")
except Exception as e:
diff --git a/mkconcore.py b/mkconcore.py
index a1f44ef..9002a6b 100644
--- a/mkconcore.py
+++ b/mkconcore.py
@@ -350,7 +350,9 @@ def cleanup_script_files():
if ':' in node_label:
container_part, source_part = node_label.split(':', 1)
safe_name(container_part, f"Node container name '{container_part}'")
- source_part = safe_relpath(source_part, f"Node source file '{source_part}'")
+ # A node may have no source file (port endpoints such as 'IN:' / 'OUT:').
+ if source_part:
+ source_part = safe_relpath(source_part, f"Node source file '{source_part}'")
node_label = f"{container_part}:{source_part}"
else:
safe_name(node_label, f"Node label '{node_label}'")
diff --git a/tests/test_graph.py b/tests/test_graph.py
index b26859c..581ff64 100644
--- a/tests/test_graph.py
+++ b/tests/test_graph.py
@@ -96,22 +96,28 @@ def test_validate_broken_edges(self):
self.assertIn("Validation failed", result.output)
self.assertIn("Edge references non-existent target node", result.output)
- def test_validate_node_missing_filename(self):
+ def test_validate_port_only_node_is_valid(self):
content = """
- n0:
+ IN:
+
+ OUT:
+
+
+ 0x1000_a
+
"""
- filepath = self.create_graph_file("bad_node.graphml", content)
+ filepath = self.create_graph_file("port_only.graphml", content)
result = self.runner.invoke(cli, ["validate", filepath])
- self.assertIn("Validation failed", result.output)
- self.assertIn("has no filename", result.output)
+ self.assertNotIn("has no filename", result.output)
+ self.assertNotIn("Validation failed", result.output)
def test_validate_unsafe_node_label(self):
content = """
diff --git a/tests/test_port_only_nodes.py b/tests/test_port_only_nodes.py
new file mode 100644
index 0000000..f86d4f4
--- /dev/null
+++ b/tests/test_port_only_nodes.py
@@ -0,0 +1,59 @@
+"""Nodes with no source file ("IN:", "OUT:") must not stop a study from building.
+
+Port-only nodes are used by the distributed / ZMQ and measurement workflows
+in this repository. mkconcore.py used to reject them while validating node
+labels ("Node source file '' cannot be empty"), although the rest of the
+generator handles a node without a source file.
+"""
+
+import re
+import subprocess
+import sys
+from pathlib import Path
+
+import pytest
+
+REPO_ROOT = Path(__file__).resolve().parent.parent
+LABEL_RE = re.compile(r"]*>([^<]*)")
+
+
+def _has_port_only_node(graphml):
+ text = graphml.read_text(errors="ignore")
+ for label in LABEL_RE.findall(text):
+ label = re.sub(r"\s+", " ", label)
+ if ":" in label and not label.split(":", 1)[1].strip():
+ return True
+ return False
+
+
+PORT_ONLY_WORKFLOWS = sorted(
+ p for p in REPO_ROOT.rglob("*.graphml") if _has_port_only_node(p)
+)
+
+
+def test_port_only_workflows_were_found():
+ assert PORT_ONLY_WORKFLOWS, "no workflow with a port-only node found"
+
+
+@pytest.mark.parametrize("build_type", ["posix", "windows", "docker"])
+@pytest.mark.parametrize(
+ "workflow",
+ PORT_ONLY_WORKFLOWS,
+ ids=[str(p.relative_to(REPO_ROOT)) for p in PORT_ONLY_WORKFLOWS],
+)
+def test_workflow_with_port_only_node_builds(tmp_path, workflow, build_type):
+ result = subprocess.run(
+ [
+ sys.executable,
+ str(REPO_ROOT / "mkconcore.py"),
+ str(workflow),
+ str(workflow.parent),
+ str(tmp_path / "study"),
+ build_type,
+ ],
+ capture_output=True,
+ text=True,
+ cwd=str(REPO_ROOT),
+ timeout=120,
+ )
+ assert result.returncode == 0, result.stdout + result.stderr