Skip to content

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

Merged
MFA-X-AI merged 3 commits into
XpressAI:masterfrom
rabea-al:compulsory-ports-check
Jul 23, 2025
Merged

MFA-X-AI merged 3 commits into
XpressAI:masterfrom
rabea-al:compulsory-ports-check

Conversation

@rabea-al

Copy link
Copy Markdown
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 )

@github-actions

Copy link
Copy Markdown

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

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

Copy link
Copy Markdown
Member

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?

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

Copy link
Copy Markdown
Member

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
Copy Markdown
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

MFA-X-AI commented Jul 21, 2025 •

Copy link
Copy Markdown
Member

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.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great job, can confirm it fires the warning for both front and backend, even in events. Merging!

@MFA-X-AI
MFA-X-AI merged commit 80381dc into XpressAI:master Jul 23, 2025
@MFA-X-AI MFA-X-AI changed the title Show notif for unconnected compulsory ports and warning in CLI ✨ Show notif for unconnected compulsory ports and warning in CLI Jul 24, 2025
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