Skip to content

Conversation

@fabiencastan
Copy link
Member

@fabiencastan fabiencastan commented Sep 14, 2025

cmdVars has been splitted between: expVars, staticExpVars and cmdLineVars.

  • Command line vars are now only computed during the command line
    generation for the "CommandLineNode".
  • internalFolder is now initialized in the BaseNode, instead of Node
    (even if there is the particular case of "InputNode" which does not need
    it). And its value is computed once in the updateInternals instead of
    redoing the string format again and again.
  • internalFolder is not serialized/deserialized anymore as it is a
    static information. At the beginning, it was designed to be customized
    per node, but this flexibility/complexity seems useless as it has never
    been used over many years. We now use "{nodeCacheFolder}" directly.

@fabiencastan fabiencastan added this to the Meshroom 2026.1.0 milestone Sep 14, 2025
Copy link
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 refactors variable management and expression evaluation to improve performance by separating expression variables from command line variables and optimizing internal folder path computations.

  • Separated expression evaluation (_expVars) from command line generation (createCmdLineVars())
  • Optimized internal folder path computation by removing redundant cache directory joins
  • Added static expression variables for commonly used values like nodeType and nodeSourceCodeFolder

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
meshroom/core/node.py Core refactoring separating expression variables from command line generation, optimizing path computations
meshroom/core/desc/node.py Updated command line building to use new variable separation approach
meshroom/core/attribute.py Updated to use new expression variables and added error handling for malformed expressions
tests/test_nodeCommandLineFormatting.py Updated test assertions to use new _expVars instead of _cmdVars

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Sep 14, 2025

Codecov Report

❌ Patch coverage is 64.28571% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.06%. Comparing base (aabe589) to head (c95c257).
⚠️ Report is 21 commits behind head on develop.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
meshroom/core/node.py 55.35% 25 Missing ⚠️
meshroom/core/attribute.py 57.14% 3 Missing ⚠️
meshroom/core/desc/node.py 0.00% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (64.28%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2888      +/-   ##
===========================================
- Coverage    79.41%   79.06%   -0.36%     
===========================================
  Files           51       51              
  Lines         6987     7007      +20     
===========================================
- Hits          5549     5540       -9     
- Misses        1438     1467      +29     

☔ 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.

Adding cacheDir before an absolution path does nothing.
os.path.join(absPathA, absPathB, filename) gives absPathB/filename.
- Command line vars are now only computed during the command line
generation for the "CommandLineNode".
- internalFolder is now initialized in the BaseNode, instead of Node
(even if there is the particular case of "InputNode" which does not need
it). And its value is computed once in the updateInternals instead of
redoing the string format again and again.
- internalFolder is not serialized/deserialized anymore as it is a
static information. At the beginning, it was designed to be customized
per node, but this flexibility/complexity seems useless as it has never
been used over many years. We now use "{nodeCacheFolder}" directly.
Make a clear difference between the variables needed for expressions and
the ones needed for the command line nodes.
@fabiencastan fabiencastan merged commit 64f1c65 into develop Oct 2, 2025
3 of 4 checks passed
@fabiencastan fabiencastan deleted the dev/expressionVars branch October 2, 2025 15:40
fabiencastan added a commit to alicevision/AliceVision that referenced this pull request Oct 2, 2025
[meshroom] `CameraInit`: Remove `_cmdVars`

As a consequence of alicevision/Meshroom#2888, _cmdVars, which was used in CameraInit, does not exist anymore and node.internalFolder now contains the resolved path. There is thus no need to format it anymore.
fabiencastan added a commit that referenced this pull request Oct 17, 2025
[core] Correctly set `_sourceCodeFolder` in `BaseNode`'s constructor

This PR fixes a regression introduced by the refactoring of the command line variables in #2888, where the static nodeSourceCodeFolder is initialized but never set with the correct value once it becomes available.

This is fixed by initializing _sourceCodeFolder directly in the BaseNode's constructor if the description is available (if it isn't, the node will be in Unknown Node compatibility error anyway). This both simplifies what was done prior to #2888 (where _sourceCodeFolder was correctly set later than it should have been) and ensures that _staticExpVars["nodeSourceCodeFolder"] is initialized with the correct value as well.

Additionally, simple unit tests are added to ensure that static variables are always correctly set. A test InputNode is also added to one of the test plugins to cover all cases.
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.

3 participants