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
1 change: 1 addition & 0 deletions packages/gds-framework/gds/compiler/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def _default_block_compiler(block: AtomicBlock) -> BlockIR:
"""Default block compiler — extracts name and interface slots."""
return BlockIR(
name=block.name,
block_type=getattr(block, "kind", ""),
signature=(
_ports_to_sig(block.interface.forward_in),
_ports_to_sig(block.interface.forward_out),
Expand Down
12 changes: 11 additions & 1 deletion packages/gds-framework/gds/verification/generic_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,23 @@ def check_g001_domain_codomain_matching(system: SystemIR) -> list[Finding]:
def check_g002_signature_completeness(system: SystemIR) -> list[Finding]:
"""G-002: Every block must have at least one non-empty input slot
and at least one non-empty output slot.

BoundaryAction blocks (block_type == "boundary") are exempt from the
input requirement — they have no inputs by design, since they model
exogenous signals entering the system from outside.
"""
findings = []
for block in system.blocks:
fwd_in, fwd_out, bwd_in, bwd_out = block.signature
has_input = bool(fwd_in) or bool(bwd_in)
has_output = bool(fwd_out) or bool(bwd_out)
has_required = has_input and has_output

# BoundaryAction blocks have no inputs by design — only check outputs
is_boundary = block.block_type == "boundary"
if is_boundary:
has_required = has_output
else:
has_required = has_input and has_output

missing = []
if not has_input:
Expand Down
51 changes: 51 additions & 0 deletions packages/gds-framework/tests/test_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,57 @@ def test_missing_output_flags(self):
failed = [f for f in findings if not f.passed]
assert len(failed) >= 1

def test_boundary_action_no_inputs_passes(self):
"""BoundaryAction blocks have no inputs by design — G-002 should pass."""
sys = SystemIR(
name="Test",
blocks=[
BlockIR(
name="Sensor",
block_type="boundary",
signature=("", "Temperature", "", ""),
),
],
wirings=[],
)
findings = check_g002_signature_completeness(sys)
assert len(findings) == 1
assert findings[0].passed

def test_boundary_action_no_outputs_still_fails(self):
"""BoundaryAction with no outputs should still fail G-002."""
sys = SystemIR(
name="Test",
blocks=[
BlockIR(
name="BadBoundary",
block_type="boundary",
signature=("", "", "", ""),
),
],
wirings=[],
)
findings = check_g002_signature_completeness(sys)
assert len(findings) == 1
assert not findings[0].passed

def test_non_boundary_no_inputs_still_fails(self):
"""Non-boundary blocks without inputs should still fail G-002."""
sys = SystemIR(
name="Test",
blocks=[
BlockIR(
name="Orphan",
block_type="policy",
signature=("", "Signal", "", ""),
),
],
wirings=[],
)
findings = check_g002_signature_completeness(sys)
assert len(findings) == 1
assert not findings[0].passed


# ── G-003: Direction consistency ─────────────────────────────

Expand Down