Add extra=forbid to pydantic basemodels in ert storage and cleanup#13521
Add extra=forbid to pydantic basemodels in ert storage and cleanup#13521erlenlh wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13521 +/- ##
==========================================
- Coverage 89.95% 89.95% -0.01%
==========================================
Files 459 460 +1
Lines 32173 32409 +236
==========================================
+ Hits 28942 29154 +212
- Misses 3231 3255 +24
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Pull request overview
Adds extra="forbid" to all Pydantic BaseModel classes under src/ert/storage, ensuring that loading storage index/failure JSON rejects unknown fields rather than silently ignoring them. This aligns these internal storage models with the convention already used in Everest config models and other ERT event models.
Changes:
_Migrationsand top-level_Indexinlocal_storage.pynow forbid extra fields.ExperimentStatusand experiment_Indexinlocal_experiment.pynow forbid extra fields.- Ensemble
_Indexand_Failureinlocal_ensemble.pynow forbid extra fields.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/ert/storage/local_storage.py | Add extra="forbid" to _Migrations and _Index. |
| src/ert/storage/local_experiment.py | Add extra="forbid" to ExperimentStatus and _Index. |
| src/ert/storage/local_ensemble.py | Add extra="forbid" to _Index and _Failure. |
Issue
Resolves #13520
Approach
Short description of the approach
(Screenshot of new behavior in GUI if applicable)
git rebase -i main --exec 'just rapid-tests')When applicable