fix: Coerce node and edge types before syncing updates - #76
Merged
Merged
Conversation
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 fixed a server-side serialization error when
node_typesoredge_typesare assigned after construction. The constructor convertsNodeTypeandEdgeTypedescriptors to JSON dicts, but on a later update Panel synced the raw value to the frontend before the_normalize_specswatcher replaced it, so a descriptor'sschemaclass reached bokeh and the patch failed withSerializationError: can't serialize <class 'param.parameterized.ParameterizedMetaclass'>. panel-flowdash hits this whenever lazily loaded components rebuild the canvas's node types._process_param_changenow coercesnode_typesandedge_typeswith_coerce_spec_map, so only JSON descriptors are synced regardless of watcher order._normalize_specsnow accepts multiple events. It watches both parameters inargsmode, soflow.param.update(node_types=..., edge_types=...)raisedTypeError: _normalize_specs() takes 2 positional arguments but 3 were given.Serve this and click the button. Before, the server logs
SerializationError: can't serialize <class 'param.parameterized.ParameterizedMetaclass'>; after, the update is applied without error.I added
test_updated_node_types_reach_model_as_descriptorsandtest_node_and_edge_types_updated_together, both of which fail onmainand pass with this change. The non-UI test suite and pre-commit pass, as do the panel-flowdash unit and UI suites against this branch.AI Disclosure
Tool & Model: Kilo Code + Claude Opus 5.5
Usage: Traced the serialization error from panel-flowdash, implemented the fix and tests, and drafted this description; I reviewed the diff and ran the listed checks.
Checklist