Skip to content

Show notif for unconnected compulsory ports and warning in CLI #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rabea-al
Copy link
Contributor

Description

This PR introduces:

  • Error message for unconnected [★] compulsory InPorts during save and compile in the GUI (previously only shown on run).

  • CLI-level warning via enforce_compulsory_ports without blocking compilation.

  • No breaking behavior; compilation and save continue as usual.

image

Pull Request Type

  • Xircuits Core (Jupyterlab Related changes)
  • Xircuits Canvas (Custom RD Related changes)
  • Xircuits Component Library
  • Xircuits Project Template
  • Testing Automation
  • Documentation
  • Others (Please Specify)

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Tests

1. GUI: Save and Compile with unconnected compulsory ports

  1. On the canvas, leave a component that has a [★] compulsory InPort unconnected.

  2. Click Save:

    • You will see a success notification: Workflow saved successfully.
    • You will also see an error notification: Please make sure the [★]COMPULSORY InPorts are connected.
  3. Click Compile:

    • You will see a success notification: Workflow compiled successfully.
    • You will also see the same error notification about unconnected compulsory ports.

2. CLI: Compile with unconnected compulsory ports

  1. From terminal, run:
    xircuits compile path/to/workflow.xircuits
  2. If the workflow contains any unconnected [★] compulsory InPorts:
    • You will see a CLI warning:
      Warning: COMPULSORY InPorts not connected.
      
    • Compilation will still proceed successfully and generate the .py file.

Tested on? Specify Version.

  • Windows
  • Linux Fedora
  • Mac
  • Others (State here -> xxx )

Copy link

Binder 👈 Launch a binder notebook on branch rabea-al/xircuits/compulsory-ports-check

@rabea-al rabea-al force-pushed the compulsory-ports-check branch from 6c712fc to 2c1c068 Compare July 17, 2025 11:38
Copy link
Member

@MFA-X-AI MFA-X-AI left a comment

Choose a reason for hiding this comment

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

I'm noticing that the CLI tests are failing here. Could you see what's up?

Copy link
Member

@MFA-X-AI MFA-X-AI left a comment

Choose a reason for hiding this comment

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

One thing I'm noticing here is that the check only happens if the compulsory node is on the main line. For compulsory components attached to Event nodes, for example, it wouldn't fire.

image

It's pretty significant since in the Agents lib, we do events a lot.

One other use case that I need to confirm is whether we want to fire this warning for hanging compulsory ports / placeholders. My intuition is that it shouldn't? But let me get back to you on this on a weekday.

@rabea-al
Copy link
Contributor Author

Thanks for the observation. I believe the issue is not in this PR itself, but in the current validation function getAllNodesFromStartToFinish(). This function only checks nodes in the main workflow chain and ignores any nodes that are not part of it (e.g., those connected via Event nodes).

As a result, any component with compulsory ports outside the main flow is currently skipped without warning.

I propose updating the validation logic to iterate through all nodes on the canvas, but only raise warnings for nodes that are connected on at least one side (in or out).
If a node is completely disconnected, we treat it as a placeholder, and skip warnings for it.

@MFA-X-AI
Copy link
Member

MFA-X-AI commented Jul 21, 2025

I propose updating the validation logic to iterate through all nodes on the canvas, but only raise warnings for nodes that are connected on at least one side (in or out)

This sounds good.

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.

2 participants