hubValidations 2.0.0
Breaking Changes
-
Refactored validation class architecture for multi-file validation (#294).
Previously, functions like
validate_pr()that validate multiple files returned a flathub_validationslist where all checks were combined together. Duplicate check names were made unique by appending numeric suffixes (e.g.,file_exists,file_exists_1,file_exists_2). This made it unclear which file each check related to and difficult to programmatically access results for a specific file.Now, multi-file validation results are organized hierarchically using new collection classes. Results are stored in a named list where names identify what was validated (file path,
"hub-config", or target type) and values arehub_validationsobjects containing the checks for that subject. This provides robust, intuitive access:collection[["team1-goodmodel/2022-10-08-team1-goodmodel.csv"]]$file_exists.Affected functions (now return collection objects):
validate_submission()returnshub_validations_collection(washub_validations)validate_target_submission()returnstarget_validations_collection(wastarget_validations)validate_pr()returnshub_validations_collection(washub_validations)validate_target_pr()returnstarget_validations_collection(wastarget_validations)
Migration required: Code that accesses validation results by name (e.g.,
validations$file_exists) must be updated to use the new hierarchical access pattern:validations[["path/to/file.csv"]]$file_exists.Additional notes:
- Hub config validation is included as a separate entry named
"hub-config"in collection results. - For target validation, dataset-level checks are grouped under their target type name (
"time-series","oracle-output"). - Lower-level functions (
validate_model_data(),validate_model_file(),validate_model_metadata(),validate_target_data(),validate_target_file(),validate_target_dataset()) continue to return singlehub_validationsortarget_validationsobjects.
-
File modification checks reorganized: Each modified/deleted file now gets its own entry in the collection with a standardized check name
valid_file_status. Previously, these were grouped undermodel_output_modormodel_metadata_modwith numeric suffixes for multiple files. Access viacollection[["path/to/file"]]$valid_file_status. -
Print methods now display full relative file paths (e.g.,
team1-goodmodel/2022-10-08-team1-goodmodel.csv) instead of basenames for model output files, providing better context.
New Features
-
New collection classes for organizing multi-file validation results:
hub_validations_collection: A named list where names identify what was validated and values arehub_validationsobjects.target_validations_collection: Extendshub_validations_collectionfor target data validation results.- New constructors:
new_hub_validations_collection(),new_target_validations_collection(), and correspondingas_*conversion functions.
-
hub_validationsobjects now enforce consistency: All checks in ahub_validationsobject must have the same$wherevalue. This value is extracted and stored as awhereattribute on the object, identifying what was validated (e.g., file path,"hub-config", or target type like"time-series"). Access viaattr(x, "where"). -
New class utility methods for
hub_validations(and subclasses liketarget_validations):- Subsetting with
[preserves class andwhereattribute - Assignment with
$<-and[[<-validates that new checks have matchingwherevalues - NULL assignment removes elements and clears
wherewhen empty
- Subsetting with
-
Added print methods for collection classes that display results organized hierarchically by what was validated.
-
Added
combine()methods for collection classes that properly merge validations bywherevalue. -
check_for_errors()is now a generic with methods for bothhub_validationsandhub_validations_collectionclasses. For collections, errors are reported grouped by what was validated.