Skip to content

Add update_strategy for parameter type#13461

Open
frode-aarstad wants to merge 5 commits intoequinor:mainfrom
frode-aarstad:add-strategy-for-parameter-type2
Open

Add update_strategy for parameter type#13461
frode-aarstad wants to merge 5 commits intoequinor:mainfrom
frode-aarstad:add-strategy-for-parameter-type2

Conversation

@frode-aarstad
Copy link
Copy Markdown
Contributor

@frode-aarstad frode-aarstad commented Apr 30, 2026

Issue
Resolves #13027

Approach
Short description of the approach

(Screenshot of new behavior in GUI if applicable)

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'just rapid-tests')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Add backport label to latest release (format: 'backport release-branch-name')

@frode-aarstad frode-aarstad self-assigned this Apr 30, 2026
@frode-aarstad frode-aarstad marked this pull request as draft April 30, 2026 12:08
@frode-aarstad frode-aarstad force-pushed the add-strategy-for-parameter-type2 branch 4 times, most recently from 89ea744 to fba19df Compare May 5, 2026 09:39
@frode-aarstad frode-aarstad marked this pull request as ready for review May 5, 2026 09:45
@frode-aarstad frode-aarstad force-pushed the add-strategy-for-parameter-type2 branch 3 times, most recently from 9bbd4a1 to fa13793 Compare May 5, 2026 12:29
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 5, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.97%. Comparing base (b4ed493) to head (5b9069b).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/ert/analysis/_es_update.py 62.96% 10 Missing ⚠️
src/ert/config/analysis_config.py 88.88% 2 Missing ⚠️
src/ert/storage/migration/to29.py 92.59% 2 Missing ⚠️
src/ert/gui/ertwidgets/parameterviewer.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13461      +/-   ##
==========================================
- Coverage   89.90%   84.97%   -4.94%     
==========================================
  Files         460      462       +2     
  Lines       32372    32476     +104     
==========================================
- Hits        29105    27597    -1508     
- Misses       3267     4879    +1612     
Flag Coverage Δ
cli-tests ?
fuzz 44.06% <44.76%> (+0.01%) ⬆️
gui-tests ?
performance-and-unit-tests 77.85% <85.71%> (-0.11%) ⬇️
test 45.62% <15.23%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
src/ert/analysis/_enif_update.py 80.00% <ø> (-16.20%) ⬇️
src/ert/cli/main.py 80.24% <ø> (-8.65%) ⬇️
src/ert/config/_get_update_from_options.py 100.00% <100.00%> (ø)
src/ert/config/design_matrix.py 97.29% <ø> (ø)
src/ert/config/ert_config.py 95.79% <100.00%> (+0.03%) ⬆️
src/ert/config/everest_control.py 87.65% <100.00%> (ø)
src/ert/config/field.py 95.77% <100.00%> (+0.02%) ⬆️
src/ert/config/gen_kw_config.py 98.24% <100.00%> (ø)
src/ert/config/parameter_config.py 96.61% <100.00%> (-1.70%) ⬇️
src/ert/config/surface_config.py 94.61% <100.00%> (-3.06%) ⬇️
... and 9 more

... and 84 files with indirect coverage changes

@frode-aarstad frode-aarstad force-pushed the add-strategy-for-parameter-type2 branch 4 times, most recently from db1a1fa to 10296f2 Compare May 6, 2026 06:08
Comment thread src/ert/config/analysis_config.py
@frode-aarstad frode-aarstad force-pushed the add-strategy-for-parameter-type2 branch from 91f0bf1 to 9a956c5 Compare May 7, 2026 06:40
@frode-aarstad frode-aarstad added the release-notes:new-feature Automatically categorise as new feature in release notes label May 7, 2026
@frode-aarstad frode-aarstad changed the title Add strategy for parameter type2 Add update_strategy for parameter type May 7, 2026
@frode-aarstad frode-aarstad force-pushed the add-strategy-for-parameter-type2 branch from 9a956c5 to d162f43 Compare May 7, 2026 07:37
@frode-aarstad frode-aarstad requested a review from Copilot May 7, 2026 07:38
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 introduces a new update_strategy concept for parameter configs (replacing the boolean update) and adds support for configuring default update strategy per parameter type via ANALYSIS_SET_VAR PARAMETERS ..., including local storage migration to v29.

Changes:

  • Replace update: bool with update_strategy: str | None across parameter config models, GUI/CLI checks, and analysis selection logic.
  • Add ANALYSIS_SET_VAR PARAMETERS <TYPE> <STRATEGY> parsing and application (per parameter type default strategy), plus new helper get_update_from_options().
  • Bump local storage version to 29 and add a migration converting stored parameter update booleans into update_strategy.

Reviewed changes

Copilot reviewed 58 out of 58 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
tests/ert/unit_tests/storage/test_storage_migration.py Updates smoother update calls to pass strategy_map.
tests/ert/unit_tests/storage/test_local_storage.py Updates hypothesis strategies to generate update_strategy.
tests/ert/unit_tests/storage/migration/test_to29.py Adds tests for v29 migration converting updateupdate_strategy.
tests/ert/unit_tests/scenarios/test_summary_response.py Updates smoother update calls to pass strategy_map.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_esmda_matches_snapshot/snake_oilsnake_oil.ert/snake_oil.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_esmda_matches_snapshot/poly_examplepoly.ert/poly.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_esmda_matches_snapshot/heat_equationconfig.ert/config.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_ensemble_smoother_matches_snapshot/snake_oilsnake_oil.ert/snake_oil.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_ensemble_smoother_matches_snapshot/poly_examplepoly.ert/poly.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_ensemble_smoother_matches_snapshot/heat_equationconfig.ert/config.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_ensemble_experiment_matches_snapshot/snake_oilsnake_oil.ert/snake_oil.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_ensemble_experiment_matches_snapshot/poly_examplepoly.ert/poly.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_ensemble_experiment_matches_snapshot/heat_equationconfig.ert/config.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_enif_matches_snapshot/snake_oilsnake_oil.ert/snake_oil.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_enif_matches_snapshot/poly_examplepoly.ert/poly.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/run_models/snapshots/test_experiment_serialization/test_that_dumped_enif_matches_snapshot/heat_equationconfig.ert/config.json Snapshot update: updateupdate_strategy.
tests/ert/unit_tests/gui/tools/plot/test_plot_api.py Updates GUI plot API tests to use update_strategy.
tests/ert/unit_tests/gui/ertwidgets/models/test_ertsummary.py Updates ERT summary model tests for update_strategy.
tests/ert/unit_tests/dark_storage/test_http_endpoints.py Updates expected HTTP payload to update_strategy.
tests/ert/unit_tests/config/test_surface_config.py Updates surface config tests to use update_strategy.
tests/ert/unit_tests/config/test_get_update_from_options.py Adds unit tests for get_update_from_options().
tests/ert/unit_tests/config/test_gen_kw_config.py Updates gen_kw config parsing tests for update_strategy.
tests/ert/unit_tests/config/test_field.py Updates field config tests to use update_strategy.
tests/ert/unit_tests/config/test_ert_config.py Adds coverage for applying per-type parameter strategies in ErtConfig.
tests/ert/unit_tests/config/test_analysis_config.py Adds tests for ANALYSIS_SET_VAR PARAMETERS parsing/validation.
tests/ert/unit_tests/analysis/test_es_update.py Updates ES update tests for explicit strategy_map and new strategy mapping.
tests/ert/unit_tests/analysis/test_enif_update.py Updates EnIF tests to use update_strategy.
tests/ert/unit_tests/analysis/test_distance_localization.py Updates distance localization tests to use update_strategy.
tests/ert/ui_tests/gui/test_parameterviewer.py Updates parameter viewer UI tests for string/None “updatable” state.
tests/ert/ui_tests/cli/test_field_parameter.py Updates CLI field parameter test to new build_strategy_map API.
tests/ert/ui_tests/cli/analysis/test_es_update.py Updates CLI ES update tests to use update_strategy.
tests/ert/ui_tests/cli/analysis/test_enif_update.py Updates CLI EnIF test to use update_strategy.
tests/ert/ui_tests/cli/analysis/test_adaptive_localization.py Adds PARAMETERS strategy configuration in adaptive localization UI test.
tests/ert/performance_tests/test_obs_and_responses_performance.py Updates perf tests to pass strategy_map.
tests/ert/performance_tests/test_memory_usage.py Updates perf tests to pass strategy_map.
tests/ert/performance_tests/test_create_run_path_performance.py Updates surface perf test config to update_strategy.
tests/ert/performance_tests/test_analysis.py Updates perf test for new build_strategy_map signature.
src/ert/storage/migration/to29.py Adds migration converting stored update bool to update_strategy.
src/ert/storage/local_storage.py Bumps storage version to 29 and wires in to29 migration.
src/ert/storage/local_experiment.py Updates update_parameters selection to use update_strategy.
src/ert/run_models/update_run_model.py Updates run model to build and pass strategy_map.
src/ert/run_models/model_factory.py Updates “has updatable parameters” validation to use update_strategy.
src/ert/gui/experiments/experiment_panel.py Updates GUI eligibility check to use update_strategy.
src/ert/gui/ertwidgets/parameterviewer.py Updates parameter viewer display/filtering to use update_strategy.
src/ert/config/surface_config.py Parses UPDATE into update_strategy for surface parameters.
src/ert/config/parameter_config.py Changes base parameter config field to update_strategy.
src/ert/config/gen_kw_config.py Parses UPDATE into update_strategy and handles CONST as non-updatable.
src/ert/config/field.py Parses UPDATE into update_strategy for field parameters.
src/ert/config/everest_control.py Sets Everest controls to non-updatable via update_strategy=None.
src/ert/config/ert_config.py Applies per-parameter-type default strategies after parsing.
src/ert/config/design_matrix.py Ensures design-matrix parameters are non-updatable via update_strategy=None.
src/ert/config/analysis_module.py Adjusts (commented) localization default constant.
src/ert/config/analysis_config.py Adds parameter_strategies and parsing for ANALYSIS_SET_VAR PARAMETERS.
src/ert/config/_get_update_from_options.py New helper mapping UPDATE option to GLOBAL/None.
src/ert/cli/main.py Updates CLI “all UPDATE:FALSE” validation to use update_strategy.
src/ert/analysis/_es_update.py Moves update selection to explicit strategy_map and per-parameter strategies.
src/ert/analysis/_enif_update.py Updates EnIF “updated parameters” selection to use update_strategy.
docs/ert/reference/configuration/keywords.rst Documents new ANALYSIS_SET_VAR PARAMETERS syntax and strategies.

