← 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. 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.

Suggested action:

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
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.
qwen3.6-35b-a3b-mtp-q6 Merged consolidation of package_repositories and projects modules. Duplicate classes were removed, validation switched to Pydantic, tests consolidated, and the public API wrapper updated. Verified in snapcraft and rockcraft before merge.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#3647 repo: add package repository handling (CRAFT-846) snapcraft merged Merged into main. Introduces apt repository and PPA handling definitions and helpers, consolidated from multiple prior pull requests. Approved by reviewers, passed all CI checks, and increased test coverage.
72%
#1192 repo: refactor into a package. snapcraft merged Merged after two approvals. Refactored the repo module into a package across 41 files to simplify extending BaseRepo for external functionality. Changes were split during review, CI proxy issues were resolved, and integration completed.
70%
#3363 repo: apt sources management refactor snapcraft merged Merged refactor of apt sources management. Migrated to AptSourcesManager, removed PackageRepository install interfaces, and updated project loader. No behavioral changes. Approved, passed CI, +0.06% coverage.
70%