Skip to content

Commit af57222

Browse files
committed
Addressed the copilot review
1 parent d91ced6 commit af57222

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Previously, loading a schema whose version existed only in the prerelease cache
1313
- `get_hed_version_path()` in `hed_cache.py` now always searches both regular and prerelease directories (regular first).
1414
- `get_hed_versions()` in `hed_cache.py` retains the default `check_prerelease=False` (no public API change). Internal callers that need prerelease inclusion (`get_hed_version_path`, error messages) now pass `check_prerelease=True` explicitly.
1515
- Default schema version is now resolved dynamically from the cache (highest released version) instead of being hardcoded, so new schema releases no longer require a code change.
16+
- `get_hed_version_path()` now automatically downloads schemas from GitHub when a requested version is not found in the local cache (default cache directory only).
17+
- `_load_schema_version_sub()` now raises `BAD_PARAMETERS` (was `FILE_NOT_FOUND`) when no version is specified and the cache is empty, since the problem is a missing argument rather than a missing file.
1618
- `check_schema_loading.py` simplified — removed `_is_prerelease_partner()` helper.
1719
- `run_loading_check()` now raises `ValueError` immediately for mutually exclusive flag combinations (`prerelease_only` + `exclude_prereleases`, or `library_filter` + `standard_only`), consistent with the existing CLI-level validation.
1820

hed/schema/hed_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def get_hed_versions(local_hed_directory=None, library_name=None, check_prerelea
8888
None retrieves the standard schema only.
8989
Pass "all" to retrieve all standard and library schemas as a dict.
9090
check_prerelease (bool): If True, results can include prerelease schemas.
91-
Pass False to get only released versions (used by compliance checks).
91+
Default is False, returning only released versions.
9292
9393
Returns:
9494
Union[list, dict]: List of version numbers or dictionary {library_name: [versions]}.

spec_tests/test_hed_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ def test_get_hed_version_path_no_auto_refresh_for_custom_directory(self):
121121
finally:
122122
shutil.rmtree(empty_dir)
123123

124-
def test_get_hed_version_path_auto_refresh_finds_prerelease(self):
125-
"""get_hed_version_path automatically downloads a prerelease schema from GitHub when not cached locally."""
124+
def test_get_hed_version_path_auto_refresh_downloads_missing_version(self):
125+
"""get_hed_version_path automatically downloads from GitHub when a version is not cached locally."""
126126
# Use a fresh cache directory so the version is definitely not present
127127
fresh_cache = os.path.join(os.path.dirname(self.hed_cache_dir), "schema_cache_auto_refresh/")
128128
if os.path.exists(fresh_cache):

0 commit comments

Comments
 (0)