Skip to content

[MATLAB] Fix CI for R2026b, test from R2024b, and fix Clib call errors - #2187

Open
ssun30 wants to merge 5 commits into
Cantera:mainfrom
ssun30:matlab-cxx17-flag
Open

ssun30 wants to merge 5 commits into
Cantera:mainfrom
ssun30:matlab-cxx17-flag

Conversation

@ssun30

@ssun30 ssun30 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Changes proposed in this pull request

Fixes the MATLAB CI jobs that started failing with MATLAB R2026b, moves CI to R2024b as the oldest supported release, and fixes several MATLAB methods that called renamed CLib functions or passed the wrong indices.

Interface build

  • Compile the MATLAB C++ interface with -std=c++17 on macOS and Linux. With R2026b, the clibgen build command on macOS no longer includes a -std flag, so Xcode 15's clang falls back to C++98 and fails on the MATLAB Data API headers. This broke "MATLAB latest on macos-14".

Unit tests

  • Run the unit tests in-process by default. Out-of-process, Cantera's error message is sometimes lost between the call that failed and the call that reads the message, so tests that check error text fail intermittently with <no Cantera error> (seen with R2026b on macOS and Linux). Cantera stores error messages per thread, and the out-of-process helper does not appear to run both calls on the same thread.
  • Temporary: on Linux, the matlab and Coverage jobs still run out-of-process. MATLAB cannot load the library built with system dependencies in-process there: the libcurl bundled with MATLAB lacks symbols (CURL_OPENSSL_4) required by the system HDF5. In-process testing for Linux is planned to be resolved in Matlab auto configure #2177.

CI matrix

  • Test R2024b instead of R2024a, since R2024b is now the oldest planned release supported by the MATLAB toolbox. All OS images now run both R2024b and the latest release (plus latest on macos-26).

MATLAB interface fixes

  • Pass Cantera error text to error as a format argument, so messages containing % or \ are shown correctly.
  • Fix calls to renamed or incorrect CLib functions.

AI Statement (required)

  • Extensive use of generative AI. Significant portions of code or documentation were generated with AI, including logic and implementation decisions. All generated code and documentation were reviewed and understood by the contributor.

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • AI Statement is included
  • The pull request is ready for review

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 18.75000% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.44%. Comparing base (096972d) to head (6f2e50e).

Files with missing lines Patch % Lines
interfaces/matlab/Base/+ct/Mixture.m 0.00% 4 Missing ⚠️
interfaces/matlab/Utility/+ct/buildInterface.m 0.00% 4 Missing ⚠️
interfaces/matlab/Base/+ct/ThermoPhase.m 0.00% 2 Missing ⚠️
interfaces/matlab/+ct/+impl/getString.m 50.00% 1 Missing ⚠️
interfaces/matlab/+ct/+oneD/Domain.m 0.00% 1 Missing ⚠️
interfaces/matlab/+ct/+zeroD/ReactorBase.m 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2187      +/-   ##
==========================================
- Coverage   77.45%   77.44%   -0.01%     
==========================================
  Files         470      470              
  Lines       57184    57188       +4     
  Branches     9195     9195              
==========================================
  Hits        44292    44292              
- Misses       9823     9827       +4     
  Partials     3069     3069              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ssun30
ssun30 force-pushed the matlab-cxx17-flag branch from 01d2af9 to 8834f10 Compare October 8, 2026 00:10
@ssun30 ssun30 changed the title [MATLAB] Specify C++17 standard when building the interface [MATLAB] Fix CI for R2026b, test from R2024b, and fix Clib call errors Oct 8, 2026
@ssun30
ssun30 marked this pull request as ready for review October 8, 2026 01:23
@ssun30
ssun30 force-pushed the matlab-cxx17-flag branch from 8834f10 to 9fc1da4 Compare October 8, 2026 01:37
@ssun30
ssun30 force-pushed the matlab-cxx17-flag branch from 9fc1da4 to 14c3dc6 Compare October 22, 2026 05:39
@speth

speth commented Nov 22, 2026

Copy link
Copy Markdown
Member

Hi @ssun30. What's the status of this PR -- is it ready for review? Can you rebase and resolve the merge conflicts?

ssun30 and others added 5 commits November 23, 2026 15:06
With MATLAB R2026b, the clibgen build command on macOS no longer
includes a -std flag. With Xcode 15, clang then defaults to C++98 and
fails to compile the MATLAB Data API headers, breaking the "MATLAB
latest on macos-14" CI job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Avoids issues with percent signs and backslashes in error messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix MATLAB methods that called renamed or incorrect CLib functions
(Domain.domainType, ReactorBase.U, ThermoPhase.chemPotentials and
electrochemPotentials, Mixture.nAtoms), and the Mixture mole getters,
which passed one-based indices.

ctTestFlowReactor2 now fails if no error is raised and also checks
mixing reactor types. ctTestPureFluid tests below the triple point using
minTemp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
R2024b is now the oldest release supported by the MATLAB toolbox. Test
it on every OS image instead of R2024a, which removes the combinations
excluded for R2024a (Cantera#2035, Cantera#2152) and the separate windows-2022 job
with its micromamba dependencies. On windows-2025, R2024b needs the
Visual C++ 2022 build tools, which are installed separately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In out-of-process mode, Cantera error messages can be lost between calls,
which makes tests that check error text fail intermittently. Tests now
load Cantera in-process by default; CANTERA_MATLAB_TEST_EXECUTION_MODE
selects 'outofprocess' instead.

On Linux, MATLAB cannot load the library built with system dependencies
in-process (the libcurl bundled with MATLAB lacks symbols required by the
system HDF5), so the 'matlab' and coverage jobs keep running the tests
out-of-process there for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ssun30

ssun30 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @ssun30. What's the status of this PR -- is it ready for review? Can you rebase and resolve the merge conflicts?

Thanks @speth . Yes, this is ready for review. I rebased it onto the current main. All MATLAB jobs will now pass with the only failure being the Intel-oneAPI job, which is caused by Ubuntu 26.04 deprecating apt-key.

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