Removed prerelease flag from schema loading#1276
Conversation
|
PR Review: Remove check_prerelease flag from schema loading The simplification goal is sound and the implementation is clean. One important backward-compat issue needs addressing before merge. IMPORTANT ISSUES:
SUGGESTION: get_hed_versions default flip (False to True) is a quieter behavioral change. Existing callers relying on the old default now silently receive prerelease versions. The compliance checker correctly guards this with an explicit check_prerelease=False. Worth noting in the CHANGELOG for anyone calling hed_cache directly. WHAT LOOKS GOOD:
|
There was a problem hiding this comment.
Pull request overview
This PR removes the check_prerelease opt-in flag across the schema loading surface area and makes prerelease schemas discoverable automatically during version/path lookups, updating tests, scripts, and documentation to match.
Changes:
- Removed
check_prereleasefrom schema-loading public APIs (load_schema_version,load_schema,from_string,from_dataframes) and schema loader classes. - Updated cache lookup behavior so prerelease directories are searched automatically (regular first), and adjusted compliance checks to explicitly compare against released-only versions.
- Updated unit/spec tests, fixtures, and the changelog to reflect the new prerelease lookup behavior.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/schema/test_hed_schema_io.py |
Reworked tests to validate prerelease schemas load without an opt-in flag and partner resolution works. |
tests/data/schema_tests/prerelease/HED_testpre_1.0.0.mediawiki |
Updated fixture prologue text to match new prerelease behavior. |
spec_tests/test_hed_cache.py |
Updated spec test to rely on new default prerelease-inclusive version listing. |
lychee.toml |
Removed a comment line (no functional impact). |
hed/scripts/schema_script_util.py |
Removed prerelease-partner detection and stopped threading prerelease flags through roundtrip reloads. |
hed/scripts/check_schema_loading.py |
Simplified loader checks by removing prerelease flag plumbing. |
hed/schema/schema_validation/compliance.py |
Made compliance explicitly compare against released-only versions by passing check_prerelease=False. |
hed/schema/schema_io/xml2schema.py |
Removed prerelease flag from XML loader constructor/super call. |
hed/schema/schema_io/wiki2schema.py |
Removed prerelease flag from MediaWiki loader constructor/super call. |
hed/schema/schema_io/json2schema.py |
Removed prerelease flag from JSON loader constructor/super call. |
hed/schema/schema_io/df2schema.py |
Removed prerelease flag from dataframe/TSV loader APIs. |
hed/schema/schema_io/base2schema.py |
Removed prerelease state from base loader and always allow partner resolution via normal version lookup. |
hed/schema/hed_schema_io.py |
Removed prerelease flag threading from all public schema-loading functions and internal helpers. |
hed/schema/hed_cache.py |
Defaulted version listing to include prereleases and made version-path lookup always check prerelease directory. |
CHANGELOG.md |
Documented the API change and new prerelease lookup behavior. |
spec_tests/test_hed_cache.py
Outdated
| all_versions = hed_cache.get_hed_versions(self.hed_cache_dir, library_name="score") | ||
| released_only = hed_cache.get_hed_versions(self.hed_cache_dir, library_name="score", check_prerelease=False) | ||
| self.assertIsInstance(all_versions, list) | ||
| self.assertTrue(len(all_versions) > 0) | ||
| self.assertGreater( | ||
| len(all_versions), | ||
| len(released_only), | ||
| "Default (prerelease included) should return more versions than released-only", | ||
| ) |
There was a problem hiding this comment.
This assertion can be flaky because it relies on the remote hed-schemas repo having at least one prerelease version for the score library at test time. If there are no prerelease versions (or they get removed), len(all_versions) will equal len(released_only) and the test will fail even though the code is correct. Consider making the test deterministic by creating a prerelease xml file under {hed_cache_dir}/prerelease/ (or using a local fixture/mocking) and asserting that the default call includes it while check_prerelease=False does not.
|
test |
No description provided.