🐛 Do not require the children of an omitted optional namespace - #802
Open
elinscott wants to merge 1 commit into
Open
🐛 Do not require the children of an omitted optional namespace#802elinscott wants to merge 1 commit into
elinscott wants to merge 1 commit into
Conversation
An optional namespace input left entirely unfilled reported every one of its children as a missing required input, so a grouped optional input (a `TypedDict | None`, for instance) could not be omitted: `check_before_run` raised for every graph that did not supply it. - Skip the recursion into a namespace that is not itself required and carries no value and no link anywhere in its subtree. - Keep reporting the missing children of a namespace that is partially supplied, and of one that is required. - Cover the empty-optional, partially-filled, linked-child and empty-required cases in `tests/test_validation.py`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
elinscott
force-pushed
the
upstream-optional-namespace
branch
from
July 31, 2026 10:12
3beca8e to
e108276
Compare
elinscott
added a commit
to elinscott/aiida-workgraph
that referenced
this pull request
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An optional namespace input cannot be omitted. If a task declares a grouped input that may be left out entirely — a
TypedDict | Noneparameter, for instance —check_before_run()wrongly reports every one of that namespace's children as a missing required input:windowhas aNonedefault and the function handles its absence, but the graph will not run:The namespace socket itself is correctly marked
required = False; only its children are required.find_missing_inputsrecurses into the children without consulting the parent, so their requiredness is read as absolute rather than conditional on the namespace being supplied at all.Changes
WorkGraph.is_socket_provided, which performs this "anything in the subtree" test (doing so recursively to catch namespaces whose child is linked from an upstream task).Testing
tests/test_validation.pycovers four cases:Reverting the source change leaves the last three passing but fails the first.