Skip to content

feat: Suggest upgrading ROOT and re-exporting the workspace on validation failure#192

Open
kratsg wants to merge 3 commits into
mainfrom
feat/hintNewerRootVersion
Open

feat: Suggest upgrading ROOT and re-exporting the workspace on validation failure#192
kratsg wants to merge 3 commits into
mainfrom
feat/hintNewerRootVersion

Conversation

@kratsg
Copy link
Copy Markdown
Contributor

@kratsg kratsg commented Mar 17, 2026

This will add a hint to the pyhs3.Workspace.load that suggests re-exporting the ROOT workspace if it is able to determine that the ROOT version is older, as a quick fix for some common validation errors that occur due to using a buggier ROOT export from older versions.

/cc @Phmonski

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 17, 2026

❌ 8 Tests Failed:

Tests completed Failed Passed Skipped
856 8 848 1
View the top 3 failed test(s) by shortest run time
tests\test_pdf.py::test_pdf::test_combine_long_exercise_logpdf_evaluation
Stack Traces | 0.009s run time
datadir = WindowsPath('C:.../pytest-of-runneradmin/pytest-0/test_combine_long_exercise_log0')

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_combine_long_exercise_logpdf_evaluation#x1B[39;49;00m(datadir):#x1B[90m#x1B[39;49;00m
    #x1B[90m    #x1B[39;49;00m#x1B[33m"""Test logPDF evaluation for pdf_binsignal_region from combine long exercise."""#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
