fix: Reject connections whose current value the target refuses - #44
Merged
Merged
Conversation
3 tasks
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.
Description
I made connection validation reject an untyped output whose current value the target input would refuse, and made a connection whose first propagated value is refused roll back instead of staying wired. An output registered through
provideswithout atype(as the built-in Select does) passed the static type check against any input, so the drag indicator showed a typed input such asparam.Integeras valid; after the drop the first value failed in the target component, the error was only reported throughon_error, and the edge stayed on the canvas and in the graph with the node state holding the rejected value.InputPortnow keeps the component's ownparameterwhen ports are introspected from a Viewer class, andInputPort.check_value()runs that parameter's validation without assigning anything.DataflowGraph.validate_connectionchecks the source's current value against the target input after the static checks, so drag validation marks the handle invalid with the parameter's reason, for example "Input 'start_year' rejects the current value of 'selected': Integer parameter 'app.start_year' must be an integer, not <class 'str'>."DataflowGraph.add_edgenow returns "Connection rejected: ..." when the initial propagation raises, removing the watcher and edge and restoring the target's previous value. This covers targets without an introspected parameter, andFlowDashalready removes a rejected edge from the canvas.Behavior change: a connection whose first value is rejected used to be kept and reported through
on_error; it is now refused. Values that change after a connection is made are still reported throughon_error, since their compatibility cannot be known in advance.Before,
connectreturnedTrue, logged a runtime wiring error, and left the edge in place; draggingpickedontostart_yearshowed the handle as valid. After,connectreturns the rejection reason, and the drag marksstart_yearinvalid with that reason as its tooltip.I added
test_initial_propagation_failure_rejects_connection(replacingtest_error_on_initial_propagation, which asserted the old behavior),test_current_value_checked_against_input_parameter,test_unset_output_is_not_value_checked,test_untyped_output_with_rejected_value_is_refused,test_untyped_output_connects_once_its_value_fits, and the Playwright testtest_editor_drag_validation_rejects_untyped_value_of_wrong_type. All but the last compatibility test fail onmain.pixi run test(334 passed, 2 skipped), the UI suite (3 passed), and pre-commit pass.AI Disclosure
Tool & Model: Kilo Code + Claude Opus 5.5
Usage: Diagnosed the report from the complex dataflow example, implemented the fix and tests, and drafted this description; I reviewed the diff and ran the listed checks.
Checklist