fix: use get_project_base() in Extension.validate() - #1310
Open
Thanhphan1147 wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns Extension.validate() with the extension factory dispatch logic by using get_project_base() (which gives build-base precedence over base and normalizes legacy ubuntu:<series> syntax). This prevents extensions from incorrectly rejecting projects that use base: bare alongside a real Ubuntu build-base.
Changes:
- Update
Extension.validate()to resolve the effective base viaget_project_base()(falling back to the rawbasefield when it can’t be resolved). - Adjust unit test expectations to match
get_project_base()normalization of legacyubuntu:<series>format. - Add a regression test ensuring
base: bare+build-base: ubuntu@26.04dispatches to ExpressJS V2 without raising an extension base incompatibility error.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| rockcraft/extensions/extension.py | Use get_project_base() in Extension.validate() so validation matches dispatch rules (notably build-base precedence). |
| tests/unit/extensions/test_extensions.py | Update parametrization and expected error message to reflect base normalization (: → @). |
| tests/unit/extensions/test_expressjs.py | Add regression test for base: bare + build-base: ubuntu@26.04 dispatch/validation behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extension.validate()is still using the rawbasevalue from yaml_data:However, with the new extension dispatch,
_FrameworkFactory.__call__usesget_project_base, which gives build-base precedence over base and more importantly use the value ofbuild-basewhen base isbare. This breaks some workflow where the user setsbuild-base: ubuntu@26.04andbase: bareand rockcraft would report:make lint && make test.