Skip to content

chore: improve resource discovery and reference handling for new sections - #1557

Merged
frodehk merged 3 commits into
mainfrom
chore/yaml-mapping-discovered-during-migration
May 18, 2026
Merged

chore: improve resource discovery and reference handling for new sections#1557
frodehk merged 3 commits into
mainfrom
chore/yaml-mapping-discovered-during-migration

Conversation

@frodehk

@frodehk frodehk commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Small fixes and improvements to YAML resource discovery, reference handling, and mapper robustness. Discovered while running the migration tooling against existing models, but valuable independently.

Changes

  • yaml_reference_service.py: register FLUID_MODELS entries so they are resolvable through the reference service.
  • pyyaml_yaml_model.py:
    • structure-agnostic helper to find FILE references nested inside the new YAML sections (PROCESS_UNITS, PROCESS_SYSTEMS)
    • auto-detect is_single_speed from chart resource headers
    • declare fluid_models as an abstract property on YamlValidator
  • process_simulation_mapper.py: defensive None-handling in _map_conditions.

No behavioral change for existing models — these only enable correct handling of newer YAML constructs and improve type safety.

Type of Work

  • Patch: X.Y.Z+1. NEGLIGIBLE visible changes, does not change input or output - OR changes behaviour. Use chore:, refactor: etc
  • Minor: X.Y+1.Z. Minor changes, might ADD new input (YAML), or other backwards-compatible changes. Use feat:, fix:
  • Major: X+1.Y.Z. Major and most likely BREAKING changes, wo. backwards compatibility, or removing temporary backwards compatibility functionality. Use ! or BREAKING:.

See here (internal): https://github.com/equinor/ecalc-internal/discussions/1044

Have you remembered and considered?

  • IF FEAT: I have remembered to update documentation
  • IF FIX OR FEAT: I have remembered to update manual changelog (docs/drafts/next.draft.md)
  • IF BREAKING: I have remembered to update migration guide (docs/docs/migration_guides/)
  • IF BREAKING: I have committed with BREAKING: in footer or ! in header
  • I have added tests (if not, comment why)
  • I have used conventional commits syntax (if you squash, make sure that conventional commit is used)
  • I have included the Github issue nr in the footer!

What is this PR all about?

What else did you consider?

Between the lines?

@frodehk frodehk self-assigned this May 15, 2026
@frodehk
frodehk requested a review from a team as a code owner May 15, 2026 14:12
@frodehk frodehk changed the title chore: improve resource discovery and reference handling for new sect… chore: improve resource discovery and reference handling for new sections May 15, 2026
Comment thread src/libecalc/presentation/yaml/mappers/process_simulation_mapper.py Outdated
Comment thread src/libecalc/presentation/yaml/mappers/process_simulation_mapper.py
Comment thread src/libecalc/presentation/yaml/mappers/process_simulation_mapper.py Outdated
Comment thread src/libecalc/presentation/yaml/mappers/process_simulation_mapper.py
Comment thread src/libecalc/presentation/yaml/mappers/process_simulation_mapper.py Outdated

# Pick up FILE references nested in the new YAML sections (PROCESS_UNITS, PROCESS_SYSTEMS, ...).
for section in _NEW_SECTIONS_WITH_FILE_REFS:
resource_names.extend(_find_file_references(self._internal_datamodel.get(section)))

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.

Also replace facility and model 'search' above? Search everything except TIME_SERIES? Or do we need to separate TIME_SERIES and FACILITY when looking at resources?

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.

Good point.

I kept the new search to the new sections (PROCESS_UNITS, PROCESS_SYSTEMS) on purpose. I think replacing the existing facility/model search will be a refactor that may require some test coverage - better to keep in a separate PR? I think TIME_SERIES probably needs to stay separate, since they map to a different resource type.

@frodehk
frodehk merged commit 77e5d7e into main May 18, 2026
23 checks passed
@frodehk
frodehk deleted the chore/yaml-mapping-discovered-during-migration branch May 18, 2026 12:31
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.

3 participants