Skip to content

[core] attribute: Fix hasOutputConnections for ListAttributes#2731

Merged
cbentejac merged 1 commit intodevelopfrom
fix/listOutputConnections
Jun 2, 2025
Merged

[core] attribute: Fix hasOutputConnections for ListAttributes#2731
cbentejac merged 1 commit intodevelopfrom
fix/listOutputConnections

Conversation

@cbentejac
Copy link
Copy Markdown
Contributor

Description

This PR fixes an issue seemingly introduced in cc4e1a2 that generates errors and leaves a CompatibilityNode in an unstable state when upgrading it.

Below is an example of the generated error when upgrading a StructureFromMotion node that was in compatibility mode (in a generic photogrammetry graph):

An error occurred executing the property metacall 1 on property "hasOutputConnections" of ListAttribute(0x1f4cad31db0)
Traceback (most recent call last):
  File "C:\dev\meshroom\meshroom\core\attribute.py", line 768, in hasOutputConnections
    return next((edge for edge in self.node.graph.edges.values() if edge.src in self._value), None) is not None or \
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\dev\meshroom\meshroom\core\attribute.py", line 768, in <genexpr>
    return next((edge for edge in self.node.graph.edges.values() if edge.src in self._value), None) is not None or \
                                                                    ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'in <string>' requires string as left operand, not Attribute

image

This was caused by the comparison between an Attribute object (edge.src) and self._value with the in operator.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in determining output connections for ListAttributes during node upgrades.

  • Updated the edge comparison logic from "in" to "==" to avoid type errors when comparing Attribute objects.
  • Ensures that the compatibility node remains stable by correctly checking connections.
Comments suppressed due to low confidence (1)

meshroom/core/attribute.py:768

  • Replacing 'edge.src in self._value' with 'edge.src == self' fixes the TypeError, but please confirm that comparing equality with self aligns with the intended logic for identifying output connections.
return next((edge for edge in self.node.graph.edges.values() if edge.src == self), None) is not None or \

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.11%. Comparing base (09b4797) to head (a293c67).
Report is 4 commits behind head on develop.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
meshroom/core/attribute.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2731   +/-   ##
========================================
  Coverage    77.11%   77.11%           
========================================
  Files           41       41           
  Lines         6166     6166           
========================================
  Hits          4755     4755           
  Misses        1411     1411           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cbentejac cbentejac merged commit 7d1ebe6 into develop Jun 2, 2025
4 of 5 checks passed
@cbentejac cbentejac deleted the fix/listOutputConnections branch June 2, 2025 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants