Skip to content

Remove parameter metadata#12466

Merged
xjules merged 1 commit intoequinor:mainfrom
xjules:rem_metadata_genkw
Dec 23, 2025
Merged

Remove parameter metadata#12466
xjules merged 1 commit intoequinor:mainfrom
xjules:rem_metadata_genkw

Conversation

@xjules
Copy link
Contributor

@xjules xjules commented Dec 5, 2025

Issue
Resolves #12418

Make use that all parameters are pydantic basemodel now.
(Screenshot of new behavior in GUI if applicable)

It might require to change webviz-ert dark storage API

  • 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')

@xjules xjules self-assigned this Dec 5, 2025
@xjules xjules marked this pull request as ready for review December 8, 2025 14:07
@xjules xjules changed the title WIP: remove param.metadata Remove param.metadata Dec 8, 2025
@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2025

Codecov Report

❌ Patch coverage is 65.95745% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.61%. Comparing base (c612499) to head (b3233c4).

Files with missing lines Patch % Lines
src/ert/storage/migration/to19.py 31.81% 15 Missing ⚠️
src/ert/dark_storage/endpoints/parameters.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12466      +/-   ##
==========================================
- Coverage   90.69%   90.61%   -0.09%     
==========================================
  Files         431      432       +1     
  Lines       29734    29738       +4     
==========================================
- Hits        26968    26947      -21     
- Misses       2766     2791      +25     
Flag Coverage Δ
cli-tests 37.59% <21.27%> (-0.04%) ⬇️
gui-tests 68.72% <44.68%> (-0.04%) ⬇️
performance-and-unit-tests 74.13% <57.44%> (-0.07%) ⬇️
test 38.32% <19.14%> (-0.06%) ⬇️

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.

@xjules xjules force-pushed the rem_metadata_genkw branch from 4a3d74d to 1480a97 Compare December 10, 2025 15:08
@xjules xjules changed the title Remove param.metadata Remove parameter metadata Dec 10, 2025
@xjules xjules force-pushed the rem_metadata_genkw branch 2 times, most recently from 62ca59e to a7a3420 Compare December 17, 2025 08:40
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 17, 2025

CodSpeed Performance Report

Merging #12466 will not alter performance

Comparing xjules:rem_metadata_genkw (b3233c4) with main (c612499)

Summary

✅ 22 untouched

Copy link

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 parameter configuration handling by removing the ParameterMetadata class and making all parameter types use pydantic BaseModel directly with a dimensionality attribute. This simplifies the parameter configuration system while maintaining backward compatibility through storage migration.

Key Changes

  • Removed ParameterMetadata class and replaced it with direct use of parameter configuration models
  • Added dimensionality field directly to all parameter config classes (GenKwConfig, Field, SurfaceConfig)
  • Created storage migration to19 to add dimensionality to existing parameter configurations

Reviewed changes

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

Show a summary per file
File Description
src/ert/config/parameter_config.py Commented out ParameterMetadata class definition (should be removed entirely)
src/ert/config/gen_kw_config.py Added dimensionality field (literal 1) and removed metadata property
src/ert/config/field.py Added dimensionality field (literal 3) and removed metadata property
src/ert/config/surface_config.py Added dimensionality field (literal 2) and removed metadata property
src/ert/config/ext_param_config.py Removed metadata property
src/ert/config/__init__.py Removed ParameterMetadata export
src/ert/storage/migration/to19.py New migration to add dimensionality to existing parameters based on type
src/ert/storage/local_storage.py Registered to19 migration
src/ert/dark_storage/endpoints/experiments.py Changed from returning list of metadata to single config model_dump
src/ert/dark_storage/endpoints/parameters.py Simplified parameter data fetching to use parameter name directly
src/ert/gui/tools/plot/plot_api.py Updated to use parameter config instead of ParameterMetadata
src/ert/gui/tools/plot/plot_window.py Updated to check dimensionality instead of data_origin metadata
tests/ert/unit_tests/storage/test_storage_migration.py Added assertions to verify dimensionality after migration
tests/ert/unit_tests/storage/snapshots/... Updated snapshots to include dimensionality field
tests/ert/unit_tests/run_models/snapshots/... Updated experiment serialization snapshots with dimensionality
tests/ert/unit_tests/gui/tools/plot/test_plot_api.py Updated tests to use GenKwConfig instead of ParameterMetadata
tests/ert/unit_tests/gui/tools/plot/conftest.py Updated mock data to match new parameter structure
tests/ert/unit_tests/dark_storage/test_parameters.py Removed test for group-based parameter access, simplified parameter lookup
tests/ert/unit_tests/dark_storage/test_http_endpoints.py Updated tests to expect new parameter structure with full config
Comments suppressed due to low confidence (1)

src/ert/config/parameter_config.py:46

  • This comment appears to contain commented-out code.
# class ParameterMetadata(BaseModel):
#     key: str
#     transformation: str | None
#     dimensionality: Literal[1, 2, 3] = 1
#     userdata: dict[str, Any]

@xjules xjules force-pushed the rem_metadata_genkw branch from bf16d9d to 5bd1cee Compare December 22, 2025 15:50
@frode-aarstad
Copy link
Contributor

Should there not be a test_to19.py for this ? Or is the migration to trivial?

@xjules
Copy link
Contributor Author

xjules commented Dec 23, 2025

Should there not be a test_to19.py for this ? Or is the migration to trivial?

Not sure. This is just adding a new attribute. Maybe I can make a simple one though

Copy link
Contributor

@frode-aarstad frode-aarstad left a comment

Choose a reason for hiding this comment

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

Looks good. Squash and merge 🎅🏻

Since all parameters are pydantic now we don't need metadata class.
This adds dimensionality attribute to parameters, which previously was
part of the metadata.
Additionally we remove group from the dark storage API.

Add storage migration to account for dimensionality attribute
@xjules xjules force-pushed the rem_metadata_genkw branch from 4871721 to b3233c4 Compare December 23, 2025 12:00
@xjules xjules merged commit dc78922 into equinor:main Dec 23, 2025
34 checks passed
@xjules xjules deleted the rem_metadata_genkw branch December 23, 2025 12:31
@xjules xjules added the release-notes:misc Automatically categorise as miscellaneous change in release notes label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes:misc Automatically categorise as miscellaneous change in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove parameters metadata

5 participants