Skip to content

feat: validate graph connections during drag - #75

Merged
philippjfr merged 2 commits into
mainfrom
feat/port_validation
Sep 25, 2026
Merged

philippjfr merged 2 commits into
mainfrom
feat/port_validation

Conversation

@philippjfr

Copy link
Copy Markdown
Contributor

Description

I added opt-in browser checks for direction, type, input capacity, duplicates, and cycles, plus Python validators that evaluate candidate handles when a drag starts and show rejection reasons in the canvas. This lets applications prevent invalid interactive connections before creating an edge; Python validators do not restrict programmatic edges, so state-dependent rules still need checking in edge_added. I added a runnable demo, a how-to guide, and API/Playwright coverage. No new dependencies or migration steps are required.

To reproduce, run PYTHONPATH=src pixi run panel serve examples/connection_validation.py --show, then drag Source.text to Transform.text (allowed), Number.value to Transform.text (type mismatch), and Source.text to Publish.text (Python rejection).

Before: invalid drags could create edges and required application-side rollback. After: rejected candidates show their reason during dragging and the browser blocks the drop. The demo above shows both states of the new handle feedback.

Verification: pixi run compile, PYTHON_GIL=1 PYTHONPATH=src pixi run pytest -q (169 passed, 4 skipped), pixi run -e lint ruff check src/panel_reactflow/base.py tests/test_api.py tests/ui/test_ui.py, pixi run -e docs docs-build, and commit hooks passed. Two focused Playwright tests reported 2 passed, 35 deselected; the process then timed out because Bokeh session-cleanup callbacks continued after pytest reported its result. The full browser suite did not finish here.

AI Disclosure

Tool & Model: Kilo Code + openai/gpt-6-sol.
Usage: AI drafted the connection-validation how-to guide, linked it in the docs, reviewed the existing feature changes, ran verification, and prepared this PR.

  • I have tested all AI-generated content in my PR.
  • I take responsibility for all AI-generated content in my PR.

Checklist

  • Tests added and are passing (Python suite and focused browser tests; full browser suite not completed due to cleanup timeout)
  • Added documentation

@philippjfr
philippjfr merged commit 0fd0127 into main Sep 25, 2026
16 of 17 checks passed
@philippjfr
philippjfr deleted the feat/port_validation branch September 25, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant