Skip to content

Javascript solver stats#690

Merged
K20shores merged 4 commits intomainfrom
javascript_solver_stats
Dec 2, 2025
Merged

Javascript solver stats#690
K20shores merged 4 commits intomainfrom
javascript_solver_stats

Conversation

@K20shores
Copy link
Copy Markdown
Collaborator

@K20shores K20shores commented Dec 1, 2025

Follow on to #687

Returns the solver stats to javascript and allows them to be used. Adds a test for micm, also fixes something in package.json that was preventing all tests from running. The node-bindings package is now used to import the addon so we don't have to change the path for debug/release, which probably should have been addressed in #647

closes #646

- Solver stats are now returned to javascript
- The binding is now imported using the bindings package, so switching
  between debug/release no longer requires changes to the code
- added micm tests
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 1, 2025

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 92.04545% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.52%. Comparing base (5a18e57) to head (80399c4).

Files with missing lines Patch % Lines
javascript/micm/solver_result.js 90.66% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #690      +/-   ##
==========================================
+ Coverage   81.44%   81.52%   +0.08%     
==========================================
  Files         113      114       +1     
  Lines        9840     9921      +81     
==========================================
+ Hits         8014     8088      +74     
- Misses       1826     1833       +7     
Flag Coverage Δ
cpp_fortran 79.71% <ø> (ø)
javascript 92.12% <92.04%> (-0.08%) ⬇️
python 82.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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 adds JavaScript solver statistics support to the MUSICA library, enabling JavaScript users to access detailed solver performance metrics after each solve operation. This brings the JavaScript bindings closer to feature parity with the Python bindings.

Key Changes

  • Implements SolverResult, SolverStats, and SolverState classes in JavaScript to mirror Python functionality
  • Updates C++ wrapper to return solver results instead of void from the Solve() method
  • Switches to using the bindings npm package for more robust native addon loading
  • Adds comprehensive unit tests validating solver result structure and statistics
  • Removes debug print statement from Python integration tests

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
python/test/integration/test_analytical.py Removed debug print statement
package.json Added bindings dependency and quoted test glob pattern
package-lock.json Added bindings and file-uri-to-path package entries
javascript/tests/unit/micm/micm.test.js New comprehensive unit tests for MICM class and solver results
javascript/src/micm/solver_result_wrapper.h New header defining wrapper for converting C++ solver results to JavaScript
javascript/src/micm/solver_result_wrapper.cpp Implementation of solver result conversion to JavaScript objects
javascript/src/micm/micm_wrapper.h Updated Solve() signature to return micm::SolverResult
javascript/src/micm/micm_wrapper.cpp Updated Solve() implementation to return results and removed C-API usage
javascript/src/micm/micm.h Added include for solver_result_wrapper
javascript/src/micm/micm.cpp Updated to return solver results instead of undefined/null
javascript/micm/solver_result.js New module defining SolverState enum, SolverStats, and SolverResult classes
javascript/micm/micm.js Updated to use bindings package and convert native results to JavaScript classes
javascript/index.js Updated to export new solver result types and use bindings package
javascript/CMakeLists.txt Added solver_result_wrapper.cpp to build targets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@K20shores K20shores merged commit 4713fe6 into main Dec 2, 2025
87 of 88 checks passed
@K20shores K20shores deleted the javascript_solver_stats branch December 2, 2025 16:37
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.

Solver stats

3 participants