Refactor `platform` validation
Metadata
Current evaluation
Platform validation refactoring completed. The build planner was restructured with craft-application 5 and craft-platforms, rendering the original scope obsolete. Validation logic was consolidated and cleaned up.
Suggested action: —
No scores available.
Issue body
Based on Rockcraft, the `platform` validation occurs in `snapcraft.models.SnapcraftBuildPlanner` and `snapcraft.models.Project`. This can be combined in `snapcraft.models.Project`.
Scope of work:
- [ ] move and rework validation code
- [ ] adjust unit tests
- [ ] adjust types in both models and satisfy the type checkers
### Source
It feels that we handle this by defining a platform model separately and let pydantic do the heavylifting of hierarchically validating `platforms` as a list of platform models, isn't that possible? It would reduce the complexity of this validator.
_Originally posted by @cmatsuoka in https://github.com/canonical/snapcraft/pull/4630#discussion_r1517943384_
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Platform validation refactoring completed. The build planner was restructured with craft-application 5 and craft-platforms, rendering the original scope obsolete. Validation logic was consolidated and cleaned up. | |
| qwen/qwen3.6-35b-a3b | — | — | The platform validation refactoring was completed. The maintainer closed the issue after noting the code was cleaned up and the build planner architecture significantly changed with craft-application 5 and craft-platforms, rendering the original scope obsolete. | |
| qwen/qwen3.6-35b-a3b | — | — | The platform validation refactor was completed. The original scope was superseded by architectural changes in craft-application 5 and the introduction of craft-platforms, which already addressed the validation requirements. The issue was marked as completed. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Platform validation refactored and cleaned up. The build planner was significantly restructured with craft-application 5 and craft-platforms, resolving the original scope. Closed as completed. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Platform validation refactored and cleaned up. Integration of craft-application 5 and craft-platforms significantly changed the build planner, superseding the original scope. Issue marked as completed. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #502 Refactor platform validation | rockcraft | open | Code debt: consolidate platform validation from BuildPlanner into Project model. BuildPlanner no longer exists in the codebase; platform validation is now in Project using craft_application's Platform model. Inactive for 381 days, no labels or maintainer engagement. | |
| #1894 refactor: use craft-platforms for build plans | charmcraft | merged | Merged a refactor replacing custom build plan logic with craft-platforms for platforms charms. Approved by two reviewers, the change modifies two files with a net reduction of eight lines, streamlining platform handling. |