Skip to content

Fix multi-thread results and schema validation#613

Draft
pressr-inl wants to merge 15 commits into
v3_Develfrom
v3_MultiThreadVarFix
Draft

Fix multi-thread results and schema validation#613
pressr-inl wants to merge 15 commits into
v3_Develfrom
v3_MultiThreadVarFix

Conversation

@pressr-inl

@pressr-inl pressr-inl commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixes two multi-threaded simulation result issues and adds schema-validation coverage for upgraded EMRALD models. The branch preserves watched variable values when combining thread batches for an existing key state, updates EMRALD_Sim so the UI returns to the merged overall results when all threads finish, and tightens the v3.3 model schema/upgrade path so existing model fixtures can be validated consistently.

This also makes schema validation safer in the UI by stopping AJV after the first failure set, capping displayed save-warning errors, and avoiding full validation-array logging when a model produces a very large error set. Run Application actions now expose and save the model-root working-directory option used by the solver, with matching schema/interface and documentation updates.

Related Issue

Fixes #612

Changes Made

  • Merge watched variable values from additional ProcessSimBatch instances instead of only copying values when the key state is new.
  • Preserve duplicate run IDs from merged batches by adding thread-style suffixes such as 1.1 and 1.2.
  • Add unit coverage for merging root watch variables for an existing key state.
  • Mark the final merged progress callback as overall results and display simRuns[0] when the callback has no thread number.
  • Keep multi-thread controls visibility consistent when applying saved UI options.
  • Add root objType handling for EMRALD models and normalize root/template model objects on UI open/save paths.
  • Update the v3.3 schema and interfaces for top-level templates, multiThreadInfo, and strict root validation.
  • Fix distribution parameter schema placement and add conditional requirements for event/action distribution items.
  • Strip legacy duplicate state geometry and logic-node rootName during the v3.3 upgrade.
  • Add UI upgrade tests for the schema-upgrade cleanup behavior.
  • Add a VandV corpus test that upgrades every TestingFiles/Models fixture through SimulationDAL and validates it against the current UI schema export, with explicit excluded and expected-failure lists.
  • Limit save-time schema validation to a capped set of formatted errors and disable full AJV allErrors collection to avoid UI stalls on very large validation failures.
  • Log only validation summary information instead of the full AJV error array.
  • Allow Run Application actions to save useProjPathExeWorkingDir and expose it in the UI as Use model file as root folder.
  • Document both Exe in Preprocessor code and Use model file as root folder for Run Application actions, including relative path behavior.

Type of Change

Select the type of change your PR introduces:

  • Bug fix (fixes an issue)
  • New feature (adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

Please ensure the following are completed:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • If changes effect the user interface layouts, I have updated the user documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Screenshots (if applicable)

Not applicable.

Additional Notes

Validation runs:

  • dotnet build EMRALD_Sim\EMRALD_Sim.csproj --no-restore succeeded with existing warnings only.
  • npm.cmd run test -- --run src/tests/official/utils/upgrade.test.tsx passed.
  • npm.cmd run build passed after the latest schema-warning and Run Application UI updates.
  • npx.cmd eslint src/utils/Upgrades/v3_3/UpgradeV3_3.ts src/tests/official/utils/upgrade.test.tsx --ext ts,tsx --report-unused-disable-directives --max-warnings 0 passed.
  • dotnet test VandV_Testing\Testing.csproj --filter FullyQualifiedName~ModelSchemaUpgradeTests passed.

@pressr-inl pressr-inl requested a review from gonzrl June 29, 2026 17:37
Use the parent state's diagram name when deciding whether transition targets are outside the rendered diagram, avoiding the empty child hook state while preserving the state-rename scoping fix.

Add a regression test covering same-diagram and cross-diagram transition link icon rendering.
Update the v3.3 schema and interfaces for root objType, templates, multiThreadInfo, distribution parameters, and related top-level validation.

Normalize root model objType on UI open/save paths and strip legacy geometry/rootName fields during the v3.3 upgrade, with focused upgrade tests.

Add a VandV corpus test that upgrades each TestingFiles/Models fixture through SimulationDAL and validates it against the UI's current schema export, with explicit excluded and expected-failure lists.
@pressr-inl pressr-inl changed the title Fix multi-thread result merging and final display Fix multi-thread results and schema validation Jun 30, 2026
Move the Run Application ExeFromPreCode checkbox above the executable location field.

Allow ExeFromPreCode actions to defer executable validation until RunExtApp evaluates the preprocessor return string.

Add JsonVarExeFromPreCodeTest with a model that returns the executable path from makeInputFileCode.
Limit model schema validation to the first reported errors and show only a capped, grouped set in the save warning dialog.

Avoid logging the full AJV error array, add the Run Application model-root working directory option, and document the related Run Application settings.
…path adjustment. Also made sure MAAP sets exeFromPreCode to true.
@pressr-inl pressr-inl requested review from gonzrl and nmde July 3, 2026 22:02
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.

Multi-threaded results lose merged watch variables and final overall display

2 participants