Comment thread src/ert/run_models/update_run_model.py Outdated
Comment thread src/ert/analysis/_es_update.py
Comment thread src/ert/analysis/_es_update.py
Comment thread src/ert/config/analysis_module.py Outdated
Comment thread tests/ert/unit_tests/config/test_ert_config.py Outdated
Comment thread tests/ert/unit_tests/config/test_ert_config.py Outdated
Comment thread tests/ert/unit_tests/config/test_ert_config.py Outdated
Comment thread tests/ert/unit_tests/config/test_ert_config.py Outdated
Comment thread docs/ert/reference/configuration/keywords.rst Outdated
Comment thread docs/ert/reference/configuration/keywords.rst Outdated
@frode-aarstad frode-aarstad force-pushed the add-strategy-for-parameter-type2 branch from 16297a4 to 1071d8d Compare May 7, 2026 12:02
.. note::

The update strategy set with ``ANALYSIS_SET_VAR PARAMETERS`` acts as a default for all parameters of that type.
However, individual parameters can override this and disable updates by setting ``UPDATE:FALSE``.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure if this is override or just disabling the update.
Maybe instead?
You can still turn off update for individual parameters by setting UPDATE:FALSE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will reword this.

for param_name in parameters:
param_cfg = param_configs[param_name]
if isinstance(param_cfg, Field):
if param_cfg.update_strategy == "DISTANCE":
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be simplified somehow?
For example to use something like this:

strategy_table: dict[type, strategy_type] = {
    Field: {
        "DISTANCE": field_distance_strategy,
        "ADAPTIVE": adaptive_localization_strategy,
        "GLOBAL": global_strategy,
    },
    SurfaceConfig: {
        "DISTANCE": surface_distance_strategy,
        "ADAPTIVE": adaptive_localization_strategy,
        "GLOBAL": global_strategy,
    },
    GenKwConfig: {
        "ADAPTIVE": adaptive_localization_strategy,
        "GLOBAL": global_strategy,
    },
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure how this make it simpler.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe it is not so straightforward to simplify this, yes. Ok, let's keep it for now, but there are way too many ifs for my taste ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes:new-feature Automatically categorise as new feature in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add configuration for default update strategy per parameter type

5 participants