Skip to content

Conversation

@RaphFrey
Copy link
Contributor

This pull request adds a new feature to update IMAS data dictionary (DD) paths to the currently served version, along with corresponding tests and dependency updates. The most important changes are grouped below:

New Feature: IMAS Path Update

  • Added an update_imas_path method to PathTool that converts one or more IMAS paths from an older DD version to the current version, supporting both string and list input formats. This includes logic to map paths using IDS names and handles version compatibility and errors. (imas_mcp/tools/path_tool.py)
  • Exposed the new update_imas_path method via the main tools interface for delegation. (imas_mcp/tools/__init__.py)

Testing

  • Introduced new tests for the update_imas_path feature, covering single path updates, list updates, and space-separated string input. Also added fixtures for test data. (tests/test_path_tool.py)

Dependency Management

  • Added imas-python>=2.0.1 as a required dependency to support the new path update functionality. (pyproject.toml)

Imports and Setup

  • Updated imports in path_tool.py to include necessary IMAS modules and exceptions for the new functionality. (imas_mcp/tools/path_tool.py)

@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 73.04965% with 38 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
imas_mcp/settings.py 58.69% 19 Missing ⚠️
imas_mcp/migrations/__init__.py 74.62% 17 Missing ⚠️
imas_mcp/resource_path_accessor.py 66.66% 1 Missing ⚠️
imas_mcp/tools/path_tool.py 95.45% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…gration map

Replace the runtime @persistent_cache decorator with build-time resource
generation for path migrations. This aligns with the existing hatch build
hook pattern used for schemas and other resources.

Changes:
- Add imas-python>=2.0.1 to build dependencies for dd_version_map_from_factories
- Create scripts/build_migrations.py for CLI and build-time generation
- Create imas_mcp/migrations/ module with PathMigrationMap, MigrationEntry,
  RenameHistoryEntry classes and get_migration_map() singleton
- Integrate migration map generation into hatch_build_hooks.py
- Add migrations_dir property to ResourcePathAccessor
- Enhance check_imas_paths to return migration suggestions for deprecated
  paths and renamed_from history for current paths
- Remove @persistent_cache decorator and runtime migration map building
- Remove update_imas_path and ensure_current_path methods (functionality
  merged into enhanced check_imas_paths)
- Update tests with MockPathMigrationMap for isolated testing

The migration map JSON includes:
- old_to_new: deprecated path → {new_path, deprecated_in, last_valid_version}
- new_to_old: current path → list of {old_path, deprecated_in}
- metadata: target_version, source_versions, generated_at, total_migrations
@Simon-McIntosh Simon-McIntosh merged commit 37b2217 into iterorganization:main Dec 5, 2025
7 of 8 checks passed
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