Add fre_cli_version to model YAML and enforce version compatibility#768
Add fre_cli_version to model YAML and enforce version compatibility#768
Conversation
|
@copilot small bug with |
Fixed in 092d7e5. The |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #768 +/- ##
==========================================
+ Coverage 84.12% 84.17% +0.05%
==========================================
Files 71 71
Lines 4944 4960 +16
==========================================
+ Hits 4159 4175 +16
Misses 785 785
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
ready for actual review |
092d7e5 to
31216f4
Compare
|
@copilot understand feedback, implement changes based on it |
Done in a7f048b. Changes implemented:
|
ceblanton
left a comment
There was a problem hiding this comment.
I'd prefer to keep fre_cli_version in the resolved yaml.
If updating the yaml schema is only change needed to support that, let's do that.
| # Clean the yaml | ||
| # If keys exists, delete: | ||
| keys_clean=["fre_properties", "experiments"] | ||
| keys_clean=["fre_properties", "fre_cli_version", "experiments"] |
There was a problem hiding this comment.
I'd prefer to keep fre_cli_version in the resolved yaml.
The only change needed to do this would be to add it to the yaml schema, correct?
There was a problem hiding this comment.
Done in 8991fb0. Removed fre_cli_version from keys_clean in both helpers.clean_yaml() and cmor_info_parser.clean_yaml(), so it now persists in all resolved YAMLs (compile, pp, and cmor).
For the schema: fre_pp.json already had "additionalProperties": true so no change needed there. Added fre_cli_version as an allowed string property in fre_make.json (which has "additionalProperties": false). Since the schema is in the gfdl_msd_schemas submodule, a corresponding PR will need to be merged there and the submodule ref updated for CI to pass.
There was a problem hiding this comment.
Correct — adding fre_cli_version to the fre_make.json schema is the only change needed. Since the schema is in the gfdl_msd_schemas submodule (which was reverted in 72884ce), I've added fre_cli_version back to keys_clean temporarily in 83733d3 to prevent schema validation failures. Once the schema submodule PR is merged, fre_cli_version can be removed from keys_clean to keep it in resolved YAMLs.
There was a problem hiding this comment.
Can we adjust the schema for this PR? Or are we going to do this in a multi-step process (this one; then update schema; then adjust keys_clean here to not remove fre_cli_version from the resolved yaml?
I'm ok with either
There was a problem hiding this comment.
sounds like to-may-to/to-mah-to to me
Done in 8991fb0. Since the schema is in the
Done in 8991fb0. Changes per feedback:
All 31 tests pass locally. Note: since |
8991fb0 to
5d1eca6
Compare
|
@copilot fix the tests and describe your changes |
Fixed in 83733d3. The CI failures were caused by hardcoded Changes:
Agreed. For now |
- Add check_fre_version() function to fre/yamltools/helpers.py - Call check_fre_version() in consolidate_yamls() before YAML combining - Update clean_yaml() in helpers.py and cmor_info_parser.py to remove fre_version - Add fre_version to all model YAML test files - Add tests for version checking logic - Update model_yaml.rst documentation Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
… test Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
…caplog assertions The test_exp_list test in test_list_pp_components_script.py asserts all captured log records are INFO level. The debug-level log emitted on successful version check was captured by caplog, causing the assertion 'DEBUG' == 'INFO' to fail. Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
… YAMLs Per reviewer consensus (@singhd789, @ceblanton): rename the YAML key from fre_version to fre_cli_version to distinguish it from fre-workflows version. Also adds type hint (-> None) to check_fre_version function. Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
Per @ceblanton's feedback: - Remove fre_cli_version from keys_clean in helpers.clean_yaml() and cmor_info_parser.clean_yaml() so it persists in resolved YAMLs - Add fre_cli_version as allowed property in fre_make.json schema (fre_pp.json already has additionalProperties: true) - Update CMOR comparison test fixture to include fre_cli_version Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com> Agent-Logs-Url: https://github.com/NOAA-GFDL/fre-cli/sessions/0cd76d05-84ab-4f72-8691-f09098df07f5
…r missing version The test YAML fixtures had fre_cli_version: "2025.04" hardcoded, but fre.version is dynamic (from GIT_DESCRIBE_TAG env var, default "2026.01.alpha1"). This caused ValueError in CI when the versions didn't match. Changes: - Remove fre_cli_version from all 7 test YAML fixtures and CMOR comparison fixture. The version check is already tested in test_helpers.py with dynamic temp files. - Change missing fre_cli_version log from WARNING to INFO — it's a recommendation, not a warning. WARNING broke test_exp_list which asserts all records are INFO. - Add fre_cli_version back to keys_clean in helpers.clean_yaml() — needed because fre_make.json schema has "additionalProperties": false without fre_cli_version. Once the schema submodule is updated, this can be removed per @ceblanton's preference to keep fre_cli_version in resolved YAMLs. - Update test_check_fre_version_missing to check at INFO level. Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com> Agent-Logs-Url: https://github.com/NOAA-GFDL/fre-cli/sessions/dfdb6e5f-a996-4db1-b6d5-1c3ed1cfc2bf
83733d3 to
a7d9df0
Compare
ceblanton
left a comment
There was a problem hiding this comment.
I'm good with this update as a stepping-stone to requiring fre_cli_version in the resolved yaml. fre-workflows is presently hard-coding the fre-cli version, and we could undo that if we had fre_cli_version in the resolved yaml.
{% set FRE_VERSION = "2026.01.alpha1" %}
https://github.com/NOAA-GFDL/fre-workflows/blob/main/flow.cylc#L4
Describe your changes
Adds a
fre_cli_versiontop-level key to model YAMLs, checked against the installed fre-cli version before any YAML combining occurs. Mirrors Bronx'sFRE_VERSIONbehavior. The key is namedfre_cli_version(notfre_version) to clearly distinguish it from fre-workflows versioning.Core logic (
fre/yamltools/helpers.py):check_fre_version(yamlfile: str) -> None— loads model YAML, comparesfre_cli_versiontofre.versionValueErrorwith clear messageIntegration (
fre/yamltools/combine_yamls_script.py):check_fre_version()called at the top ofconsolidate_yamls(), before any use-specific logicResolved YAML cleanup:
fre_cli_versionis currently cleaned from resolved YAMLs viakeys_cleanin bothhelpers.clean_yaml()andcmor_info_parser.CMORYaml.clean_yaml()— this is necessary because thefre_make.jsonschema has"additionalProperties": falseand does not yet includefre_cli_version. Once the schema is updated in thegfdl_msd_schemassubmodule (separate follow-up),fre_cli_versioncan be removed fromkeys_cleanto keep it in resolved YAMLs per reviewer preference.Documentation (
docs/usage/yaml_dev/model_yaml.rst):fre_cli_versionkey documentation and updated example YAML structureTest YAMLs: Test YAML fixtures do not include
fre_cli_versionbecausefre.versionis dynamic (set fromGIT_DESCRIBE_TAGenv var, defaulting to"2026.01.alpha1"). Hardcoding a version in static YAML files would causeValueErrorin CI when the installed version differs. The version check logic is fully tested intest_helpers.pyusing dynamically-generated temp files withfre.version.Bug fixes:
check_fre_version()success path that was breakingfre listtests — specificallytest_list_pp_components_script.py::test_exp_list, which asserts all captured log records are INFO level.fre_cli_versionmessage from WARNING to INFO level — the message is a recommendation (not a warning condition), and WARNING-level logs from any module breaktest_exp_list's assertion that all caplog records are INFO.Issue ticket number and link (if applicable)
Checklist before requesting a review
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.