core icon indicating copy to clipboard operation
core copied to clipboard

Improve package schema validation

Open chammp opened this issue 1 year ago • 3 comments

Proposed change

Properly handle validation errors occuring for packages inside core yaml instead of failing at Home Assistant startup. Currently, on package schema validation errors, HA startup completely fails. After this PR, HA will instead load each package that is defined correctly and skip over packages that have a definition error. (This change does not affect definitions inside packages, but the basic package definition instead.) If the whole packages node is invalid, no packages will be loaded at all, but HA still starts.

Type of change

  • [ ] Dependency upgrade
  • [x] Bugfix (non-breaking change which fixes an issue)
  • [ ] New integration (thank you!)
  • [ ] New feature (which adds functionality to an existing integration)
  • [ ] Deprecation (breaking change to happen in the future)
  • [ ] Breaking change (fix/feature causing existing functionality to break)
  • [ ] Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • [x] The code change is tested and works locally.
  • [x] Local tests pass. Your PR cannot be merged unless tests pass
  • [x] There is no commented out code in this PR.
  • [x] I have followed the development checklist
  • [x] I have followed the perfect PR recommendations
  • [x] The code has been formatted using Ruff (ruff format homeassistant tests)
  • [x] Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • [ ] The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • [ ] New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • [ ] Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

chammp avatar Jan 15 '24 21:01 chammp

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

home-assistant[bot] avatar Jan 16 '24 14:01 home-assistant[bot]

Regarding this CI failure grafik I think this is unrelated to my changes.

grafik

The test that fails is not related to this PR; I did my best to forward-trace the code execution. Just FYI, dear reviewer(s) 😉

chammp avatar Jan 29 '24 19:01 chammp

The test failures are unrelated, but we can let CI run to completion once before merging to get code coverage of the new code in codecov.

emontnemery avatar Feb 01 '24 12:02 emontnemery