Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Merged
Changes from 1 commit
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
Prev Previous commit
Skip resources conditionally evaluating to False
  • Loading branch information
simonrw committed Oct 7, 2025
commit ebf3c17d2dfe12ea0b70151e9fa04f1712b7449f

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise: Glad the new engine is easily modifiable.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
NodeProperties,
NodeProperty,
NodeResource,
NodeResources,
NodeTemplate,
Nothing,
NothingType,
Expand Down Expand Up @@ -1170,6 +1171,20 @@ def _resolve_resource_condition_reference(self, reference: TerminalValue) -> Pre
after = after_delta.after
return PreprocEntityDelta(before=before, after=after)

def visit_node_resources(self, node_resources: NodeResources):
"""
Skip resources where they conditionally evaluate to False
"""
for node_resource in node_resources.resources:
if not is_nothing(node_resource.condition_reference):
condition_delta = self._resolve_resource_condition_reference(
node_resource.condition_reference
)
condition_after = condition_delta.after
if condition_after is False:
continue
self.visit(node_resource)

def visit_node_resource(
self, node_resource: NodeResource
) -> PreprocEntityDelta[PreprocResource, PreprocResource]:
Expand Down Expand Up @@ -1280,6 +1295,14 @@ def visit_node_outputs(
before: list[PreprocOutput] = []
after: list[PreprocOutput] = []
for node_output in node_outputs.outputs:
if not is_nothing(node_output.condition_reference):
condition_delta = self._resolve_resource_condition_reference(
node_output.condition_reference
)
condition_after = condition_delta.after
if condition_after is False:
continue

output_delta: PreprocEntityDelta[PreprocOutput, PreprocOutput] = self.visit(node_output)
output_before = output_delta.before
output_after = output_delta.after
Expand Down
Loading