>       workspace = Workspace(#x1B[90m#x1B[39;49;00m
            **json.loads(#x1B[90m#x1B[39;49;00m
                datadir.joinpath(#x1B[33m"#x1B[39;49;00m#x1B[33mcombine_long_exercise_part1_nosys.json#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m).read_text()#x1B[90m#x1B[39;49;00m
            )#x1B[90m#x1B[39;49;00m
        )#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       pydantic_core._pydantic_core.ValidationError: 1 validation error for Workspace#x1B[0m
#x1B[1m#x1B[31mE       metadata.packages.0#x1B[0m
#x1B[1m#x1B[31mE         Value error, ROOT version 6.35.01 is older than the minimum required version 6.38. Please upgrade ROOT and regenerate the workspace. [type=value_error, input_value={'name': 'ROOT', 'version': '6.35.01'}, input_type=dict]#x1B[0m
#x1B[1m#x1B[31mE           For further information visit https://errors.pydantic.dev/2.12/v/value_error#x1B[0m

datadir    = WindowsPath('C:.../pytest-of-runneradmin/pytest-0/test_combine_long_exercise_log0')

#x1B[1m#x1B[31mtests\test_pdf.py#x1B[0m:190: ValidationError
tests\test_pdf.py::test_pdf::test_rf501_simultaneouspdf
Stack Traces | 0.01s run time
datadir = WindowsPath('C:.../pytest-of-runneradmin/pytest-0/test_rf501_simultaneouspdf0')

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_rf501_simultaneouspdf#x1B[39;49;00m(datadir):#x1B[90m#x1B[39;49;00m
>       workspace = Workspace(#x1B[90m#x1B[39;49;00m
            **json.loads(datadir.joinpath(#x1B[33m"#x1B[39;49;00m#x1B[33mrf501_simultaneouspdf.json#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m).read_text())#x1B[90m#x1B[39;49;00m
        )#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       pydantic_core._pydantic_core.ValidationError: 1 validation error for Workspace#x1B[0m
#x1B[1m#x1B[31mE       metadata.packages.0#x1B[0m
#x1B[1m#x1B[31mE         Value error, ROOT version 6.32.06 is older than the minimum required version 6.38. Please upgrade ROOT and regenerate the workspace. [type=value_error, input_value={'name': 'ROOT', 'version': '6.32.06'}, input_type=dict]#x1B[0m
#x1B[1m#x1B[31mE           For further information visit https://errors.pydantic.dev/2.12/v/value_error#x1B[0m

datadir    = WindowsPath('C:.../pytest-of-runneradmin/pytest-0/test_rf501_simultaneouspdf0')

#x1B[1m#x1B[31mtests\test_pdf.py#x1B[0m:52: ValidationError
tests\test_pdf.py::test_pdf::test_rf501_manual
Stack Traces | 0.013s run time
datadir = WindowsPath('C:.../pytest-of-runneradmin/pytest-0/test_rf501_manual0')

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_rf501_manual#x1B[39;49;00m(datadir):#x1B[90m#x1B[39;49;00m
>       workspace = Workspace(#x1B[90m#x1B[39;49;00m
            **json.loads(datadir.joinpath(#x1B[33m"#x1B[39;49;00m#x1B[33mrf501_simultaneouspdf.json#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m).read_text())#x1B[90m#x1B[39;49;00m
        )#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       pydantic_core._pydantic_core.ValidationError: 1 validation error for Workspace#x1B[0m
#x1B[1m#x1B[31mE       metadata.packages.0#x1B[0m
#x1B[1m#x1B[31mE         Value error, ROOT version 6.32.06 is older than the minimum required version 6.38. Please upgrade ROOT and regenerate the workspace. [type=value_error, input_value={'name': 'ROOT', 'version': '6.32.06'}, input_type=dict]#x1B[0m
#x1B[1m#x1B[31mE           For further information visit https://errors.pydantic.dev/2.12/v/value_error#x1B[0m

datadir    = WindowsPath('C:.../pytest-of-runneradmin/pytest-0/test_rf501_manual0')

#x1B[1m#x1B[31mtests\test_pdf.py#x1B[0m:84: ValidationError
tests\test_realworld.py::test_realworld::TestDiHiggsIssue41Workspace::test_workspace_has_expected_distributions
Stack Traces | 1.34s run time
ws_json = {'analyses': [{'domains': ['CombinedPdf_AsimovData_0_nuisance_parameters', 'CombinedPdf_AsimovData_0_parameters_of_int...'name': 'mu_HH'}], 'name': 'CombinedPdf_AsimovData_muhat_parameters_of_interest', 'type': 'product_domain'}, ...], ...}

    #x1B[0m#x1B[37m@pytest#x1B[39;49;00m.fixture#x1B[90m#x1B[39;49;00m
    #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mws_workspace#x1B[39;49;00m(ws_json):#x1B[90m#x1B[39;49;00m
    #x1B[90m    #x1B[39;49;00m#x1B[33m"""Create workspace from WS.json content."""#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
>       #x1B[94mreturn#x1B[39;49;00m hs3.Workspace(**ws_json)#x1B[90m#x1B[39;49;00m
               ^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       pydantic_core._pydantic_core.ValidationError: 1 validation error for Workspace#x1B[0m
#x1B[1m#x1B[31mE       metadata.packages.0#x1B[0m
#x1B[1m#x1B[31mE         Value error, ROOT version 6.34.04 is older than the minimum required version 6.38. Please upgrade ROOT and regenerate the workspace. [type=value_error, input_value={'name': 'ROOT', 'version': '6.34.04'}, input_type=dict]#x1B[0m
#x1B[1m#x1B[31mE           For further information visit https://errors.pydantic.dev/2.12/v/value_error#x1B[0m

ws_json    = {'analyses': [{'domains': ['CombinedPdf_AsimovData_0_nuisance_parameters', 'CombinedPdf_AsimovData_0_parameters_of_int...'name': 'mu_HH'}], 'name': 'CombinedPdf_AsimovData_muhat_parameters_of_interest', 'type': 'product_domain'}, ...], ...}

#x1B[1m#x1B[31mtests\test_realworld.py#x1B[0m:26: ValidationError
tests\test_realworld.py::test_realworld::TestDiHiggsIssue41Workspace::test_workspace_model_creation
Stack Traces | 1.36s run time
ws_json = {'analyses': [{'domains': ['CombinedPdf_AsimovData_0_nuisance_parameters', 'CombinedPdf_AsimovData_0_parameters_of_int...'name': 'mu_HH'}], 'name': 'CombinedPdf_AsimovData_muhat_parameters_of_interest', 'type': 'product_domain'}, ...], ...}

    #x1B[0m#x1B[37m@pytest#x1B[39;49;00m.fixture#x1B[90m#x1B[39;49;00m
    #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mws_workspace#x1B[39;49;00m(ws_json):#x1B[90m#x1B[39;49;00m
    #x1B[90m    #x1B[39;49;00m#x1B[33m"""Create workspace from WS.json content."""#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
>       #x1B[94mreturn#x1B[39;49;00m hs3.Workspace(**ws_json)#x1B[90m#x1B[39;49;00m
               ^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       pydantic_core._pydantic_core.ValidationError: 1 validation error for Workspace#x1B[0m
#x1B[1m#x1B[31mE       metadata.packages.0#x1B[0m
#x1B[1m#x1B[31mE         Value error, ROOT version 6.34.04 is older than the minimum required version 6.38. Please upgrade ROOT and regenerate the workspace. [type=value_error, input_value={'name': 'ROOT', 'version': '6.34.04'}, input_type=dict]#x1B[0m
#x1B[1m#x1B[31mE           For further information visit https://errors.pydantic.dev/2.12/v/value_error#x1B[0m

ws_json    = {'analyses': [{'domains': ['CombinedPdf_AsimovData_0_nuisance_parameters', 'CombinedPdf_AsimovData_0_parameters_of_int...'name': 'mu_HH'}], 'name': 'CombinedPdf_AsimovData_muhat_parameters_of_interest', 'type': 'product_domain'}, ...], ...}

#x1B[1m#x1B[31mtests\test_realworld.py#x1B[0m:26: ValidationError
tests\test_realworld.py::test_realworld::TestDiHiggsIssue41Workspace::test_workspace_loads_successfully
Stack Traces | 1.46s run time
ws_json = {'analyses': [{'domains': ['CombinedPdf_AsimovData_0_nuisance_parameters', 'CombinedPdf_AsimovData_0_parameters_of_int...'name': 'mu_HH'}], 'name': 'CombinedPdf_AsimovData_muhat_parameters_of_interest', 'type': 'product_domain'}, ...], ...}

    #x1B[0m#x1B[37m@pytest#x1B[39;49;00m.fixture#x1B[90m#x1B[39;49;00m
    #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mws_workspace#x1B[39;49;00m(ws_json):#x1B[90m#x1B[39;49;00m
    #x1B[90m    #x1B[39;49;00m#x1B[33m"""Create workspace from WS.json content."""#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
>       #x1B[94mreturn#x1B[39;49;00m hs3.Workspace(**ws_json)#x1B[90m#x1B[39;49;00m
               ^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       pydantic_core._pydantic_core.ValidationError: 1 validation error for Workspace#x1B[0m
#x1B[1m#x1B[31mE       metadata.packages.0#x1B[0m
#x1B[1m#x1B[31mE         Value error, ROOT version 6.34.04 is older than the minimum required version 6.38. Please upgrade ROOT and regenerate the workspace. [type=value_error, input_value={'name': 'ROOT', 'version': '6.34.04'}, input_type=dict]#x1B[0m
#x1B[1m#x1B[31mE           For further information visit https://errors.pydantic.dev/2.12/v/value_error#x1B[0m

ws_json    = {'analyses': [{'domains': ['CombinedPdf_AsimovData_0_nuisance_parameters', 'CombinedPdf_AsimovData_0_parameters_of_int...'name': 'mu_HH'}], 'name': 'CombinedPdf_AsimovData_muhat_parameters_of_interest', 'type': 'product_domain'}, ...], ...}

#x1B[1m#x1B[31mtests\test_realworld.py#x1B[0m:26: ValidationError
tests\test_realworld.py::test_realworld::TestDiHiggsIssue41Workspace::test_workspace_parameter_structure
Stack Traces | 1.56s run time
ws_json = {'analyses': [{'domains': ['CombinedPdf_AsimovData_0_nuisance_parameters', 'CombinedPdf_AsimovData_0_parameters_of_int...'name': 'mu_HH'}], 'name': 'CombinedPdf_AsimovData_muhat_parameters_of_interest', 'type': 'product_domain'}, ...], ...}

    #x1B[0m#x1B[37m@pytest#x1B[39;49;00m.fixture#x1B[90m#x1B[39;49;00m
    #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mws_workspace#x1B[39;49;00m(ws_json):#x1B[90m#x1B[39;49;00m
    #x1B[90m    #x1B[39;49;00m#x1B[33m"""Create workspace from WS.json content."""#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
>       #x1B[94mreturn#x1B[39;49;00m hs3.Workspace(**ws_json)#x1B[90m#x1B[39;49;00m
               ^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       pydantic_core._pydantic_core.ValidationError: 1 validation error for Workspace#x1B[0m
#x1B[1m#x1B[31mE       metadata.packages.0#x1B[0m
#x1B[1m#x1B[31mE         Value error, ROOT version 6.34.04 is older than the minimum required version 6.38. Please upgrade ROOT and regenerate the workspace. [type=value_error, input_value={'name': 'ROOT', 'version': '6.34.04'}, input_type=dict]#x1B[0m
#x1B[1m#x1B[31mE           For further information visit https://errors.pydantic.dev/2.12/v/value_error#x1B[0m

ws_json    = {'analyses': [{'domains': ['CombinedPdf_AsimovData_0_nuisance_parameters', 'CombinedPdf_AsimovData_0_parameters_of_int...'name': 'mu_HH'}], 'name': 'CombinedPdf_AsimovData_muhat_parameters_of_interest', 'type': 'product_domain'}, ...], ...}

#x1B[1m#x1B[31mtests\test_realworld.py#x1B[0m:26: ValidationError
tests\test_realworld.py::test_realworld::test_workspace_loading
Stack Traces | 1.76s run time
ws_json = {'analyses': [{'domains': ['CombinedPdf_AsimovData_0_nuisance_parameters', 'CombinedPdf_AsimovData_0_parameters_of_int...'name': 'mu_HH'}], 'name': 'CombinedPdf_AsimovData_muhat_parameters_of_interest', 'type': 'product_domain'}, ...], ...}

    #x1B[0m#x1B[37m@pytest#x1B[39;49;00m.fixture#x1B[90m#x1B[39;49;00m
    #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mws_workspace#x1B[39;49;00m(ws_json):#x1B[90m#x1B[39;49;00m
    #x1B[90m    #x1B[39;49;00m#x1B[33m"""Create workspace from WS.json content."""#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
>       #x1B[94mreturn#x1B[39;49;00m hs3.Workspace(**ws_json)#x1B[90m#x1B[39;49;00m
               ^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       pydantic_core._pydantic_core.ValidationError: 1 validation error for Workspace#x1B[0m
#x1B[1m#x1B[31mE       metadata.packages.0#x1B[0m
#x1B[1m#x1B[31mE         Value error, ROOT version 6.34.04 is older than the minimum required version 6.38. Please upgrade ROOT and regenerate the workspace. [type=value_error, input_value={'name': 'ROOT', 'version': '6.34.04'}, input_type=dict]#x1B[0m
#x1B[1m#x1B[31mE           For further information visit https://errors.pydantic.dev/2.12/v/value_error#x1B[0m

ws_json    = {'analyses': [{'domains': ['CombinedPdf_AsimovData_0_nuisance_parameters', 'CombinedPdf_AsimovData_0_parameters_of_int...'name': 'mu_HH'}], 'name': 'CombinedPdf_AsimovData_muhat_parameters_of_interest', 'type': 'product_domain'}, ...], ...}

#x1B[1m#x1B[31mtests\test_realworld.py#x1B[0m:26: ValidationError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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.

1 participant