← Back to issue list

repo: unify package repository representations

View original Github issue

Metadata

Project
craft-archives
Number
#57
Type
pull request
State
merged
Author
tigarmo
Labels
—
Created
Updated
Closed

Current evaluation

Merged as commit c9bd220: unified package_repositories and projects models, removing duplicate Apt/AptDeb/AptPPA/AptUCA classes, switching validation to Pydantic errors, and consolidating tests (CRAFT-1665).

Resolution: closed resolved

Reason: The PR itself was merged into main by maintainer tigarmo as commit c9bd220 ("repo: unify package repository representations (#57)") after approval from lengau; downstream Snapcraft needed only minor adjustments in snapcore/snapcraft#4107.

Evaluated by: mr-cal-bot

No scores available.

Issue body

This commit unifies the repo models from `package_repositories` and `projects`. Remarks: - The Apt, AptDeb, AptPPA and AptUCA classes are removed completely from the `projects` module. The verification that they performed is now done by their "duals" in `package_repositories`. - `projects.validate_repository()` is preserved as it's part of the "official" public API. Its implementation is changed to just call PackageRepository.unmarshal(), with (hopefully) no change in semantics. - The `PackageRepositoryApt.name` property is removed; as far as I can tell only test code used it and it's not documented (it looks like it's not meant to be used by client code), so might as well remove it while we're cleaning things up. - The majority of the model validation now generates Pydantic errors instead of the custom `errors.PackageRepositoryValidationError`. This is consistent with what the applications do but necessitates a small loss in "error clarity" because we remove the "resolution" and "details" fields. Hopefully the messages are still sufficiently clear. - There were many duplicated tests between `test_package_repository.py` and `test_projects.py`, because each set performed the same validation tests in the two model classes "types". Now the majority of the tests are in `test_package_repository.py`. - A minor point; the "priority" field is read as either an integer or one of the valid string values, but stored internally always as an integer (or None). - [ ] Have you followed the guidelines for contributing? - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] Have you successfully run `tox`? ----- CRAFT-1665

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged as commit c9bd220: unified package_repositories and projects models, removing duplicate Apt/AptDeb/AptPPA/AptUCA classes, switching validation to Pydantic errors, and consolidating tests (CRAFT-1665).
stealth/space-bunny-alpha — closed resolved Merged #57 as c9bd220, unifying package_repositories and projects, removing duplicate Apt models, and standardizing repository validation on Pydantic.
qwen/qwen3.6-35b-a3b — — Merged. Consolidates package_repositories and projects modules into a unified model. Removes duplicate Apt classes, switches validation to Pydantic errors, and consolidates tests. Approved and merged after passing CI checks.

Update history

No update history recorded yet.

Related work

  • Related To: snapcore/snapcraft#4107 (confidence 70%)

    Downstream Snapcraft change required to adapt to the removal of the projects Apt classes, cited by the author in the PR description.

  • Likely Fixed By: craft-archives#80 (confidence 35%)

    Later PR touching PackageRepositoryApt models further builds on the unified package_repositories model introduced here.

Related issues

No related issues found above the similarity threshold.